Browse Source

创建学校

tags/正式3.2.0
王宁 2 years ago
parent
commit
ede79a5159
20 changed files with 563 additions and 27 deletions
  1. 26
    1
      sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/ClassMapper.java
  2. 13
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/ClassStudentMapper.java
  3. 13
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/ClassTeacherMapper.java
  4. 13
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/GroupMapper.java
  5. 13
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/GroupStudentMapper.java
  6. 16
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/RoleMapper.java
  7. 16
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/RoleModuleMapper.java
  8. 5
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserMapper.java
  9. 15
    0
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserRoleMapper.java
  10. 78
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TClassStudent.java
  11. 59
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TClassTeacher.java
  12. 52
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TGroup.java
  13. 33
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TGroupStudent.java
  14. 42
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TRole.java
  15. 30
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TRoleModule.java
  16. 35
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TUserModule.java
  17. 32
    0
      sapi/src/main/java/com/xhkjedu/sapi/model/system/TUserRole.java
  18. 28
    26
      sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolService.java
  19. 36
    0
      sapi/src/main/resources/mapper/gradeclass/ClassMapper.xml
  20. 8
    0
      sapi/src/main/resources/mapper/system/UserMapper.xml

+ 26
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/ClassMapper.java View File

@@ -2,7 +2,10 @@ package com.xhkjedu.sapi.mapper.gradeclass;
2 2
 
3 3
 
4 4
 import com.xhkjedu.sapi.base.TkMapper;
5
-import com.xhkjedu.sapi.model.gradeclass.TClass;
5
+import com.xhkjedu.sapi.model.gradeclass.*;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
6 9
 
7 10
 public interface ClassMapper extends TkMapper<TClass> {
8 11
     //获取班级当前年份
@@ -10,4 +13,26 @@ public interface ClassMapper extends TkMapper<TClass> {
10 13
 
11 14
     //根据班级名称获取班级id
12 15
     Integer getClassIdByName(String classname, Integer schoolid, Integer gradeid, Integer year);
16
+
17
+    //修改班级状态
18
+    void updateClassState(@Param("classstate") Integer classstate, @Param("classids") String classids);
19
+
20
+
21
+    //要升级的班级列表
22
+    List<TClass> listClassBySchoolId(@Param("schoolid") Integer schoolid, @Param("year") Integer year);
23
+    //升级时要毕业的班级列表
24
+    List<TClass> listClassBiyeBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year,@Param("classstate") Integer classstate);
25
+
26
+    //要升级的班级id字符串
27
+    String listClassIdBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year);
28
+
29
+    //获取要升级的学生列表
30
+    List<TClassStudent> listStudentByClassIds(@Param("classIds") String classIds);
31
+    //要升级的教师列表
32
+    List<TClassTeacher> listTeacherByClassIds(@Param("classIds") String classIds);
33
+    //要升级的全体分组列表
34
+    List<TGroup> listGroupByClassIds(@Param("classIds") String classIds);
35
+    //获取要升级的学生列表
36
+    List<TGroupStudent> listStudentByGroupIds(@Param("groupIds") String groupIds);
37
+
13 38
 }

+ 13
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/ClassStudentMapper.java View File

@@ -0,0 +1,13 @@
1
+package com.xhkjedu.sapi.mapper.gradeclass;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.gradeclass.TClassStudent;
5
+
6
+/**
7
+ * @ClassName ClassStudentMapper
8
+ * Description TODO
9
+ * Author WN
10
+ * Date 2022/2/22 15:13
11
+ **/
12
+public interface ClassStudentMapper extends TkMapper<TClassStudent> {
13
+}

+ 13
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/ClassTeacherMapper.java View File

@@ -0,0 +1,13 @@
1
+package com.xhkjedu.sapi.mapper.gradeclass;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.gradeclass.TClassTeacher;
5
+
6
+/**
7
+ * @ClassName ClassTeacherMapper
8
+ * Description 班级老师
9
+ * Author WN
10
+ * Date 2022/2/22 15:14
11
+ **/
12
+public interface ClassTeacherMapper extends TkMapper<TClassTeacher> {
13
+}

+ 13
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/GroupMapper.java View File

