Sfoglia il codice sorgente

班级组织:限制老师任教相同科目

zhaoy 7 anni fa
parent
commit
d21479549d

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/ClassServiceImpl.java

@@ -86,7 +86,7 @@ public class ClassServiceImpl implements ClassService{
         for (SysTeacherClazz detail : teachers) {
             detail.setClazz_id(clazz.getClazz_id());
             Integer count = 0;
-            count = sysClazzMapper.teacherClazz(detail.getTeacher_id(),detail.getClazz_id());
+            count = sysClazzMapper.teacherClazz(detail.getSubject_name(),detail.getClazz_id(),school_id);
             if(count > 0){
                 throw new BizException(BizExceptionCode.REPEAT_SUBJECTS);
             }

+ 2 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/exception/BizExceptionCode.java

@@ -25,13 +25,13 @@ public enum BizExceptionCode implements BaseExceptionCode {
     EXISTS_SCORE_PUBLISH(5000013, "存在已发布成绩,禁止删除"),
     EXISTS_CLASS(500011, "存在班级,无法删除"),
     HOMEWORK_RELEASE(500012, "存在发布作业,无法删除"),
-    REPEAT_SUBJECTS(600001, "老师已在这个班任教"),
+    REPEAT_SUBJECTS(600001, "同个老师不可班带相同的课"),
     REPEAT_GRADE_NAME(600001, "年级名称重复"),
     REPEAT_CLASS_NAME(600002, "班级名称重复"),
     REPEAT_STUDENT_NUMBER(600003, "学生学号不可重复"),
     TASK_RELEASE_STATUS(600005, "作业已发布无法更改"),
     COURSE_RELEASE_STATUS(600006, "课程表已生效,无法删除"),
-    NOTICE_RELEASE_STATUS(600007, "学校发布已生效,无法删除"),
+    NOTICE_RELEASE_STATUS(600007, "学校通知已生效,无法删除"),
     ILLEGAL_Gender(600007, "无效性别"),
     ILLEGAL_MARRIAGE(600008, "婚姻状态无效"),
     NOT_EXISTS_SUBJECT(60005, "科目<u>%s</u>不存在");

+ 1 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/SysClazzMapper.java

@@ -35,5 +35,5 @@ public interface SysClazzMapper {
 
     int countClazz(@Param("clazz_name") String clazz_name, @Param("clazz_grade") String clazz_grade, @Param("school_id") Long school_id);
 
-    Integer teacherClazz(@Param("teacher_id") Long teacher_id,@Param("clazz_id") Long clazz_id );
+    Integer teacherClazz(@Param("subject_name") String subject_name,@Param("clazz_id") Long clazz_id,@Param("school_id") Long school_id );
 }

+ 7 - 4
applications/school/school-server/src/main/resources/mapper/SysClazzMapper.xml

@@ -249,14 +249,17 @@
   </select>
 
   <select id="teacherClazz" resultType="int">
-    select count(*) from sys_teacher_clazz
+    select count(*) from sys_clazz left join sys_teacher_clazz on sys_clazz.clazz_id=sys_teacher_clazz.clazz_id
     <where>
-      <if test="teacher_id != null">
-         teacher_id=#{teacher_id}
+      <if test="subject_name != null">
+        sys_teacher_clazz.subject_name=#{subject_name}
       </if>
         <if test="clazz_id != null">
-            and clazz_id=#{clazz_id}
+            and sys_teacher_clazz.clazz_id=#{clazz_id}
         </if>
+      <if test="school_id != null">
+        and sys_clazz.school_id=#{school_id}
+      </if>
     </where>
   </select>