ddpf12_structure.sql 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. /*
  2. Navicat MySQL Data Transfer
  3. Source Server : qnear.org
  4. Source Server Version : 50711
  5. Source Host : qnear.org:3306
  6. Source Database : ddpf
  7. Target Server Type : MYSQL
  8. Target Server Version : 50711
  9. File Encoding : 65001
  10. Date: 2016-07-03 15:52:09
  11. */
  12. SET FOREIGN_KEY_CHECKS=0;
  13. -- ----------------------------
  14. -- Table structure for t_accident
  15. -- ----------------------------
  16. DROP TABLE IF EXISTS `t_accident`;
  17. CREATE TABLE `t_accident` (
  18. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表Id',
  19. `accident_year` varchar(255) DEFAULT NULL COMMENT '事故学年',
  20. `accident_term` varchar(255) DEFAULT NULL COMMENT '事故学期',
  21. `teacher_name` varchar(255) DEFAULT NULL COMMENT '教师名',
  22. `teacher_college` varchar(255) DEFAULT NULL COMMENT '教师学院',
  23. `accident_type` varchar(255) DEFAULT NULL COMMENT '事故类型',
  24. `accident_comment` varchar(500) DEFAULT NULL COMMENT '事故内容',
  25. PRIMARY KEY (`t_id`)
  26. ) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8;
  27. -- ----------------------------
  28. -- Table structure for t_aduit_status
  29. -- ----------------------------
  30. DROP TABLE IF EXISTS `t_aduit_status`;
  31. CREATE TABLE `t_aduit_status` (
  32. `t_id` bigint(20) NOT NULL AUTO_INCREMENT,
  33. `year` varchar(255) COLLATE utf8_bin NOT NULL,
  34. `college_status` varchar(255) COLLATE utf8_bin NOT NULL,
  35. `graduate_status` varchar(255) COLLATE utf8_bin NOT NULL,
  36. PRIMARY KEY (`t_id`)
  37. ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  38. -- ----------------------------
  39. -- Table structure for t_course
  40. -- ----------------------------
  41. DROP TABLE IF EXISTS `t_course`;
  42. CREATE TABLE `t_course` (
  43. `t_id` int(50) NOT NULL AUTO_INCREMENT COMMENT '表ID',
  44. `course_year` varchar(255) DEFAULT NULL COMMENT '课表年份',
  45. `course_term` varchar(255) DEFAULT NULL COMMENT '课表学期',
  46. `course_time` varchar(255) DEFAULT NULL COMMENT '上课时间',
  47. `course_week_rank` varchar(255) DEFAULT NULL COMMENT '起止周',
  48. `course_name` varchar(255) DEFAULT NULL COMMENT '课程名称',
  49. `teacher_account` varchar(255) DEFAULT NULL COMMENT '教师职工号',
  50. `teacher_name` varchar(255) DEFAULT NULL COMMENT '教师姓名',
  51. `teacher_department` varchar(255) DEFAULT NULL COMMENT '教师所属学院',
  52. `class_room` varchar(255) DEFAULT NULL COMMENT '上课教室',
  53. `campus_name` varchar(255) DEFAULT NULL COMMENT '校区名称',
  54. `student_count` varchar(255) DEFAULT NULL COMMENT '上课人数',
  55. `student_class` varchar(255) DEFAULT NULL COMMENT '上课班级',
  56. `course_college` varchar(255) DEFAULT NULL COMMENT '开课学院',
  57. `arrange_status` int(11) NOT NULL,
  58. PRIMARY KEY (`t_id`)
  59. ) ENGINE=InnoDB AUTO_INCREMENT=170961 DEFAULT CHARSET=utf8;
  60. -- ----------------------------
  61. -- Table structure for t_excellent
  62. -- ----------------------------
  63. DROP TABLE IF EXISTS `t_excellent`;
  64. CREATE TABLE `t_excellent` (
  65. `t_id` bigint(20) NOT NULL AUTO_INCREMENT,
  66. `teacher_account` varchar(255) DEFAULT NULL,
  67. `year` varchar(255) DEFAULT NULL,
  68. `term` varchar(255) DEFAULT NULL,
  69. `teacher_college` varchar(255) DEFAULT NULL,
  70. `teacher_name` varchar(255) DEFAULT NULL,
  71. `teacher_title_name` varchar(255) DEFAULT NULL,
  72. `teacher_job` varchar(255) DEFAULT NULL,
  73. `declare_level` varchar(255) DEFAULT NULL,
  74. `teacher_rank` varchar(255) DEFAULT NULL,
  75. `spv_score` varchar(255) DEFAULT NULL,
  76. `stu_score` varchar(255) DEFAULT NULL,
  77. `total_score` varchar(255) DEFAULT NULL,
  78. `independce_course` varchar(255) DEFAULT NULL,
  79. `up__independce_course` varchar(255) DEFAULT NULL,
  80. `total_class_hour` varchar(255) DEFAULT NULL,
  81. `up__total_class_hour` varchar(255) DEFAULT NULL,
  82. `bachelor_hour` varchar(255) DEFAULT NULL,
  83. `up__bachelor_hour` varchar(255) DEFAULT NULL,
  84. `gradute_hour` varchar(255) DEFAULT NULL,
  85. `up__gradute_hour` varchar(255) DEFAULT NULL,
  86. `job_reduce` varchar(255) DEFAULT NULL,
  87. `total_hour` varchar(255) DEFAULT NULL,
  88. `audit_college_status` varchar(255) DEFAULT NULL,
  89. `audit_graduate_status` varchar(255) DEFAULT NULL,
  90. `audit_final_status` varchar(255) DEFAULT NULL,
  91. `college_comform_status` varchar(255) DEFAULT NULL,
  92. `accident` varchar(255) DEFAULT NULL,
  93. `audit_final_commit_status` varchar(255) DEFAULT NULL COMMENT '最终提交状态',
  94. PRIMARY KEY (`t_id`)
  95. ) ENGINE=InnoDB AUTO_INCREMENT=309 DEFAULT CHARSET=utf8;
  96. -- ----------------------------
  97. -- Table structure for t_spv_score
  98. -- ----------------------------
  99. DROP TABLE IF EXISTS `t_spv_score`;
  100. CREATE TABLE `t_spv_score` (
  101. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表Id',
  102. `f_spv` int(20) NOT NULL COMMENT '链接spv表的外键',
  103. `should_num` varchar(255) DEFAULT '' COMMENT '应到人数',
  104. `actual_num` varchar(255) DEFAULT '' COMMENT '实到人数',
  105. `late_num` varchar(255) DEFAULT '' COMMENT '迟到人数',
  106. `truant_num` varchar(255) DEFAULT '' COMMENT '旷课人数',
  107. `course_content` varchar(255) DEFAULT '' COMMENT '课程内容',
  108. `attitude_score` varchar(255) DEFAULT '' COMMENT '教学态度分数',
  109. `ability_score` varchar(255) DEFAULT '' COMMENT '教学能力分数',
  110. `effect_score` varchar(255) DEFAULT '' COMMENT '教学效果分数',
  111. `spv_appraise` varchar(1000) DEFAULT '' COMMENT '评价与建议',
  112. `spv_comment` varchar(500) DEFAULT '' COMMENT '备注',
  113. PRIMARY KEY (`t_id`),
  114. KEY `FK_score_to_spv` (`spv_comment`(255)),
  115. KEY `f_score_spv` (`f_spv`),
  116. CONSTRAINT `f_score_spv` FOREIGN KEY (`f_spv`) REFERENCES `t_supersior` (`t_id`) ON DELETE CASCADE ON UPDATE CASCADE
  117. ) ENGINE=InnoDB AUTO_INCREMENT=4788 DEFAULT CHARSET=utf8;
  118. -- ----------------------------
  119. -- Table structure for t_stu_score
  120. -- ----------------------------
  121. DROP TABLE IF EXISTS `t_stu_score`;
  122. CREATE TABLE `t_stu_score` (
  123. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表id',
  124. `course_name` varchar(255) DEFAULT NULL COMMENT '课程名称',
  125. `teacher_name` varchar(255) DEFAULT NULL COMMENT '教师名',
  126. `teacher_college` varchar(255) DEFAULT NULL COMMENT '教师所在学院',
  127. `course_college` varchar(255) DEFAULT NULL COMMENT '开课学院',
  128. `course_first_score` varchar(255) DEFAULT NULL COMMENT '课程评分(系统)',
  129. `course_final_score` varchar(255) DEFAULT NULL COMMENT '最终分数(修改后)',
  130. `course_year` varchar(255) DEFAULT NULL COMMENT '课程学年',
  131. `course_term` varchar(255) DEFAULT NULL COMMENT '课程学期',
  132. `weight_score` varchar(255) DEFAULT NULL COMMENT '加权平均分',
  133. `teacher_account` varchar(255) DEFAULT NULL COMMENT '教师账号',
  134. `join_number` varchar(255) DEFAULT NULL COMMENT '参评人数',
  135. `count_number` varchar(255) DEFAULT NULL COMMENT '计分人数',
  136. PRIMARY KEY (`t_id`)
  137. ) ENGINE=InnoDB AUTO_INCREMENT=40271 DEFAULT CHARSET=utf8;
  138. -- ----------------------------
  139. -- Table structure for t_supersior
  140. -- ----------------------------
  141. DROP TABLE IF EXISTS `t_supersior`;
  142. CREATE TABLE `t_supersior` (
  143. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表ID',
  144. `f_course` int(20) DEFAULT NULL,
  145. `f_spv_score` int(20) DEFAULT NULL,
  146. `spv_year` varchar(255) DEFAULT NULL,
  147. `spv_term` varchar(30) DEFAULT NULL COMMENT '听课学期',
  148. `class_teacher` varchar(255) DEFAULT NULL COMMENT '授课教师',
  149. `teacher_college` varchar(255) DEFAULT NULL COMMENT '教师所属学院',
  150. `course_name` varchar(255) DEFAULT NULL COMMENT '课程名称',
  151. `listen_date` varchar(255) DEFAULT NULL COMMENT '听课日期',
  152. `listen_week` varchar(255) DEFAULT NULL COMMENT '周次',
  153. `listen_day` varchar(255) DEFAULT NULL COMMENT '星期',
  154. `listen_section` varchar(255) DEFAULT NULL COMMENT '节次',
  155. `class_room` varchar(255) DEFAULT NULL COMMENT '授课地点',
  156. `course_class` varchar(255) DEFAULT NULL COMMENT '授课班级',
  157. `spv_first_score` varchar(255) DEFAULT NULL COMMENT '评分(系统)',
  158. `spv_final_score` varchar(255) DEFAULT NULL COMMENT '评分(修改后)',
  159. `spv_level` varchar(255) DEFAULT NULL COMMENT '等级',
  160. `spv_comment` varchar(500) DEFAULT NULL COMMENT '备注',
  161. `spv_name` varchar(255) DEFAULT NULL COMMENT '督导名',
  162. `spv_account` varchar(20) DEFAULT NULL COMMENT '督导工号',
  163. `commit_status` varchar(255) DEFAULT '' COMMENT '评价表提交状态',
  164. `course_college` varchar(255) DEFAULT NULL COMMENT '开课学院',
  165. `to_exc_status` varchar(255) DEFAULT '未推优' COMMENT '推优状态',
  166. `class_stu_num` varchar(255) DEFAULT NULL,
  167. PRIMARY KEY (`t_id`),
  168. KEY `f_spv_to_score` (`f_spv_score`),
  169. KEY `f_spv_to_course` (`f_course`),
  170. CONSTRAINT `f_spv_to_course` FOREIGN KEY (`f_course`) REFERENCES `t_course` (`t_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  171. CONSTRAINT `f_spv_to_score` FOREIGN KEY (`f_spv_score`) REFERENCES `t_spv_score` (`t_id`) ON DELETE CASCADE ON UPDATE CASCADE
  172. ) ENGINE=InnoDB AUTO_INCREMENT=120816 DEFAULT CHARSET=utf8;
  173. -- ----------------------------
  174. -- Table structure for t_sys_appraise
  175. -- ----------------------------
  176. DROP TABLE IF EXISTS `t_sys_appraise`;
  177. CREATE TABLE `t_sys_appraise` (
  178. `t_id` int(20) NOT NULL COMMENT '表ID',
  179. `first_rank_per` varchar(255) DEFAULT NULL COMMENT '一等奖占百分比(排名)',
  180. `second_rank_per` varchar(255) DEFAULT NULL COMMENT '二等奖占百分比(排名)',
  181. `first_num_per` varchar(255) DEFAULT NULL COMMENT '一等奖占百分比(人数)',
  182. `second_num_per` varchar(255) DEFAULT NULL COMMENT '二等奖占百分比(人数)',
  183. `least_idpd_course` varchar(255) DEFAULT NULL COMMENT '最少独立承担课程门数',
  184. `spv_per` varchar(255) DEFAULT NULL COMMENT '督导评分占评优比例',
  185. `stu_per` varchar(255) DEFAULT NULL COMMENT '学生评分占评优比例',
  186. `spv_score` varchar(255) DEFAULT NULL COMMENT '评优分数线督导得分',
  187. `stu_score` varchar(255) DEFAULT NULL COMMENT '评优分数线学生得分',
  188. `least_class_hour` varchar(255) DEFAULT NULL COMMENT '最少教学学时',
  189. `start_time` varchar(255) DEFAULT NULL COMMENT '设置推荐评优起始时间',
  190. `end_time` varchar(255) DEFAULT NULL COMMENT '设置推荐评优结束时间',
  191. `open_time` varchar(255) DEFAULT '' COMMENT '是否开启评优',
  192. `toexc_start` varchar(255) DEFAULT NULL COMMENT '推优开启时间',
  193. `toexc_end` varchar(255) DEFAULT NULL COMMENT '推优结束时间',
  194. `less_total` varchar(255) DEFAULT NULL,
  195. PRIMARY KEY (`t_id`)
  196. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  197. -- ----------------------------
  198. -- Table structure for t_sys_reduce
  199. -- ----------------------------
  200. DROP TABLE IF EXISTS `t_sys_reduce`;
  201. CREATE TABLE `t_sys_reduce` (
  202. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表Id',
  203. `admin_name` varchar(255) DEFAULT NULL COMMENT '职称',
  204. `admin_job` varchar(255) DEFAULT NULL COMMENT '行政职务',
  205. `admin_reduce` int(20) DEFAULT NULL COMMENT '职务减免',
  206. PRIMARY KEY (`t_id`)
  207. ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
  208. -- ----------------------------
  209. -- Table structure for t_sys_yearterm
  210. -- ----------------------------
  211. DROP TABLE IF EXISTS `t_sys_yearterm`;
  212. CREATE TABLE `t_sys_yearterm` (
  213. `t_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增Id',
  214. `sys_year` varchar(255) COLLATE utf8_bin NOT NULL COMMENT '学年',
  215. `sys_term` varchar(255) COLLATE utf8_bin NOT NULL COMMENT '学期',
  216. `sys_status` varchar(255) COLLATE utf8_bin NOT NULL COMMENT '是否当前学年学期',
  217. PRIMARY KEY (`t_id`)
  218. ) ENGINE=InnoDB AUTO_INCREMENT=189 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
  219. -- ----------------------------
  220. -- Table structure for t_teacher_listened
  221. -- ----------------------------
  222. DROP TABLE IF EXISTS `t_teacher_listened`;
  223. CREATE TABLE `t_teacher_listened` (
  224. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表ID',
  225. `listened_year` varchar(255) DEFAULT NULL COMMENT '学年',
  226. `listened_term` varchar(255) DEFAULT NULL COMMENT '学期',
  227. `teacher_name` varchar(255) DEFAULT NULL COMMENT '老师名字',
  228. `teacher_college` varchar(255) DEFAULT NULL COMMENT '老师所属学院',
  229. `cur_listened` int(20) DEFAULT NULL COMMENT '当前被听次数',
  230. PRIMARY KEY (`t_id`)
  231. ) ENGINE=InnoDB AUTO_INCREMENT=2668 DEFAULT CHARSET=utf8;
  232. -- ----------------------------
  233. -- Table structure for t_user
  234. -- ----------------------------
  235. DROP TABLE IF EXISTS `t_user`;
  236. CREATE TABLE `t_user` (
  237. `t_id` int(20) NOT NULL AUTO_INCREMENT COMMENT '表Id',
  238. `user_account` varchar(20) DEFAULT NULL COMMENT '学工账号',
  239. `user_password` varchar(255) DEFAULT NULL COMMENT '学工密码',
  240. `user_name` varchar(255) DEFAULT NULL COMMENT '学工姓名',
  241. `user_department` varchar(255) DEFAULT NULL COMMENT '所在部门',
  242. `user_role` varchar(255) DEFAULT NULL COMMENT '学工身份',
  243. `user_formation` varchar(255) DEFAULT NULL COMMENT '学工编制',
  244. `user_max_listened` int(20) DEFAULT NULL COMMENT '老师最大被听次数',
  245. `user_job` varchar(255) DEFAULT NULL COMMENT '学工职务',
  246. `user_title` varchar(255) DEFAULT NULL COMMENT '学工职称',
  247. `audit_privilege` varchar(255) DEFAULT NULL COMMENT '审核权限',
  248. PRIMARY KEY (`t_id`)
  249. ) ENGINE=InnoDB AUTO_INCREMENT=14680 DEFAULT CHARSET=utf8;
  250. -- ----------------------------
  251. -- Table structure for t__college_num
  252. -- ----------------------------
  253. DROP TABLE IF EXISTS `t__college_num`;
  254. CREATE TABLE `t__college_num` (
  255. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  256. `college` varchar(255) NOT NULL,
  257. `num` varchar(255) NOT NULL,
  258. PRIMARY KEY (`id`)
  259. ) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8;
  260. -- ----------------------------
  261. -- View structure for score_stu_spv
  262. -- ----------------------------
  263. DROP VIEW IF EXISTS `score_stu_spv`;
  264. CREATE VIEW `score_stu_spv` AS select `user`.`user_account` AS `account`,`user`.`user_name` AS `teacher_name`,`spv`.`course_name` AS `course_name`,`stu`.`course_final_score` AS `stu_score`,`spv`.`spv_final_score` AS `spv_score`,`spv`.`spv_name` AS `spvname`,`spv`.`spv_year` AS `course_year`,`spv`.`spv_term` AS `course_term`,`spv`.`course_college` AS `course_college`,`spv`.`to_exc_status` AS `to_exc_status`,`user`.`user_department` AS `teacher_college`,((`spv`.`spv_final_score` * `sys`.`spv_per`) + (`stu`.`course_final_score` * `sys`.`stu_per`)) AS `total` from (((`t_stu_score` `stu` join `t_supersior` `spv`) join `t_user` `user`) join `t_sys_appraise` `sys`) where ((`stu`.`course_name` = `spv`.`course_name`) and (`spv`.`teacher_college` = `stu`.`teacher_college`) and (`user`.`user_department` like concat(`spv`.`teacher_college`,_utf8'%')) and (`spv`.`class_teacher` = `stu`.`teacher_name`) and (`spv`.`class_teacher` = `user`.`user_name`) and (`spv`.`spv_year` = `stu`.`course_year`) and (`spv`.`spv_term` = `stu`.`course_term`)) ;
  265. -- ----------------------------
  266. -- View structure for score_stu_spv2
  267. -- ----------------------------
  268. DROP VIEW IF EXISTS `score_stu_spv2`;
  269. CREATE VIEW `score_stu_spv2` AS select `stu`.`course_year` AS `course_year`,`stu`.`course_term` AS `course_term`,`stu`.`course_name` AS `course_name`,`stu`.`teacher_account` AS `account`,`stu`.`teacher_name` AS `teacher_name`,`stu`.`teacher_college` AS `teacher_college`,`stu`.`course_final_score` AS `stu_score`,`spv`.`spv_final_score` AS `spv_score`,((`stu`.`course_first_score` * `sys`.`stu_per`) + (`spv`.`spv_final_score` * `sys`.`spv_per`)) AS `total` from ((`t_stu_score` `stu` join `t_supersior` `spv`) join `t_sys_appraise` `sys`) where ((`stu`.`course_year` = `spv`.`spv_year`) and (`stu`.`course_term` = `spv`.`spv_term`) and (`stu`.`course_name` = `spv`.`course_name`) and (`stu`.`teacher_name` = `spv`.`class_teacher`) and (`stu`.`teacher_college` = `spv`.`teacher_college`)) ;
  270. -- ----------------------------
  271. -- View structure for v_listened
  272. -- ----------------------------
  273. DROP VIEW IF EXISTS `v_listened`;
  274. CREATE VIEW `v_listened` AS select `l`.`listened_year` AS `listened_year`,`l`.`listened_term` AS `listened_term`,concat(`u`.`user_name`,_utf8'-',`l`.`teacher_college`) AS `listened_key`,(case when ((`u`.`user_max_listened` - `l`.`cur_listened`) > 0) then (`u`.`user_max_listened` - `l`.`cur_listened`) else 0 end) AS `residue_course` from (`t_user` `u` join `t_teacher_listened` `l`) where ((`u`.`user_name` = `l`.`teacher_name`) and (`u`.`user_department` like concat(`l`.`teacher_college`,_utf8'%'))) union select NULL ,NULL ,concat(`u`.`user_name`,_utf8'-',(case when (locate(_utf8'(',`u`.`user_department`) > 0) then substr(`u`.`user_department`,1,(locate(_utf8'(',`u`.`user_department`) - 1)) else `u`.`user_department` end)) AS `listened_key`,`u`.`user_max_listened` AS `user_max_listened` from `t_user` `u` ;
  275. -- ----------------------------
  276. -- View structure for v_tea_listened
  277. -- ----------------------------
  278. DROP VIEW IF EXISTS `v_tea_listened`;
  279. CREATE VIEW `v_tea_listened` AS select `t_user`.`user_account` AS `user_account`,`t_teacher_listened`.`listened_year` AS `listened_year`,`t_teacher_listened`.`listened_term` AS `listened_term`,`t_teacher_listened`.`cur_listened` AS `cur_listened`,`t_user`.`user_max_listened` AS `user_max_listened`,`t_user`.`user_name` AS `user_name`,`t_user`.`user_department` AS `user_department` from (`t_user` join `t_teacher_listened`) where ((`t_user`.`user_name` = `t_teacher_listened`.`teacher_name`) and (`t_user`.`user_department` like concat(`t_teacher_listened`.`teacher_college`,'%')) and (`t_user`.`user_role` like '%教师%')) ;
  280. -- ----------------------------
  281. -- View structure for v_to_excellent
  282. -- ----------------------------
  283. DROP VIEW IF EXISTS `v_to_excellent`;
  284. CREATE VIEW `v_to_excellent` AS select `user`.`user_account` AS `user_account`,`spv`.`spv_year` AS `year`,`user`.`user_name` AS `teacher_name`,`user`.`user_department` AS `teacher_college`,avg(`stu`.`course_final_score`) AS `stu_score`,avg(`spv`.`spv_final_score`) AS `spv_score`,((avg(`stu`.`course_final_score`) * `sys`.`stu_per`) + (avg(`spv`.`spv_final_score`) * `sys`.`spv_per`)) AS `total`,`spv`.`to_exc_status` AS `status` from (((`t_stu_score` `stu` join `t_supersior` `spv`) join `t_user` `user`) join `t_sys_appraise` `sys`) where ((`spv`.`class_teacher` = `stu`.`teacher_name`) and (`spv`.`teacher_college` = `stu`.`teacher_college`) and (`spv`.`class_teacher` = `user`.`user_name`) and (`user`.`user_department` like concat(`spv`.`teacher_college`,_utf8'%')) and (`spv`.`spv_year` = `stu`.`course_year`) and (`spv`.`spv_final_score` > 0)) group by `spv`.`spv_year`,`user`.`user_name`,`user`.`user_department` ;
  285. -- ----------------------------
  286. -- Procedure structure for count_sum_score
  287. -- ----------------------------
  288. DROP PROCEDURE IF EXISTS `count_sum_score`;
  289. DELIMITER ;;
  290. CREATE PROCEDURE `count_sum_score`(OUT `A_RESULT` int,OUT `B_RESULT` int,OUT `C_RESULT` int,OUT `ARG_A` int,OUT `ARG_B` int)
  291. BEGIN
  292. DECLARE V_STUPROPORTION FLOAT DEFAULT 0.0 ;
  293. DECLARE V_SUPPROPORTION FLOAT DEFAULT 0.0 ;
  294. -- 系统参数 学生、督导评分比例
  295. SELECT STUPROPORTION INTO V_STUPROPORTION FROM t_system ORDER BY TBLE_ID LIMIT 0,1;
  296. SELECT SUPPROPORTION INTO V_SUPPROPORTION FROM t_system ORDER BY TBLE_ID LIMIT 0,1;
  297. IF V_STUPROPORTION<=0 OR V_STUPROPORTION>1 OR V_STUPROPORTION IS NULL then
  298. SET V_STUPROPORTION=1;
  299. end if;
  300. IF V_SUPPROPORTION<=0 OR V_SUPPROPORTION>1 OR V_SUPPROPORTION is NULL then
  301. SET V_SUPPROPORTION=1;
  302. end if;
  303. start transaction;
  304. UPDATE t_course_score SET TOTAL_SCORE=( IFNULL(SUOERVISON_SCORE,0)*V_SUPPROPORTION+ IFNULL(STU_SCORE,0) *V_STUPROPORTION);
  305. -- 更新t_course_score过程 结束**********
  306. UPDATE t_appraise SET SUM_GRADE=( IFNULL(STUDENT_GRADE,0) *V_STUPROPORTION+ IFNULL(SUPERVISOR_GRADE,0) *V_SUPPROPORTION);
  307. -- 更新t_appraise过程 结束**********
  308. UPDATE t_appraise_first SET SUM_GRADE=( IFNULL(STUDENT_GRADE,0) *V_STUPROPORTION+ IFNULL(SUPERVISOR_GRADE,0) *V_SUPPROPORTION);
  309. -- 更新t_appraise_first过程 结束**********
  310. SET A_RESULT=1;-- 更新t_course_score过程结果
  311. SET B_RESULT=1;-- 更新t_appraise过程结果
  312. SET C_RESULT=1;-- 更新t_appraise_first过程结果
  313. commit;
  314. END
  315. ;;
  316. DELIMITER ;