@@ -0,0 +1,13 @@
1
+package com.xhkjedu.sapi.mapper.gradeclass;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.gradeclass.TGroup;
5
+
6
+/**
7
+ * @ClassName GroupMapper
8
+ * Description 班级分组
9
+ * Author WN
10
+ * Date 2022/2/22 15:12
11
+ **/
12
+public interface GroupMapper extends TkMapper<TGroup> {
13
+}

+ 13
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/gradeclass/GroupStudentMapper.java View File

@@ -0,0 +1,13 @@
1
+package com.xhkjedu.sapi.mapper.gradeclass;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.gradeclass.TGroupStudent;
5
+
6
+/**
7
+ * @ClassName GroupStudentMapper
8
+ * Description TODO
9
+ * Author WN
10
+ * Date 2022/2/22 15:14
11
+ **/
12
+public interface GroupStudentMapper extends TkMapper<TGroupStudent> {
13
+}

+ 16
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/RoleMapper.java View File

@@ -0,0 +1,16 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TRole;
5
+import org.springframework.stereotype.Repository;
6
+
7
+/**
8
+ * @ClassName RoleMapper
9
+ * Description 角色、角色模块、角色用户
10
+ * Author WN
11
+ * Date 2022/2/22 14:47
12
+ **/
13
+@Repository
14
+public interface RoleMapper extends TkMapper<TRole> {
15
+
16
+}

+ 16
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/RoleModuleMapper.java View File

@@ -0,0 +1,16 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TRoleModule;
5
+import org.springframework.stereotype.Repository;
6
+
7
+/**
8
+ * @ClassName RoleModuleMapper
9
+ * Description 角色模块
10
+ * Author WN
11
+ * Date 2022/2/22 14:51
12
+ **/
13
+@Repository
14
+public interface RoleModuleMapper extends TkMapper<TRoleModule> {
15
+
16
+}

+ 5
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserMapper.java View File

@@ -1,6 +1,7 @@
1 1
 package com.xhkjedu.sapi.mapper.system;
2 2
 
3 3
 import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.gradeclass.TClassStudent;
4 5
 import com.xhkjedu.sapi.model.system.TUser;
5 6
 import com.xhkjedu.sapi.vo.system.UserVo;
6 7
 import org.apache.ibatis.annotations.Param;
@@ -30,4 +31,8 @@ public interface UserMapper extends TkMapper<TUser> {
30 31
 
31 32
     //获取学校管理员
32 33
     UserVo getSchoolAdminBySchoolid(@Param("schoolid")Integer schoolid);
34
+
35
+    //批量修改学生状态
36
+    void batchUpdateState(@Param("users")List<TClassStudent> users, @Param("userstate")Integer userstate);
37
+
33 38
 }

+ 15
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserRoleMapper.java View File

@@ -0,0 +1,15 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TUserRole;
5
+import org.springframework.stereotype.Repository;
6
+
7
+/**
8
+ * @ClassName UserRoleMapper
9
+ * Description 用户角色
10
+ * Author WN
11
+ * Date 2022/2/22 14:52
12
+ **/
13
+@Repository
14
+public interface UserRoleMapper extends TkMapper<TUserRole> {
15
+}

+ 78
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TClassStudent.java View File

@@ -0,0 +1,78 @@
1
+package com.xhkjedu.sapi.model.gradeclass;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_class_student")
11
+@Data
12
+public class TClassStudent extends BaseBean {
13
+    //班级关联学生id
14
+    @Id
15
+    private Integer csid;
16
+
17
+    //班级id
18
+    private Integer classid;
19
+
20
+    //学生id
21
+    private Integer studentid;
22
+
23
+    //创建人
24
+    private Integer createid;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    //学校id
30
+    private Integer schoolid;
31
+
32
+    //学号
33
+    @Transient
34
+    private String studentno;
35
+
36
+    //学生姓名
37
+    @Transient
38
+    private String studentname;
39
+
40
+    //性别1男2女
41
+    @Transient
42
+    private Integer usersex;
43
+
44
+    //全体分组id
45
+    @Transient
46
+    private Integer groupid;
47
+
48
+    //原班级id
49
+    @Transient
50
+    private Integer oldclassid;
51
+
52
+    //排序字段:学生姓名studentname 学号studentno 创建时间createtime
53
+    @Transient
54
+    private String fieldname;
55
+
56
+    //排序规则:正序asc 倒序desc
57
+    @Transient
58
+    private String fieldorder;
59
+
60
+    @Transient
61
+    //用户状态1正常2删除
62
+    private Integer userstate;
63
+
64
+    @Transient
65
+    //用户手机号
66
+    private String userphone;
67
+
68
+    @Transient
69
+    private Integer classtype;//班级类型1行政班2提高班3直播班99已直播班
70
+
71
+    @Transient
72
+    //当前年份
73
+    private Integer year;
74
+
75
+    @Transient
76
+    //有效期
77
+    private String usertime;
78
+}

+ 59
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TClassTeacher.java View File

@@ -0,0 +1,59 @@
1
+package com.xhkjedu.sapi.model.gradeclass;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_class_teacher")
11
+@Data
12
+public class TClassTeacher extends BaseBean {
13
+    //班级教师表
14
+    @Id
15
+    private Integer ctid;
16
+
17
+    //班级id
18
+    private Integer classid;
19
+
20
+    //教师id
21
+    private Integer teacherid;
22
+
23
+    //创建人id
24
+    private Integer createid;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    //学校id
30
+    private Integer schoolid;
31
+
32
+    //教师姓名
33
+    @Transient
34
+    private String teachername;
35
+
36
+    //手机号
37
+    @Transient
38
+    private String userphone;
39
+
40
+    //排序字段:姓名teachername 登录账号loginname 创建时间createtime
41
+    @Transient
42
+    private String fieldname;
43
+
44
+    //排序规则:正序asc 倒序desc
45
+    @Transient
46
+    private String fieldorder;
47
+
48
+    @Transient
49
+    //所属年级
50
+    private Integer gradeid;
51
+
52
+    @Transient
53
+    //科目id
54
+    private String subjectid;
55
+
56
+    @Transient
57
+    //当前年份
58
+    private Integer year;
59
+}

+ 52
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TGroup.java View File

@@ -0,0 +1,52 @@
1
+package com.xhkjedu.sapi.model.gradeclass;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+import java.util.Map;
12
+
13
+@Table(name = "t_group")
14
+@Data
15
+public class TGroup extends BaseBean {
16
+    //班级分组id
17
+    @Id
18
+    private Integer groupid;
19
+
20
+    //分组名称
21
+    private String groupname;
22
+
23
+    //班级id
24
+    private Integer classid;
25
+
26
+    //班级分组类型1全体2一般分组
27
+    private Integer grouptype;
28
+
29
+    //分组人数
30
+    private Integer groupnum;
31
+
32
+    //创建人id
33
+    private Integer createid;
34
+
35
+    //创建时间
36
+    private Integer createtime;
37
+
38
+    //学校id
39
+    private Integer schoolid;
40
+
41
+    //当前年份
42
+    @Transient
43
+    private Integer year;
44
+
45
+    //资源id
46
+    @Transient
47
+    private String resourceid;
48
+
49
+    //分组下学生
50
+    @Transient
51
+    private List<Map> students = new ArrayList<>();
52
+}

+ 33
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/gradeclass/TGroupStudent.java View File

@@ -0,0 +1,33 @@
1
+package com.xhkjedu.sapi.model.gradeclass;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_group_student")
10
+@Data
11
+public class TGroupStudent extends BaseBean {
12
+    //分组学生表
13
+    @Id
14
+    private Integer gsid;
15
+
16
+    //班级id
17
+    private Integer classid;
18
+
19
+    //分组id
20
+    private Integer groupid;
21
+
22
+    //学生id
23
+    private Integer studentid;
24
+
25
+    //创建人id
26
+    private Integer createid;
27
+
28
+    //创建时间
29
+    private Integer createtime;
30
+
31
+    //学校id
32
+    private Integer schoolid;
33
+}

+ 42
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TRole.java View File

@@ -0,0 +1,42 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+import java.util.ArrayList;
10
+import java.util.List;
11
+import java.util.Map;
12
+
13
+@Table(name = "t_role")
14
+@Data
15
+public class TRole extends BaseBean {
16
+    //角色表
17
+    @Id
18
+    private Integer roleid;
19
+
20
+    //角色名称
21
+    private String rolename;
22
+
23
+    //角色备注
24
+    private String comm;
25
+
26
+    //创建人id
27
+    private Integer createid;
28
+
29
+    //创建时间
30
+    private Integer createtime;
31
+
32
+    //学校id
33
+    private Integer schoolid;
34
+
35
+    //用户数量
36
+    @Transient
37
+    private Integer usernum;
38
+
39
+    //选择模块
40
+    @Transient
41
+    private List<Map> modules = new ArrayList<>();
42
+}

+ 30
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TRoleModule.java View File

@@ -0,0 +1,30 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+
9
+@Table(name = "t_role_module")
10
+@Data
11
+public class TRoleModule extends BaseBean {
12
+    //角色模块表
13
+    @Id
14
+    private Integer rmid;
15
+
16
+    //角色id
17
+    private Integer roleid;
18
+
19
+    //模块表id
20
+    private String moduleid;
21
+
22
+    //创建人id
23
+    private Integer createid;
24
+
25
+    //创建时间
26
+    private Integer createtime;
27
+
28
+    //学校id
29
+    private Integer schoolid;
30
+}

+ 35
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TUserModule.java View File

@@ -0,0 +1,35 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+
11
+@Table(name = "t_user_module")
12
+@Data
13
+public class TUserModule extends BaseBean {
14
+    //用户常用模块表
15
+    @Id
16
+    private Integer umid;
17
+
18
+    //用户id
19
+    private Integer userid;
20
+
21
+    //模块id
22
+    private String moduleid;
23
+
24
+    //排序
25
+    private Integer umorder;
26
+
27
+    //创建时间
28
+    private Integer createtime;
29
+
30
+    //学校id
31
+    private Integer schoolid;
32
+
33
+    //批量保存用户常用模块
34
+    private List<String> moduleids = new ArrayList<>();
35
+}

+ 32
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TUserRole.java View File

@@ -0,0 +1,32 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_user_role")
11
+@Data
12
+public class TUserRole extends BaseBean {
13
+    //用户角色表
14
+    @Id
15
+    private Integer urid;
16
+
17
+    //用户id
18
+    private Integer userid;
19
+
20
+    //角色id
21
+    private Integer roleid;
22
+
23
+    //创建人id
24
+    private Integer createid;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    //用户姓名
30
+    @Transient
31
+    private String username;
32
+}

+ 28
- 26
sapi/src/main/java/com/xhkjedu/sapi/service/system/SchoolService.java View File

@@ -1,7 +1,9 @@
1 1
 package com.xhkjedu.sapi.service.system;
2 2
 
3
-import com.xhkjedu.sapi.mapper.system.SchoolMapper;
4
-import com.xhkjedu.sapi.model.system.TSchool;
3
+import com.xhkjedu.sapi.mapper.gradeclass.*;
4
+import com.xhkjedu.sapi.mapper.system.*;
5
+import com.xhkjedu.sapi.model.gradeclass.*;
6
+import com.xhkjedu.sapi.model.system.*;
5 7
 import com.xhkjedu.utils.MD5;
6 8
 import com.xhkjedu.utils.N_Utils;
7 9
 import lombok.extern.slf4j.Slf4j;
@@ -31,7 +33,7 @@ public class SchoolService {
31 33
     private ModuledefaultService moduledefaultService;
32 34
     @Resource
33 35
     private ModuleService moduleService;
34
-   /* @Resource
36
+    @Resource
35 37
     private ClassMapper classMapper;
36 38
     @Resource
37 39
     private ClassStudentMapper classStudentMapper;
@@ -48,7 +50,7 @@ public class SchoolService {
48 50
     @Autowired
49 51
     private RoleModuleMapper roleModuleMapper;
50 52
     @Autowired
51
-    private UserRoleMapper userRoleMapper;*/
53
+    private UserRoleMapper userRoleMapper;
52 54
 
53 55
     //添加
54 56
     @Transactional(rollbackFor = Exception.class)
@@ -61,7 +63,7 @@ public class SchoolService {
61 63
             schoolMapper.insertUseGeneratedKeys(model);
62 64
             schoolid = model.getId();
63 65
 
64
-           /* //添加管理员信息
66
+            //添加管理员信息
65 67
             Integer userid = saveUser(model, schoolid);
66 68
 
67 69
             //添加角色信息
@@ -78,7 +80,7 @@ public class SchoolService {
78 80
             }
79 81
 
80 82
             //添加角色模块
81
-            roleModuleMapper.insertList(roleModules);*/
83
+            roleModuleMapper.insertList(roleModules);
82 84
         } catch (DuplicateKeyException e) {
83 85
             log.error("添加学校失败",e.getMessage());
84 86
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -99,7 +101,7 @@ public class SchoolService {
99 101
      * @Date 2020/7/2 11:52
100 102
      * @return java.lang.Integer
101 103
      **/
102
-   /* private Integer saveUserRole(Integer userid, Integer roleid) {
104
+    private Integer saveUserRole(Integer userid, Integer roleid) {
103 105
         TUserRole userRole = new TUserRole();
104 106
         userRole.setUserid(userid);
105 107
         userRole.setRoleid(roleid);
@@ -107,7 +109,7 @@ public class SchoolService {
107 109
         userRole.setCreatetime(N_Utils.getSecondTimestamp());
108 110
         userRoleMapper.insertUseGeneratedKeys(userRole);
109 111
         return userRole.getId();
110
-    }*/
112
+    }
111 113
 
112 114
     /**
113 115
      * 添加角色信息
@@ -116,7 +118,7 @@ public class SchoolService {
116 118
      * @Date 2020/7/2 11:51
117 119
      * @return java.lang.Integer
118 120
      **/
119
-   /* private Integer saveRole(Integer schoolid, Integer userid) {
121
+    private Integer saveRole(Integer schoolid, Integer userid) {
120 122
         TRole role = new TRole();
121 123
         role.setRolename("管理员");
122 124
         role.setComm("拥有高权限");
@@ -125,7 +127,7 @@ public class SchoolService {
125 127
         role.setSchoolid(schoolid);
126 128
         roleMapper.insertUseGeneratedKeys(role);
127 129
         return role.getId();
128
-    }*/
130
+    }
129 131
 
130 132
     /**
131 133
      * 添加管理员信息
@@ -134,7 +136,7 @@ public class SchoolService {
134 136
      * @Date 2020/7/2 11:49
135 137
      * @return java.lang.Integer
136 138
      **/
137
-   /* private Integer saveUser(TSchool model, Integer schoolid) {
139
+    private Integer saveUser(TSchool model, Integer schoolid) {
138 140
         TUser user = new TUser();
139 141
         user.setLoginname(model.getLoginname());
140 142
         user.setUsername("管理员");
@@ -149,7 +151,7 @@ public class SchoolService {
149 151
         user.setSchoolid(schoolid);
150 152
         userMapper.insertUseGeneratedKeys(user);
151 153
         return user.getId();
152
-    }*/
154
+    }
153 155
 
154 156
     /**
155 157
      * 保存子模块信息并设置角色模块信息
@@ -158,7 +160,7 @@ public class SchoolService {
158 160
      * @Date 2020/7/2 11:47
159 161
      * @return void
160 162
      **/
161
-   /* private void saveModuleSetRoleModule(Integer schoolid, Integer userid, Integer roleid, List<TRoleModule> roleModules, TModule module) {
163
+    private void saveModuleSetRoleModule(Integer schoolid, Integer userid, Integer roleid, List<TRoleModule> roleModules, TModule module) {
162 164
         module.setCreateid(userid);
163 165
         module.setCreatetime(N_Utils.getSecondTimestamp());
164 166
         module.setSchoolid(schoolid);
@@ -177,7 +179,7 @@ public class SchoolService {
177 179
             roleModule.setSchoolid(schoolid);
178 180
             roleModules.add(roleModule);
179 181
         }
180
-    }*/
182
+    }
181 183
 
182 184
     /**
183 185
      * 保存子模块信息
@@ -186,7 +188,7 @@ public class SchoolService {
186 188
      * @Date 2020/7/2 11:46
187 189
      * @return void
188 190
      **/
189
-   /* private void saveModuleChild(Integer schoolid, Integer userid, TModule module, List<TRoleModule> roleModules, Integer roleid) {
191
+    private void saveModuleChild(Integer schoolid, Integer userid, TModule module, List<TRoleModule> roleModules, Integer roleid) {
190 192
         String moduleid = module.getModuleid();
191 193
         List<TModule> modulechilds = module.getModulechilds();
192 194
         if (N_Utils.isListNotEmpty(modulechilds)) {
@@ -195,7 +197,7 @@ public class SchoolService {
195 197
                 saveModuleSetRoleModule(schoolid, userid, roleid, roleModules, modulechild);
196 198
             }
197 199
         }
198
-    }*/
200
+    }
199 201
 
200 202
     //删除
201 203
     public Integer deleteById(Integer schoolid) {
@@ -229,17 +231,17 @@ public class SchoolService {
229 231
     @Transactional(rollbackFor = Exception.class)
230 232
     public void upgrade(Integer schoolid, Integer year) throws Exception {
231 233
         try {
232
-           /* List<TClass> classes = classMapper.listClassBySchoolId(schoolid, year);//要升级的班级列表
234
+            List<TClass> classes = classMapper.listClassBySchoolId(schoolid, year);//要升级的班级列表
233 235
             if (N_Utils.isListNotEmpty(classes)){
234 236
                 String classIds = classMapper.listClassIdBySchoolId(schoolid, year);
235
-                List<TClassStudent> cStudents = classStudentMapper.listStudentByClassIds(classIds);//要升级的学生列表
236
-                List<TClassTeacher> cTeachers = classTeacherMapper.listTeacherByClassIds(classIds);//要升级的教师列表
237
+                List<TClassStudent> cStudents = classMapper.listStudentByClassIds(classIds);//要升级的学生列表
238
+                List<TClassTeacher> cTeachers = classMapper.listTeacherByClassIds(classIds);//要升级的教师列表
237 239
 
238
-                List<TGroup> groups = groupMapper.listStudentByClassIds(classIds);//要升级的全体分组列表
240
+                List<TGroup> groups = classMapper.listGroupByClassIds(classIds);//要升级的全体分组列表
239 241
                 StringBuilder sb = new StringBuilder();
240 242
                 groups.forEach(g->{sb.append(g.getGroupid()).append(",");});
241 243
                 String groupIds = sb.toString().substring(0,sb.toString().length()-1);
242
-                List<TGroupStudent> gStudents = groupStudentMapper.listStudentByGroupIds(groupIds);//要升级的学生列表
244
+                List<TGroupStudent> gStudents = classMapper.listStudentByGroupIds(groupIds);//要升级的学生列表
243 245
 
244 246
                 List<TClassStudent> classStudents = new ArrayList<>();//升级后的班级学生
245 247
                 List<TClassTeacher> classTeachers = new ArrayList<>();//升级后的班级教师
@@ -326,7 +328,7 @@ public class SchoolService {
326 328
                     }
327 329
                 }
328 330
 
329
-                List<TClassStudent> bystudents = classStudentMapper.listStudentByClassIds(byclassIds);//要毕业的学生列表
331
+                List<TClassStudent> bystudents = classMapper.listStudentByClassIds(byclassIds);//要毕业的学生列表
330 332
 
331 333
                 if (N_Utils.isNotEmpty(byclassIds)) {
332 334
                     classMapper.updateClassState(3, byclassIds);//修改班级状态
@@ -334,7 +336,7 @@ public class SchoolService {
334 336
                 if (N_Utils.isListNotEmpty(bystudents)) {
335 337
                     userMapper.batchUpdateState(bystudents, 3);   //修改学生状态为已毕业状态
336 338
                 }
337
-            }*/
339
+            }
338 340
 
339 341
             schoolMapper.upgrade(schoolid);//学校年份升级
340 342
         }catch (Exception e){
@@ -355,7 +357,7 @@ public class SchoolService {
355 357
 
356 358
         schoolMapper.downgrade(schoolid, year);
357 359
         //之前已毕业的班级进行恢复
358
-        /*List<TClass> biyeclass = classMapper.listClassBiyeBySchoolId(schoolid,year,3);
360
+        List<TClass> biyeclass = classMapper.listClassBiyeBySchoolId(schoolid,year,3);
359 361
 
360 362
         if(N_Utils.isListNotEmpty(biyeclass)){
361 363
             String byclassIds = "";
@@ -368,11 +370,11 @@ public class SchoolService {
368 370
                 }
369 371
             }
370 372
 
371
-            List<TClassStudent> bystudents = classStudentMapper.listStudentByClassIds(byclassIds);//要毕业的学生列表
373
+            List<TClassStudent> bystudents = classMapper.listStudentByClassIds(byclassIds);//要毕业的学生列表
372 374
 
373 375
             classMapper.updateClassState(1,byclassIds);//修改班级状态
374 376
             userMapper.batchUpdateState(bystudents,1);   //修改学生状态
375
-        }*/
377
+        }
376 378
     }
377 379
 
378 380
     /**

+ 36
- 0
sapi/src/main/resources/mapper/gradeclass/ClassMapper.xml View File

@@ -10,4 +10,40 @@
10 10
         select c.classid from t_class c where c.schoolid=#{schoolid} and c.gradeid=#{gradeid} and c.classtype=1 and
11 11
         c.classstate=1 and c.classname=#{classname} and c.year=#{year}
12 12
     </select>
13
+
14
+    <!--修改班级状态-->
15
+    <update id="updateClassState">
16
+       update t_class set classstate=#{classstate} where classid in (${classids})
17
+    </update>
18
+
19
+    <!--要升级的班级列表-->
20
+    <select id="listClassBySchoolId" resultType="com.xhkjedu.sapi.model.gradeclass.TClass">
21
+        select * from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=1 and gradeid in(1,2,3,4,5,7,8,10,11)
22
+    </select>
23
+    <!--升级时要毕业的班级列表-->
24
+    <select id="listClassBiyeBySchoolId" resultType="com.xhkjedu.sapi.model.gradeclass.TClass">
25
+        select * from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=#{classstate} and gradeid in(6,9,12)
26
+    </select>
27
+    <!--要升级的班级id字符串-->
28
+    <select id="listClassIdBySchoolId" resultType="java.lang.String">
29
+        select group_concat(classid) from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=1 and gradeid in(1,2,3,4,5,7,8,10,11)
30
+    </select>
31
+
32
+    <!--获取要升级的学生列表-->
33
+    <select id="listStudentByClassIds" resultType="com.xhkjedu.sapi.model.gradeclass.TClassStudent">
34
+        select * from t_class_student where classid in(${classIds}) order by classid;
35
+    </select>
36
+    <!--要升级的教师列表-->
37
+    <select id="listTeacherByClassIds" resultType="com.xhkjedu.sapi.model.gradeclass.TClassTeacher">
38
+        select * from t_class_teacher where classid in(${classIds}) order by classid;
39
+    </select>
40
+    <!--要升级的全体分组列表-->
41
+    <select id="listGroupByClassIds" resultType="com.xhkjedu.sapi.model.gradeclass.TGroup">
42
+        select g.* from t_group g where g.classid in(${classIds}) and g.grouptype=1 order by classid
43
+    </select>
44
+    <!--获取要升级的学生列表-->
45
+    <select id="listStudentByGroupIds" resultType="com.xhkjedu.sapi.model.gradeclass.TGroupStudent">
46
+        select * from t_group_student where groupid in(${groupIds}) order by groupid;
47
+    </select>
48
+
13 49
 </mapper>

+ 8
- 0
sapi/src/main/resources/mapper/system/UserMapper.xml View File

@@ -22,6 +22,14 @@
22 22
         select usertype from t_user where userid=#{userid}
23 23
     </select>
24 24
 
25
+    <!--批量修改用户状态-->
26
+    <update id="batchUpdateState">
27
+        update t_user set userstate=#{userstate} where
28
+        <foreach collection="users" item="user" index="index" separator="or">
29
+            userid=${user.studentid}
30
+        </foreach>
31
+    </update>
32
+
25 33
 
26 34
     <!--获取学校管理员-->
27 35
     <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.sapi.vo.system.UserVo">

Loading…
Cancel
Save