Browse Source

用户模块

tags/正式3.2.0
雍文秀 2 years ago
parent
commit
3a966c5571
36 changed files with 384 additions and 629 deletions
  1. 5
    6
      suser/src/main/java/com/xhkjedu/suser/controller/system/TeacherRoleController.java
  2. 0
    23
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassMapper.java
  3. 0
    11
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassStudentMapper.java
  4. 0
    15
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassTeacherMapper.java
  5. 0
    5
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupMapper.java
  6. 0
    3
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupStudentMapper.java
  7. 3
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/SchoolMapper.java
  8. 14
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/liveplay/CourseMapper.java
  9. 56
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/subjectbook/TeacherPowersbMapper.java
  10. 15
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/subjectbook/TeacherSubjectbookMapper.java
  11. 24
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/MsgMapper.java
  12. 9
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/UserLogMapper.java
  13. 0
    34
      suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java
  14. 22
    0
      suser/src/main/java/com/xhkjedu/suser/mapper/system/UserModuleMapper.java
  15. 5
    131
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassService.java
  16. 21
    28
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassStudentService.java
  17. 12
    16
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassTeacherService.java
  18. 7
    8
      suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GroupService.java
  19. 49
    49
      suser/src/main/java/com/xhkjedu/suser/service/system/TeacherRoleService.java
  20. 44
    78
      suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java
  21. 0
    26
      suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/LsbBookVo.java
  22. 0
    22
      suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/SubjectVo.java
  23. 0
    40
      suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/TeacherSubjectbookVo.java
  24. 2
    2
      suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherRoleVo.java
  25. 0
    36
      suser/src/main/resources/mapper/gradeclass/ClassMapper.xml
  26. 0
    25
      suser/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml
  27. 0
    16
      suser/src/main/resources/mapper/gradeclass/ClassTeacherMapper.xml
  28. 0
    8
      suser/src/main/resources/mapper/gradeclass/GroupMapper.xml
  29. 0
    4
      suser/src/main/resources/mapper/gradeclass/GroupStudentMapper.xml
  30. 4
    0
      suser/src/main/resources/mapper/gradeclass/SchoolMapper.xml
  31. 16
    0
      suser/src/main/resources/mapper/liveplay/CourseMapper.xml
  32. 33
    0
      suser/src/main/resources/mapper/subjectbook/TeacherPowersbMapper.xml
  33. 17
    0
      suser/src/main/resources/mapper/subjectbook/TeacherSubjectBookMapper.xml
  34. 13
    0
      suser/src/main/resources/mapper/system/MsgMapper.xml
  35. 2
    43
      suser/src/main/resources/mapper/system/UserMapper.xml
  36. 11
    0
      suser/src/main/resources/mapper/system/UserModuleMapper.xml

+ 5
- 6
suser/src/main/java/com/xhkjedu/suser/controller/system/TeacherRoleController.java View File

@@ -1,13 +1,11 @@
1 1
 package com.xhkjedu.suser.controller.system;
2 2
 
3 3
 import com.xhkjedu.suser.service.system.TeacherRoleService;
4
-import com.xhkjedu.utils.N_Utils;
5
-import com.xhkjedu.vo.ResultVo;
6 4
 import com.xhkjedu.suser.vo.gradeclass.GradeVo;
7
-import com.xhkjedu.suser.vo.subjectbook.LsbBookVo;
8
-import com.xhkjedu.suser.vo.subjectbook.SubjectVo;
9 5
 import com.xhkjedu.suser.vo.system.TeacherRoleParam;
10 6
 import com.xhkjedu.suser.vo.system.TeacherRoleVo;
7
+import com.xhkjedu.utils.N_Utils;
8
+import com.xhkjedu.vo.ResultVo;
11 9
 import org.springframework.beans.factory.annotation.Autowired;
12 10
 import org.springframework.web.bind.annotation.PostMapping;
13 11
 import org.springframework.web.bind.annotation.RequestBody;
@@ -15,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
15 13
 import org.springframework.web.bind.annotation.RestController;
16 14
 
17 15
 import java.util.List;
16
+import java.util.Map;
18 17
 
19 18
 /**
20 19
  * @ClassName TeacherRoleController
@@ -91,7 +90,7 @@ public class TeacherRoleController {
91 90
     public ResultVo listSubject(@RequestBody TeacherRoleParam trole){
92 91
         Integer teacherid = trole.getTeacherid();
93 92
         N_Utils.validation(new Object[]{teacherid,"教师id",1});
94
-        List<SubjectVo> subject = teacherRoleService.listSubject(teacherid);
93
+        List<Map> subject = teacherRoleService.listSubject(teacherid);
95 94
         return new ResultVo(0,"获取教师权限科目列表成功",subject);
96 95
     }
97 96
 
@@ -107,7 +106,7 @@ public class TeacherRoleController {
107 106
         Integer teacherid = trole.getTeacherid();
108 107
         String subjectid = trole.getSubjectid();
109 108
         N_Utils.validation(new Object[]{teacherid,"教师id",1,subjectid,"科目id",2});
110
-        List<LsbBookVo> subject = teacherRoleService.listBookBySubjectid(teacherid,subjectid);
109
+        List<Map> subject = teacherRoleService.listBookBySubjectid(teacherid, subjectid);
111 110
         return new ResultVo(0,"获取科目下权限教材列表成功",subject);
112 111
     }
113 112
 

+ 0
- 23
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassMapper.java View File

@@ -17,38 +17,15 @@ public interface ClassMapper extends TkMapper<TClass> {
17 17
     //更新班级、分组学生数量
18 18
     void updateNum2(@Param("classid") Integer classid);
19 19
 
20
-    //要升级的班级列表
21
-    List<TClass> listClassBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year);
22
-    //升级时要毕业的班级列表
23
-    List<TClass> listClassBiyeBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year,@Param("classstate") Integer classstate);
24
-
25
-    //要升级的班级id字符串
26
-    String listClassIdBySchoolId(@Param("schoolid") Integer schoolid,@Param("year") Integer year);
27
-
28 20
     //基本信息
29 21
     ClassVo getById(Integer classid);
30 22
 
31
-    //年级下班级id集合
32
-    List<Integer> listClassidsByGradeid(@Param("gradeid") Integer gradeid,@Param("schoolid") Integer schoolid);
33
-
34 23
     //根据班级名称获取班级信息
35 24
     TClass getByName(@Param("tClass") TClass tClass);
36 25
 
37 26
     //获取任教老师列表
38 27
     List<String> listTeacher(@Param("classid") Integer classid);
39 28
 
40
-    //修改班级状态
41
-    void updateClassState(@Param("classstate") Integer classstate, @Param("classids") String classids);
42
-
43 29
     //修改单个班级状态
44 30
     Integer updateClassstateByClassid(@Param("classid") Integer classid, @Param("classstate") Integer classstate);
45
-
46
-    //修改的那个班级类型
47
-    Integer updateClasstype(@Param("classid") Integer classid, @Param("classtype") Integer classtype);
48
-
49
-    //获取班级当前年份
50
-    Integer getYearById(Integer classid);
51
-
52
-    //根据班级名称获取班级id
53
-    Integer getClassIdByName(String classname, Integer schoolid, Integer gradeid, Integer year);
54 31
 }

+ 0
- 11
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassStudentMapper.java View File

@@ -5,8 +5,6 @@ import com.xhkjedu.suser.model.gradeclass.TClassStudent;
5 5
 import com.xhkjedu.suser.vo.gradeclass.ClassStudentVo;
6 6
 import com.xhkjedu.suser.vo.gradeclass.ClassVo;
7 7
 import com.xhkjedu.suser.vo.gradeclass.ImportStudentVo;
8
-import com.xhkjedu.suser.vo.paper.AStudentPaperVo;
9
-import com.xhkjedu.suser.vo.paper.AnalyzeSearchVo;
10 8
 import org.apache.ibatis.annotations.Param;
11 9
 
12 10
 import java.util.List;
@@ -24,9 +22,6 @@ public interface ClassStudentMapper extends TkMapper<TClassStudent> {
24 22
     //获取学生行政班id
25 23
     Integer getClassIdByStuId(@Param("studentid") Integer studentid);
26 24
 
27
-    //获取要升级的学生列表
28
-    List<TClassStudent> listStudentByClassIds(@Param("classIds") String classIds);
29
-
30 25
     /**
31 26
      * 根据班级id和学生id获取班级学生信息
32 27
      * @Param [classid, studentid]
@@ -52,12 +47,6 @@ public interface ClassStudentMapper extends TkMapper<TClassStudent> {
52 47
     //添加
53 48
     void save(@Param("student") TClassStudent student);
54 49
 
55
-    //学生所在行政班
56
-    ClassVo getClassByStuId(@Param("studentid") Integer studentid);
57
-
58
-    //作业/预习统计--学生列表
59
-    List<AStudentPaperVo> listStu(@Param("paper") AnalyzeSearchVo paper);
60
-
61 50
     //获取学生所有提高班
62 51
     List<Integer> listTgClassid(Integer studentid);
63 52
 }

+ 0
- 15
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/ClassTeacherMapper.java View File

@@ -31,15 +31,6 @@ public interface ClassTeacherMapper extends TkMapper<TClassTeacher> {
31 31
     //当前年份教师任教班级
32 32
     List<ClassVo> listTeacherClass2(@Param("teacherid") Integer teacherid,@Param("year") Integer year);
33 33
 
34
-    /**
35
-     * 要升级的教师列表
36
-     * @Param [classIds]
37
-     * @Author ywx
38
-     * @Date 2020/6/16 14:04
39
-     * @return java.util.List<com.xhkjedu.model.gradeclass.TClassTeacher>
40
-     **/
41
-    List<TClassTeacher> listTeacherByClassIds(@Param("classIds") String classIds);
42
-
43 34
     //删除教师任教班级
44 35
     void deleteByUserid(Integer userid,Integer year);
45 36
 
@@ -81,10 +72,4 @@ public interface ClassTeacherMapper extends TkMapper<TClassTeacher> {
81 72
     List<ClassTeacherVo> listTeahcersBySubjectGrade(@Param("ctp") ClassTeacherParams ctp);
82 73
 
83 74
     List<GradeVo> listGradeClassesByUserid2(@Param("role") TeacherRoleParam role);
84
-
85
-    //删除班级下所有教师
86
-    void deleteByClassId(Integer classid);
87
-
88
-    //获取教师任教行政和提高班id
89
-    String getClassIds(Integer teacherid);
90 75
 }

+ 0
- 5
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupMapper.java View File

@@ -18,9 +18,4 @@ public interface GroupMapper extends TkMapper<TGroup> {
18 18
 
19 19
     //教师分组列表
20 20
     List<ClassGroupVo> teacherList(@Param("teacherid") Integer teacherid,@Param("year") Integer year);
21
-
22
-    List<Integer> listStudentidsByGroupids(@Param("groupids") String groupids);
23
-
24
-    //要升级的全体分组列表
25
-    List<TGroup> listStudentByClassIds(@Param("classIds") String classIds);
26 21
 }

+ 0
- 3
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/GroupStudentMapper.java View File

@@ -11,9 +11,6 @@ public interface GroupStudentMapper extends TkMapper<TGroupStudent> {
11 11
     //列表
12 12
     List<GroupStudentVo> findAll(Integer groupid);
13 13
 
14
-    //获取要升级的学生列表
15
-    List<TGroupStudent> listStudentByGroupIds(@Param("groupIds") String groupIds);
16
-
17 14
     //删除分组学生
18 15
     Integer deleteByGroupId(Integer groupid);
19 16
 

+ 3
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/gradeclass/SchoolMapper.java View File

@@ -6,4 +6,7 @@ public interface SchoolMapper {
6 6
 
7 7
     //获取用户当前年份
8 8
     Integer getYearByUserId(Integer userid);
9
+
10
+    //获取学校账号数量
11
+    Integer getUserNumById(Integer schoolid);
9 12
 }

+ 14
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/liveplay/CourseMapper.java View File

@@ -0,0 +1,14 @@
1
+package com.xhkjedu.suser.mapper.liveplay;
2
+
3
+import org.apache.ibatis.annotations.Param;
4
+
5
+import java.util.List;
6
+import java.util.Map;
7
+
8
+public interface CourseMapper {
9
+    //更新已报学生数量
10
+    void updateStuNum(@Param("courseid") Integer courseid);
11
+
12
+    //行政班的所有直播课
13
+    List<Map> listXzCourse(Integer classid);
14
+}

+ 56
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/subjectbook/TeacherPowersbMapper.java View File

@@ -0,0 +1,56 @@
1
+package com.xhkjedu.suser.mapper.subjectbook;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.subjectbook.TTeacherPowersb;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.stereotype.Repository;
7
+
8
+import java.util.List;
9
+import java.util.Map;
10
+
11
+/**
12
+ * @ClassName TeacherPowersbMapper
13
+ * Description 教师教材权限
14
+ * Author WN
15
+ * Date 2020/7/1 19:05
16
+ **/
17
+@Repository
18
+public interface TeacherPowersbMapper extends TkMapper<TTeacherPowersb> {
19
+
20
+    /**
21
+     *功能描述  根据用户id删除教师权限教材
22
+     * @author WN
23
+     * @date 2020/7/1
24
+     * @param  * @param userid
25
+     * @return void
26
+     */
27
+    void deleteByUserid(@Param("userid")Integer userid);
28
+
29
+    /**
30
+     *功能描述  获取教师权限教材
31
+     * @author WN
32
+     * @date 2020/7/1
33
+     * @param  * @param userid
34
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.TeacherSubjectbookVo>
35
+     */
36
+    List<Map> listLsbsByUserid(@Param("userid")Integer userid);
37
+
38
+    /**
39
+     * 教师权限科目
40
+     * @Param [teacherid]
41
+     * @Author ywx
42
+     * @Date 2020/7/24 9:26
43
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.SubjectVo>
44
+     **/
45
+    List<Map> listSubject(@Param("teacherid") Integer teacherid);
46
+
47
+    /**
48
+     *功能描述 教师权限科目下,权限教材
49
+     * @author WN
50
+     * @date 2020/8/11
51
+     * @param  * @param teacherid
52
+     * @param subjectid
53
+     * @return java.util.List<com.xhkjedu.vo.subjectbook.LsbBookVo>
54
+     */
55
+    List<Map> listBookBySubjectid(@Param("teacherid") Integer teacherid, @Param("subjectid") String subjectid);
56
+}

+ 15
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/subjectbook/TeacherSubjectbookMapper.java View File

@@ -0,0 +1,15 @@
1
+package com.xhkjedu.suser.mapper.subjectbook;
2
+
3
+import org.apache.ibatis.annotations.Param;
4
+import org.springframework.stereotype.Repository;
5
+
6
+import java.util.List;
7
+
8
+@Repository
9
+public interface TeacherSubjectbookMapper {
10
+    //获取用户教材集合
11
+    List<String> listLsbsByUserid(Integer userid);
12
+
13
+    //删除教师收藏教材
14
+    Integer deleteByLsbIdTeacherId(@Param("lsbids") List<String> lsbids,@Param("teacherid") Integer teacherid);
15
+}

+ 24
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/MsgMapper.java View File

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.system.TMsg;
5
+
6
+public interface MsgMapper extends TkMapper<TMsg> {
7
+    /**
8
+     * 5分钟内发送短信次数
9
+     * @Param [userphone]
10
+     * @Author ywx
11
+     * @Date 2020/10/15 16:55
12
+     * @return java.lang.Integer
13
+     **/
14
+    Integer getMsgNumByUserPhone(String userphone);
15
+
16
+    /**
17
+     * 根据手机号和验证码获取短信信息
18
+     * @Param [userphone, msgcode]
19
+     * @Author ywx
20
+     * @Date 2020/10/15 17:04
21
+     * @return com.xhkjedu.model.system.TMsg
22
+     **/
23
+    TMsg findByUserPhoneAndCode(String userphone, Integer msgcode);
24
+}

+ 9
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserLogMapper.java View File

@@ -0,0 +1,9 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.system.TUserLog;
5
+import org.springframework.stereotype.Repository;
6
+
7
+@Repository
8
+public interface UserLogMapper extends TkMapper<TUserLog> {
9
+}

+ 0
- 34
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserMapper.java View File

@@ -1,9 +1,7 @@
1 1
 package com.xhkjedu.suser.mapper.system;
2 2
 
3 3
 import com.xhkjedu.suser.base.TkMapper;
4
-import com.xhkjedu.suser.model.gradeclass.TClassStudent;
5 4
 import com.xhkjedu.suser.model.system.TUser;
6
-import com.xhkjedu.suser.model.system.TUserLog;
7 5
 import com.xhkjedu.suser.vo.assess.AssessParams;
8 6
 import com.xhkjedu.suser.vo.system.TeacherVo;
9 7
 import com.xhkjedu.suser.vo.system.UserVo;
@@ -150,15 +148,6 @@ public interface UserMapper extends TkMapper<TUser> {
150 148
      **/
151 149
     UserVo getUserByLoginnameMac(String loginname, String mac);
152 150
 
153
-    /**
154
-     * 删除学生绑定信息
155
-     * @Param [schoolid]
156
-     * @Author ywx
157
-     * @Date 2020/9/24 11:42
158
-     * @return void
159
-     **/
160
-    void delBindmac(Integer schoolid);
161
-
162 151
     /**
163 152
      * 通过短信修改密码
164 153
      * @Param [user]
@@ -177,35 +166,12 @@ public interface UserMapper extends TkMapper<TUser> {
177 166
      **/
178 167
     void batchUpdatePwd(@Param("user") TUser user);
179 168
 
180
-    String getUserNameById(@Param("userid")Integer userid);
181
-
182
-    //批量修改学生状态
183
-    void batchUpdateState(@Param("users")List<TClassStudent> users,@Param("userstate")Integer userstate);
184
-
185
-    //获取学校管理员
186
-    UserVo getSchoolAdminBySchoolid(@Param("schoolid")Integer schoolid);
187
-
188 169
     //校验手机号
189 170
     boolean checkUserPhone(Integer userid);
190 171
 
191
-    //根据登录名获取学生id和行政和提高班班级id
192
-    TUser getObjByLoginName2(@Param("loginname") String loginname);
193
-
194 172
     //获取学校账号数量
195 173
     Integer getUserNumBySchoolId(Integer schoolid);
196 174
 
197 175
     //用户选择列表
198 176
     List<Map> listForSel(@Param("user") AssessParams user, @Param("year") Integer year);
199
-
200
-    //根据班级id用户名获取学生id和数量
201
-    Map getUserIdByName(Integer schoolid, Integer classid, String username);
202
-
203
-    //根据班级科目id用户名获取教师id和数量
204
-    Map getUserIdByName2(Integer schoolid, Integer classid, String username, String subjectid);
205
-
206
-    //根据用户id获取用户类型
207
-    Integer getUsertypeById(Integer userid);
208
-
209
-    //添加登录日志
210
-    void saveUserLog(@Param("log") TUserLog userLog);
211 177
 }

+ 22
- 0
suser/src/main/java/com/xhkjedu/suser/mapper/system/UserModuleMapper.java View File

@@ -0,0 +1,22 @@
1
+package com.xhkjedu.suser.mapper.system;
2
+
3
+import com.xhkjedu.suser.base.TkMapper;
4
+import com.xhkjedu.suser.model.system.TUserModule;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.springframework.stereotype.Repository;
7
+
8
+/**
9
+ * @ClassName UserModuleMapper
10
+ * Description 用户常用模块
11
+ * Author WN
12
+ * Date 2020/6/15 14:51
13
+ **/
14
+@Repository
15
+public interface UserModuleMapper extends TkMapper<TUserModule> {
16
+    /**
17
+     * @author ywx
18
+     * @description 根据用户id删除没有权限的常用模块
19
+     * @date 2020/7/9 20:55
20
+     **/
21
+    Integer deleteNoRoleByUserId(@Param("userid") Integer userid);
22
+}

+ 5
- 131
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassService.java View File

@@ -1,22 +1,15 @@
1 1
 package com.xhkjedu.suser.service.gradeclass;
2 2
 
3 3
 import com.xhkjedu.suser.mapper.gradeclass.ClassMapper;
4
-import com.xhkjedu.suser.mapper.gradeclass.ClassStudentMapper;
5
-import com.xhkjedu.suser.mapper.gradeclass.GroupStudentMapper;
6
-//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
4
+import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7 5
 import com.xhkjedu.suser.model.gradeclass.TClass;
8
-import com.xhkjedu.suser.model.gradeclass.TClassStudent;
9 6
 import com.xhkjedu.suser.model.gradeclass.TGroup;
10
-import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
11
-import com.xhkjedu.suser.model.gradeclass.TSchool;
7
+import com.xhkjedu.suser.vo.gradeclass.ClassVo;
12 8
 import com.xhkjedu.utils.N_Utils;
13 9
 import com.xhkjedu.vo.ResultVo;
14
-import com.xhkjedu.suser.vo.gradeclass.ClassVo;
15
-import org.springframework.beans.BeanUtils;
16 10
 import org.springframework.stereotype.Service;
17 11
 
18 12
 import javax.annotation.Resource;
19
-import java.util.ArrayList;
20 13
 import java.util.List;
21 14
 
22 15
 /**
@@ -32,19 +25,15 @@ public class ClassService {
32 25
     @Resource
33 26
     private GroupService groupService;
34 27
     @Resource
35
-    private ClassStudentMapper classStudentMapper;
36
-    @Resource
37
-    private GroupStudentMapper groupStudentMapper;
38
-    //@Resource
39
-    //private SchoolMapper schoolMapper;
28
+    private SchoolMapper schoolMapper;
40 29
 
41 30
     //添加
42 31
     public Integer save(TClass model) {
43 32
         model.setCreatetime(N_Utils.getSecondTimestamp());
44 33
         model.setClassnum(0);
45 34
         model.setClassstate(1);
46
-        //TSchool school = schoolMapper.selectByPrimaryKey(model.getSchoolid());
47
-        //model.setYear(school.getYear());//当前年份必须和学校年份一致
35
+        Integer year = schoolMapper.getYearById(model.getSchoolid());
36
+        model.setYear(year);//当前年份必须和学校年份一致
48 37
         classMapper.insertUseGeneratedKeys(model);
49 38
         //创建全体分组
50 39
         TGroup group = new TGroup();
@@ -59,21 +48,10 @@ public class ClassService {
59 48
 
60 49
     //删除
61 50
     public ResultVo deleteById(Integer classid) {
62
-        //2021-06-07删除时执行逻辑删除,不再判断是否有学生
63
-        /*ImportStudentVo student = classStudentMapper.getNumById(classid,0);
64
-        if (student.getClassnum() !=0){
65
-            return new ResultVo(1,"班级已关联学生,暂无法删除");
66
-        }*/
67 51
         classMapper.updateClassstateByClassid(classid,10);//删除班级逻辑删除
68 52
         return new ResultVo(0,"删除成功");
69 53
     }
70 54
 
71
-    //删除
72
-    public ResultVo deleteById2(Integer classid) {
73
-        classMapper.deleteByPrimaryKey(classid);
74
-        return new ResultVo(0,"删除成功");
75
-    }
76
-
77 55
     //修改
78 56
     public Integer update(TClass model) {
79 57
         model.setYear(null);//当前年份不能修改
@@ -85,101 +63,6 @@ public class ClassService {
85 63
         return classMapper.findAll(tClass);
86 64
     }
87 65
 
88
-    //更新学生数量
89
-    public void updateNum(Integer classid) {
90
-        classMapper.updateNum(classid);
91
-    }
92
-
93
-    //更新班级、分组学生数量
94
-    public void updateNum2(Integer classid) {
95
-        classMapper.updateNum2(classid);
96
-    }
97
-
98
-    //基本信息
99
-    public ClassVo getById(Integer classid) {
100
-        return classMapper.getById(classid);
101
-    }
102
-
103
-    //学生选课
104
-    public void saveSelection(Integer classid, Integer studentid, Integer teacherid, Integer schoolid) {
105
-        TClassStudent student = classStudentMapper.getByClassIdStudentId(classid, studentid);
106
-        if (student == null) {
107
-            //班级学生
108
-            TClassStudent cs = new TClassStudent();
109
-            cs.setClassid(classid);
110
-            cs.setStudentid(studentid);
111
-            cs.setCreateid(teacherid);
112
-            cs.setSchoolid(schoolid);
113
-            cs.setCreatetime(N_Utils.getSecondTimestamp());
114
-            classStudentMapper.save(cs);
115
-
116
-            //分组学生
117
-            ClassVo classVo = getById(classid);
118
-            Integer groupid = classVo.getGroupid();
119
-            TGroupStudent gs = new TGroupStudent();
120
-            gs.setClassid(classid);
121
-            gs.setGroupid(groupid);
122
-            gs.setStudentid(studentid);
123
-            gs.setCreateid(teacherid);
124
-            gs.setSchoolid(schoolid);
125
-            gs.setCreatetime(N_Utils.getSecondTimestamp());
126
-            groupStudentMapper.save(gs);
127
-        }
128
-
129
-        //更新班级、分组学生数量
130
-        updateNum2(classid);
131
-    }
132
-
133
-    //学生取消选课
134
-    public void cancelSelection(Integer classid, Integer studentid) {
135
-        classStudentMapper.deleteById(classid, studentid);
136
-        //更新班级、分组学生数量
137
-        updateNum2(classid);
138
-    }
139
-
140
-    //批量添加报名学生
141
-    public void batchSaveStu(Integer createid, Integer schoolid, Integer classid, List<Integer> studentids) {
142
-        List<TClassStudent> classStudents = new ArrayList<>();
143
-        List<TGroupStudent> groupStudents = new ArrayList<>();
144
-        //班级学生
145
-        TClassStudent cs = new TClassStudent();
146
-        cs.setClassid(classid);
147
-        cs.setCreateid(createid);
148
-        cs.setSchoolid(schoolid);
149
-        cs.setCreatetime(N_Utils.getSecondTimestamp());
150
-        //分组学生
151
-        ClassVo classVo = getById(classid);
152
-        Integer groupid = classVo.getGroupid();
153
-        TGroupStudent gs = new TGroupStudent();
154
-        gs.setClassid(classid);
155
-        gs.setGroupid(groupid);
156
-        gs.setCreateid(createid);
157
-        gs.setSchoolid(schoolid);
158
-        gs.setCreatetime(N_Utils.getSecondTimestamp());
159
-        for (Integer studentid : studentids) {
160
-            TClassStudent classStudent = new TClassStudent();
161
-            BeanUtils.copyProperties(cs, classStudent);
162
-            classStudent.setStudentid(studentid);
163
-            classStudents.add(classStudent);
164
-
165
-            TGroupStudent groupStudent = new TGroupStudent();
166
-            BeanUtils.copyProperties(gs, groupStudent);
167
-            groupStudent.setStudentid(studentid);
168
-            groupStudents.add(groupStudent);
169
-        }
170
-        classStudentMapper.insertList(classStudents);
171
-        groupStudentMapper.insertList(groupStudents);
172
-        updateNum2(classid);
173
-    }
174
-
175
-    public TClassStudent getByClassIdStudentId(Integer classid,Integer studentid){
176
-        return classStudentMapper.getByClassIdStudentId(classid,studentid);
177
-    }
178
-
179
-    public List<Integer> listClassidsByGradeid(Integer gradeid,Integer schoolid){
180
-        return classMapper.listClassidsByGradeid(gradeid,schoolid);
181
-    }
182
-
183 66
     //根据班级名称获取班级信息
184 67
     public TClass getByName(TClass tClass) {
185 68
         return classMapper.getByName(tClass);
@@ -189,13 +72,4 @@ public class ClassService {
189 72
     public List<String> listTeacher(Integer classid) {
190 73
         return classMapper.listTeacher(classid);
191 74
     }
192
-
193
-    //修改班级类型
194
-    public Integer updateClasstype(Integer classid, Integer classtype){
195
-        return classMapper.updateClasstype(classid, classtype);
196
-    }
197
-
198
-    public Integer updateClassstateByClassid(Integer classid,Integer classstate){
199
-        return classMapper.updateClassstateByClassid(classid, classstate);
200
-    }
201 75
 }

+ 21
- 28
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassStudentService.java View File

@@ -3,19 +3,18 @@ package com.xhkjedu.suser.service.gradeclass;
3 3
 import com.xhkjedu.config.MissingParametersException;
4 4
 import com.xhkjedu.suser.mapper.gradeclass.ClassMapper;
5 5
 import com.xhkjedu.suser.mapper.gradeclass.ClassStudentMapper;
6
-//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7
-//import com.xhkjedu.suser.mapper.liveplay.CourseMapper;
8
-//import com.xhkjedu.suser.model.liveplay.LCourse;
6
+import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7
+import com.xhkjedu.suser.mapper.liveplay.CourseMapper;
9 8
 import com.xhkjedu.suser.model.gradeclass.TClassStudent;
10 9
 import com.xhkjedu.suser.model.gradeclass.TGroupStudent;
11 10
 import com.xhkjedu.suser.model.system.TUser;
12 11
 import com.xhkjedu.suser.service.system.UserService;
13
-import com.xhkjedu.utils.N_Utils;
14 12
 import com.xhkjedu.suser.utils.PoiUtils;
15
-import com.xhkjedu.vo.ResultVo;
16 13
 import com.xhkjedu.suser.vo.gradeclass.ClassStudentVo;
17 14
 import com.xhkjedu.suser.vo.gradeclass.ClassVo;
18 15
 import com.xhkjedu.suser.vo.gradeclass.ImportStudentVo;
16
+import com.xhkjedu.utils.N_Utils;
17
+import com.xhkjedu.vo.ResultVo;
19 18
 import lombok.extern.slf4j.Slf4j;
20 19
 import org.springframework.stereotype.Service;
21 20
 import org.springframework.transaction.annotation.Transactional;
@@ -44,10 +43,10 @@ public class ClassStudentService {
44 43
     private GroupStudentService groupStudentService;
45 44
     @Resource
46 45
     private ClassMapper classMapper;
47
-    //@Resource
48
-    //private SchoolMapper schoolMapper;
49
-    //@Resource
50
-    //private CourseMapper courseMapper;
46
+    @Resource
47
+    private SchoolMapper schoolMapper;
48
+    @Resource
49
+    private CourseMapper courseMapper;
51 50
 
52 51
     //批量添加
53 52
     public void batchAdd(List<TClassStudent> students) throws Exception {
@@ -135,9 +134,6 @@ public class ClassStudentService {
135 134
             }
136 135
         }
137 136
 
138
-        //2021年4月28日,张道剑建议,南华凯、张剑、王宁 共同确认不再复制预习导学信息
139
-//        guideGroupStudentMapper.copyGuideResource(model.getStudentid(), model.getClassid());//复制学生预习导学信息
140
-
141 137
         //把这个学生加到此行政班、提高班相关的所有直播班中
142 138
         if (classVo.getClasstype() == 1 || classVo.getClasstype() == 2) {
143 139
             saveCourseStu(model.getClassid(), model.getStudentid());
@@ -147,12 +143,12 @@ public class ClassStudentService {
147 143
 
148 144
     //把这个学生加到此行政班相关的所有直播班中
149 145
     public void saveCourseStu(Integer classid, Integer studentid) {
150
-        //List<LCourse> courses = courseMapper.listXzCourse(classid);
151
-        //for (LCourse course : courses) {
152
-        //    Integer courseid = course.getCourseid();
153
-        //    saveSelection(course.getClassid(), studentid, course.getCreateid(), course.getSchoolid());
154
-        //    courseMapper.updateStuNum(courseid);
155
-        //}
146
+        List<Map> courses = courseMapper.listXzCourse(classid);
147
+        for (Map course : courses) {
148
+            Integer courseid = (Integer) course.get("courseid");
149
+            saveSelection((Integer) course.get("classid"), studentid, (Integer) course.get("createid"), (Integer) course.get("schoolid"));
150
+            courseMapper.updateStuNum(courseid);
151
+        }
156 152
     }
157 153
 
158 154
     //学生选课
@@ -200,10 +196,10 @@ public class ClassStudentService {
200 196
         //把这个学生从此行政班、提高班关联的所有直播班移除
201 197
         ClassVo classVo = classMapper.getById(classid);
202 198
         if (classVo.getClasstype() == 1 || classVo.getClasstype() == 2) {
203
-            //List<LCourse> courses = courseMapper.listXzCourse(classid);
204
-            //for (LCourse course : courses) {
205
-            //    cancelSelection(course.getClassid(), studentid);
206
-            //}
199
+            List<Map> courses = courseMapper.listXzCourse(classid);
200
+            for (Map course : courses) {
201
+                cancelSelection((Integer) course.get("classid"), studentid);
202
+            }
207 203
         }
208 204
     }
209 205
 
@@ -468,8 +464,7 @@ public class ClassStudentService {
468 464
      * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
469 465
      */
470 466
     public List<ClassVo> listClassByStudentId(Integer studentid){
471
-        //Integer year = schoolMapper.getYearByUserId(studentid);
472
-        Integer year=2021;
467
+        Integer year = schoolMapper.getYearByUserId(studentid);
473 468
         return classStudentMapper.listClassByStudentId(year,studentid);
474 469
     }
475 470
 
@@ -496,8 +491,7 @@ public class ClassStudentService {
496 491
 
497 492
     //获取学生所在年级列表
498 493
     public List<Integer> listGrade(Integer studentid) {
499
-        //Integer year = schoolMapper.getYearByUserId(studentid);
500
-        Integer year=2021;
494
+        Integer year = schoolMapper.getYearByUserId(studentid);
501 495
         return classStudentMapper.listGrade(studentid, year);
502 496
     }
503 497
 
@@ -508,8 +502,7 @@ public class ClassStudentService {
508 502
 
509 503
     //设置年份
510 504
     public void setYear(TClassStudent student) {
511
-        //Integer year = schoolMapper.getYearById(student.getSchoolid());
512
-        Integer year=2021;
505
+        Integer year = schoolMapper.getYearById(student.getSchoolid());
513 506
         student.setYear(year);
514 507
     }
515 508
 

+ 12
- 16
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/ClassTeacherService.java View File

@@ -2,15 +2,15 @@ package com.xhkjedu.suser.service.gradeclass;
2 2
 
3 3
 import com.xhkjedu.config.MissingParametersException;
4 4
 import com.xhkjedu.suser.mapper.gradeclass.ClassTeacherMapper;
5
-//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
5
+import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
6 6
 import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
7 7
 import com.xhkjedu.suser.model.system.TUser;
8 8
 import com.xhkjedu.suser.service.system.UserService;
9
-import com.xhkjedu.utils.N_Utils;
10
-import com.xhkjedu.vo.ResultVo;
11 9
 import com.xhkjedu.suser.vo.gradeclass.ClassTeacherParams;
12 10
 import com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo;
13 11
 import com.xhkjedu.suser.vo.gradeclass.ClassVo;
12
+import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
14 14
 import org.springframework.stereotype.Service;
15 15
 
16 16
 import javax.annotation.Resource;
@@ -20,7 +20,7 @@ import java.util.Map;
20 20
 /**
21 21
  * @author ywx
22 22
  * @classname TClassTeacherService
23
- * @description 
23
+ * @description
24 24
  * @date 2020/6/2 16:45
25 25
  **/
26 26
 @Service
@@ -29,8 +29,8 @@ public class ClassTeacherService {
29 29
     private ClassTeacherMapper classTeacherMapper;
30 30
     @Resource
31 31
     private UserService userService;
32
-    //@Resource
33
-    //private SchoolMapper schoolMapper;
32
+    @Resource
33
+    private SchoolMapper schoolMapper;
34 34
 
35 35
     //添加
36 36
     public Integer save(TClassTeacher model) {
@@ -90,20 +90,17 @@ public class ClassTeacherService {
90 90
     }
91 91
 
92 92
     public Integer getYear(Integer schoolid) {
93
-        //return schoolMapper.getYearById(schoolid);
94
-        return 2021;
93
+        return schoolMapper.getYearById(schoolid);
95 94
     }
96 95
 
97 96
     //当前年份教师任教班级
98 97
     public List<ClassVo> listTeacherClass(Integer teacher,Integer classtype){
99
-        //Integer year = schoolMapper.getYearByUserId(teacher);
100
-        Integer year=2021;
98
+        Integer year = schoolMapper.getYearByUserId(teacher);
101 99
         return classTeacherMapper.listTeacherClass(teacher,year,classtype);
102 100
     }
103 101
     //当前年份教师任教班级
104 102
     public List<ClassVo> listTeacherClass2(Integer teacher){
105
-        //Integer year = schoolMapper.getYearByUserId(teacher);
106
-        Integer year=2021;
103
+        Integer year = schoolMapper.getYearByUserId(teacher);
107 104
         return classTeacherMapper.listTeacherClass2(teacher,year);
108 105
     }
109 106
 
@@ -132,8 +129,7 @@ public class ClassTeacherService {
132 129
      * @return java.util.List<com.xhkjedu.model.gradeclass.TClassTeacher>
133 130
      */
134 131
     public List<ClassTeacherVo> listTeachersByGradeid(Integer schoolid,Integer gradeid){
135
-        //Integer year = schoolMapper.getYearById(schoolid);
136
-        Integer year=2021;
132
+        Integer year = schoolMapper.getYearById(schoolid);
137 133
         return classTeacherMapper.listTeachersByGradeid(schoolid,gradeid,year);
138 134
     }
139 135
 
@@ -145,8 +141,8 @@ public class ClassTeacherService {
145 141
      * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo>
146 142
      */
147 143
     public List<ClassTeacherVo> listTeahcersBySubjectGrade(ClassTeacherParams ctp) {
148
-        //Integer year = schoolMapper.getYearById(ctp.getSchoolid());
149
-        //ctp.setYear(year);
144
+        Integer year = schoolMapper.getYearById(ctp.getSchoolid());
145
+        ctp.setYear(year);
150 146
         return classTeacherMapper.listTeahcersBySubjectGrade(ctp);
151 147
     }
152 148
 }

+ 7
- 8
suser/src/main/java/com/xhkjedu/suser/service/gradeclass/GroupService.java View File

@@ -1,10 +1,10 @@
1 1
 package com.xhkjedu.suser.service.gradeclass;
2 2
 
3 3
 import com.xhkjedu.suser.mapper.gradeclass.GroupMapper;
4
-//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
4
+import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
5 5
 import com.xhkjedu.suser.model.gradeclass.TGroup;
6
-import com.xhkjedu.utils.N_Utils;
7 6
 import com.xhkjedu.suser.vo.gradeclass.ClassGroupVo;
7
+import com.xhkjedu.utils.N_Utils;
8 8
 import org.springframework.stereotype.Service;
9 9
 
10 10
 import javax.annotation.Resource;
@@ -13,7 +13,7 @@ import java.util.List;
13 13
 /**
14 14
  * @author ywx
15 15
  * @classname GroupService
16
- * @description 
16
+ * @description
17 17
  * @date 2020/6/2 17:26
18 18
  **/
19 19
 @Service
@@ -22,15 +22,15 @@ public class GroupService {
22 22
     private GroupMapper groupMapper;
23 23
     @Resource
24 24
     private GroupStudentService groupStudentService;
25
-    //@Resource
26
-    //private SchoolMapper schoolMapper;
25
+    @Resource
26
+    private SchoolMapper schoolMapper;
27 27
 
28 28
     //添加
29 29
     public Integer save(TGroup model) {
30 30
         model.setGroupnum(0);
31 31
         model.setCreatetime(N_Utils.getSecondTimestamp());
32 32
         groupMapper.insertUseGeneratedKeys(model);
33
-        if (N_Utils.isListNotEmpty(model.getStudents())){
33
+        if (N_Utils.isListNotEmpty(model.getStudents())) {
34 34
             model.setGroupid(model.getId());
35 35
             groupStudentService.batchSave(model);//批量添加分组学生
36 36
         }
@@ -68,8 +68,7 @@ public class GroupService {
68 68
 
69 69
     //教师分组列表
70 70
     public List<ClassGroupVo> teacherList(Integer teacherid) {
71
-        //Integer year = schoolMapper.getYearByUserId(teacherid);
72
-        Integer year=2022;
71
+        Integer year = schoolMapper.getYearByUserId(teacherid);
73 72
         return groupMapper.teacherList(teacherid, year);
74 73
     }
75 74
 }

+ 49
- 49
suser/src/main/java/com/xhkjedu/suser/service/system/TeacherRoleService.java View File

@@ -1,21 +1,20 @@
1 1
 package com.xhkjedu.suser.service.system;
2 2
 
3 3
 import com.xhkjedu.suser.mapper.gradeclass.ClassTeacherMapper;
4
-//import com.xhkjedu.suser.mapper.subjectbook.TeacherPowersbMapper;
5
-//import com.xhkjedu.suser.mapper.subjectbook.TeacherSubjectbookMapper;
4
+import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
5
+import com.xhkjedu.suser.mapper.subjectbook.TeacherPowersbMapper;
6
+import com.xhkjedu.suser.mapper.subjectbook.TeacherSubjectbookMapper;
7
+import com.xhkjedu.suser.mapper.system.UserModuleMapper;
6 8
 import com.xhkjedu.suser.mapper.system.UserRoleMapper;
7 9
 import com.xhkjedu.suser.model.gradeclass.TClassTeacher;
8 10
 import com.xhkjedu.suser.model.subjectbook.TTeacherPowersb;
9 11
 import com.xhkjedu.suser.model.system.TUserRole;
10
-import com.xhkjedu.suser.vo.system.TeacherRoleVo;
11
-import com.xhkjedu.utils.N_Utils;
12 12
 import com.xhkjedu.suser.vo.gradeclass.ClassVo;
13 13
 import com.xhkjedu.suser.vo.gradeclass.GradeVo;
14
-import com.xhkjedu.suser.vo.subjectbook.LsbBookVo;
15
-import com.xhkjedu.suser.vo.subjectbook.SubjectVo;
16
-import com.xhkjedu.suser.vo.subjectbook.TeacherSubjectbookVo;
17 14
 import com.xhkjedu.suser.vo.system.TeacherRoleParam;
15
+import com.xhkjedu.suser.vo.system.TeacherRoleVo;
18 16
 import com.xhkjedu.suser.vo.system.UserRoleVo;
17
+import com.xhkjedu.utils.N_Utils;
19 18
 import lombok.extern.slf4j.Slf4j;
20 19
 import org.springframework.beans.factory.annotation.Autowired;
21 20
 import org.springframework.stereotype.Service;
@@ -26,6 +25,7 @@ import org.springframework.util.CollectionUtils;
26 25
 import javax.annotation.Resource;
27 26
 import java.util.ArrayList;
28 27
 import java.util.List;
28
+import java.util.Map;
29 29
 
30 30
 /**
31 31
  * @ClassName TeacherRoleService
@@ -42,7 +42,7 @@ public class TeacherRoleService {
42 42
     @Autowired
43 43
     private UserRoleMapper userRoleMapper;
44 44
 
45
-    /*@Autowired
45
+    @Autowired
46 46
     private TeacherPowersbMapper teacherPowersbMapper;
47 47
 
48 48
     @Resource
@@ -51,7 +51,7 @@ public class TeacherRoleService {
51 51
     @Autowired
52 52
     private UserModuleMapper userModuleMapper;
53 53
     @Resource
54
-    private SchoolMapper schoolMapper;*/
54
+    private SchoolMapper schoolMapper;
55 55
 
56 56
     /**
57 57
      *功能描述  保存教师设置权限
@@ -63,15 +63,15 @@ public class TeacherRoleService {
63 63
     @Transactional(rollbackFor = Exception.class)
64 64
     public void save(TeacherRoleParam trole) throws Exception {
65 65
         try {
66
-            //Integer year = schoolMapper.getYearByUserId(trole.getTeacherid());
67
-            //trole.setYear(year);
66
+            Integer year = schoolMapper.getYearByUserId(trole.getTeacherid());
67
+            trole.setYear(year);
68 68
             int timestamp = N_Utils.getSecondTimestamp();
69 69
             //处理用户角色
70 70
             // 先删除
71 71
             userRoleMapper.deleteByUserid(trole.getTeacherid());
72
-            if(!CollectionUtils.isEmpty(trole.getRolelist())){
72
+            if (!CollectionUtils.isEmpty(trole.getRolelist())) {
73 73
                 List<TUserRole> rolelst = new ArrayList<>();
74
-                for(Integer roleid : trole.getRolelist()){
74
+                for (Integer roleid : trole.getRolelist()) {
75 75
                     TUserRole ur = new TUserRole();
76 76
                     ur.setUserid(trole.getTeacherid());
77 77
                     ur.setRoleid(roleid);
@@ -86,19 +86,19 @@ public class TeacherRoleService {
86 86
             }
87 87
 
88 88
             //根据用户id删除没有权限的常用模块
89
-            //userModuleMapper.deleteNoRoleByUserId(trole.getTeacherid());
90
-            //
91
-            ////处理用户教材
92
-            //List<String> lsbids = teacherSubjectbookMapper.listLsbsByUserid(trole.getTeacherid());
93
-            //List<String> lsbId = N_Utils.listNotInList3(lsbids, trole.getLsblist());
94
-            //if (N_Utils.isListNotEmpty(lsbId)){//删除教师收藏教材
95
-            //    teacherSubjectbookMapper.deleteByLsbIdTeacherId(lsbId, trole.getTeacherid());
96
-            //}
97
-            ////先删除
98
-            //teacherPowersbMapper.deleteByUserid(trole.getTeacherid());
99
-            if(!CollectionUtils.isEmpty(trole.getLsblist())){
89
+            userModuleMapper.deleteNoRoleByUserId(trole.getTeacherid());
90
+
91
+            //处理用户教材
92
+            List<String> lsbids = teacherSubjectbookMapper.listLsbsByUserid(trole.getTeacherid());
93
+            List<String> lsbId = N_Utils.listNotInList3(lsbids, trole.getLsblist());
94
+            if (N_Utils.isListNotEmpty(lsbId)) {//删除教师收藏教材
95
+                teacherSubjectbookMapper.deleteByLsbIdTeacherId(lsbId, trole.getTeacherid());
96
+            }
97
+            //先删除
98
+            teacherPowersbMapper.deleteByUserid(trole.getTeacherid());
99
+            if (!CollectionUtils.isEmpty(trole.getLsblist())) {
100 100
                 List<TTeacherPowersb> tpowerlist = new ArrayList<>();
101
-                for(String lsbid : trole.getLsblist()){
101
+                for (String lsbid : trole.getLsblist()) {
102 102
                     TTeacherPowersb tp = new TTeacherPowersb();
103 103
                     tp.setTeacherid(trole.getTeacherid());
104 104
                     tp.setLsbid(lsbid);
@@ -109,7 +109,7 @@ public class TeacherRoleService {
109 109
                     tpowerlist.add(tp);
110 110
                 }
111 111
 
112
-                //teacherPowersbMapper.insertList(tpowerlist);
112
+                teacherPowersbMapper.insertList(tpowerlist);
113 113
             }
114 114
 
115 115
             //处理用户班级
@@ -139,18 +139,18 @@ public class TeacherRoleService {
139 139
     }
140 140
 
141 141
     //获取用户权限--角色、班级、教材 集合
142
-    public TeacherRoleVo getTeacherRoles(TeacherRoleParam trparam){
143
-        //Integer year = schoolMapper.getYearByUserId(trparam.getTeacherid());
144
-        //trparam.setYear(year);
142
+    public TeacherRoleVo getTeacherRoles(TeacherRoleParam trparam) {
143
+        Integer year = schoolMapper.getYearByUserId(trparam.getTeacherid());
144
+        trparam.setYear(year);
145 145
         TeacherRoleVo trvo = new TeacherRoleVo();
146 146
         //获取已设置角色集合
147 147
         List<UserRoleVo> roleids = userRoleMapper.listRolesByUserid(trparam.getTeacherid());
148
-        List<ClassVo> classids = classTeacherMapper.listClassesByUserid(trparam.getTeacherid(),trparam.getYear(),trparam.getClasstype());
149
-        //List<TeacherSubjectbookVo> lsbids = teacherPowersbMapper.listLsbsByUserid(trparam.getTeacherid());
148
+        List<ClassVo> classids = classTeacherMapper.listClassesByUserid(trparam.getTeacherid(), trparam.getYear(), trparam.getClasstype());
149
+        List<Map> lsbids = teacherPowersbMapper.listLsbsByUserid(trparam.getTeacherid());
150 150
 
151 151
         trvo.setRolelist(roleids);
152 152
         trvo.setClasslist(classids);
153
-        //trvo.setLsblist(lsbids);
153
+        trvo.setLsblist(lsbids);
154 154
 
155 155
         return trvo;
156 156
     }
@@ -165,34 +165,34 @@ public class TeacherRoleService {
165 165
     public TeacherRoleVo listBook(Integer teacherid) {
166 166
         TeacherRoleVo trvo = new TeacherRoleVo();
167 167
         //获取已设置角色集合
168
-        //List<TeacherSubjectbookVo> lsbids = teacherPowersbMapper.listLsbsByUserid(teacherid);
169
-        //trvo.setLsblist(lsbids);
168
+        List<Map> lsbids = teacherPowersbMapper.listLsbsByUserid(teacherid);
169
+        trvo.setLsblist(lsbids);
170 170
         return trvo;
171 171
     }
172 172
 
173 173
     /**
174 174
      * 教师权限科目
175
+     *
176
+     * @return java.util.List<com.xhkjedu.suser.vo.subjectbook.SubjectVo>
175 177
      * @Param [teacherid]
176 178
      * @Author ywx
177 179
      * @Date 2020/7/24 9:26
178
-     * @return java.util.List<com.xhkjedu.suser.vo.subjectbook.SubjectVo>
179 180
      **/
180
-    public List<SubjectVo> listSubject(Integer teacherid) {
181
-        //return teacherPowersbMapper.listSubject(teacherid);
182
-        return null;
181
+    public List<Map> listSubject(Integer teacherid) {
182
+        return teacherPowersbMapper.listSubject(teacherid);
183 183
     }
184 184
 
185 185
     /**
186
-     *功能描述 教师权限科目下,权限教材
187
-     * @author WN
188
-     * @date 2020/8/11
189
-     * @param  * @param teacherid
186
+     * 功能描述 教师权限科目下,权限教材
187
+     *
188
+     * @param *         @param teacherid
190 189
      * @param subjectid
191 190
      * @return java.util.List<com.xhkjedu.suser.vo.subjectbook.LsbBookVo>
191
+     * @author WN
192
+     * @date 2020/8/11
192 193
      */
193
-    public List<LsbBookVo> listBookBySubjectid(Integer teacherid,String subjectid){
194
-        //return teacherPowersbMapper.listBookBySubjectid(teacherid,subjectid);
195
-        return null;
194
+    public List<Map> listBookBySubjectid(Integer teacherid, String subjectid) {
195
+        return teacherPowersbMapper.listBookBySubjectid(teacherid, subjectid);
196 196
     }
197 197
 
198 198
     /**
@@ -203,8 +203,8 @@ public class TeacherRoleService {
203 203
      * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.ClassVo>
204 204
      **/
205 205
     public List<GradeVo> listGradeClassesByUserid(TeacherRoleParam role) {
206
-        //Integer year = schoolMapper.getYearByUserId(role.getTeacherid());
207
-        //role.setYear(year);
206
+        Integer year = schoolMapper.getYearByUserId(role.getTeacherid());
207
+        role.setYear(year);
208 208
         return classTeacherMapper.listGradeClassesByUserid(role);
209 209
     }
210 210
 
@@ -216,8 +216,8 @@ public class TeacherRoleService {
216 216
      * @return java.util.List<com.xhkjedu.suser.vo.gradeclass.GradeVo>
217 217
      **/
218 218
     public List<GradeVo> listGradeClassesByUserid2(TeacherRoleParam role) {
219
-        //Integer year = schoolMapper.getYearByUserId(role.getTeacherid());
220
-        //role.setYear(year);
219
+        Integer year = schoolMapper.getYearByUserId(role.getTeacherid());
220
+        role.setYear(year);
221 221
         return classTeacherMapper.listGradeClassesByUserid2(role);
222 222
     }
223 223
 }

+ 44
- 78
suser/src/main/java/com/xhkjedu/suser/service/system/UserService.java View File

@@ -3,25 +3,27 @@ package com.xhkjedu.suser.service.system;
3 3
 import com.github.pagehelper.PageHelper;
4 4
 import com.github.pagehelper.PageInfo;
5 5
 import com.xhkjedu.suser.config.ConfigKey;
6
-//import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
6
+import com.xhkjedu.suser.mapper.gradeclass.SchoolMapper;
7
+import com.xhkjedu.suser.mapper.system.MsgMapper;
8
+import com.xhkjedu.suser.mapper.system.UserLogMapper;
7 9
 import com.xhkjedu.suser.mapper.system.UserMapper;
8
-import com.xhkjedu.vo.PageResult;
9 10
 import com.xhkjedu.suser.model.system.TMsg;
10 11
 import com.xhkjedu.suser.model.system.TUser;
11 12
 import com.xhkjedu.suser.model.system.TUserLog;
12
-import com.xhkjedu.utils.DESUtils;
13
-import com.xhkjedu.utils.DatesUtil;
14 13
 import com.xhkjedu.suser.utils.JedisUtil;
15
-import com.xhkjedu.utils.MD5;
16
-import com.xhkjedu.utils.N_Utils;
17
-import com.xhkjedu.utils.PageUtil;
18 14
 import com.xhkjedu.suser.utils.PoiUtils;
19 15
 import com.xhkjedu.suser.utils.SMSSender;
20
-import com.xhkjedu.vo.ResultVo;
21 16
 import com.xhkjedu.suser.vo.assess.AssessParams;
22 17
 import com.xhkjedu.suser.vo.system.TeacherVo;
23 18
 import com.xhkjedu.suser.vo.system.UserVo;
24 19
 import com.xhkjedu.suser.vo.system.ZtMsgVo;
20
+import com.xhkjedu.utils.DESUtils;
21
+import com.xhkjedu.utils.DatesUtil;
22
+import com.xhkjedu.utils.MD5;
23
+import com.xhkjedu.utils.N_Utils;
24
+import com.xhkjedu.utils.PageUtil;
25
+import com.xhkjedu.vo.PageResult;
26
+import com.xhkjedu.vo.ResultVo;
25 27
 import lombok.extern.slf4j.Slf4j;
26 28
 import org.springframework.beans.factory.annotation.Autowired;
27 29
 import org.springframework.stereotype.Service;
@@ -30,7 +32,6 @@ import org.springframework.web.multipart.MultipartFile;
30 32
 
31 33
 import javax.annotation.Resource;
32 34
 import javax.servlet.http.HttpServletRequest;
33
-import java.net.UnknownHostException;
34 35
 import java.util.ArrayList;
35 36
 import java.util.HashMap;
36 37
 import java.util.List;
@@ -49,12 +50,12 @@ public class UserService extends JedisUtil {
49 50
 
50 51
     @Autowired
51 52
     private UserMapper userMapper;
52
-    /*@Autowired
53
-    private UserLogService userLogService;
53
+    @Autowired
54
+    private UserLogMapper userLogMapper;
54 55
     @Resource
55
-    private MsgService msgService;
56
+    private MsgMapper msgMapper;
56 57
     @Resource
57
-    private SchoolMapper schoolMapper;*/
58
+    private SchoolMapper schoolMapper;
58 59
 
59 60
     /**
60 61
      *功能描述  根据登录名和密码获取用户信息
@@ -70,8 +71,6 @@ public class UserService extends JedisUtil {
70 71
         UserVo userVo = userMapper.getUserByLoginname(user.getLoginname());
71 72
 
72 73
         if(userVo!=null && userVo.getUserid()>0){
73
-            //String schooldomain = userVo.getSchooldomain();
74
-            //if (checkDomain(request, schooldomain, userVo.getSchoolid())) return new ResultVo(1, "该账号不存在");
75 74
             user.setUserid(userVo.getUserid());
76 75
             user.setUsername(userVo.getUsername());
77 76
             user.setSchoolid(userVo.getSchoolid());
@@ -99,24 +98,6 @@ public class UserService extends JedisUtil {
99 98
         return getLogResultVo(user, resultVo, loginpwd, request);
100 99
     }
101 100
 
102
-    //校验域名
103
-    private boolean checkDomain(HttpServletRequest request, String schooldomain, Integer schoolid) {
104
-        String clientlogin = request.getHeader("clientlogin");//有值不校验
105
-        if (N_Utils.isNotEmpty(clientlogin)) return false;
106
-        //origin:pc端获取到的是file://、android和手机端获取的为空、开发环境获取的是localhost
107
-        String url = request.getHeader("origin");
108
-        if (N_Utils.isEmpty(schooldomain) || N_Utils.isEmpty(url)
109
-                || url.equals("file://") || url.contains("localhost")) {
110
-            return false;
111
-        }
112
-        String domain = url.replace("https://", "").replace("http://", "");
113
-        //Integer sid = schoolMapper.getSchoolIdByDomain(domain, schoolid);
114
-        //if (!schoolid.equals(sid)) {
115
-        //    return true;
116
-        //}
117
-        return false;
118
-    }
119
-
120 101
     //教师登录
121 102
     public ResultVo loginTeacher(TUser user,HttpServletRequest request){
122 103
         ResultVo resultVo = null;
@@ -125,8 +106,6 @@ public class UserService extends JedisUtil {
125 106
         UserVo userVo = userMapper.getUserByLoginname(user.getLoginname());
126 107
 
127 108
         if(userVo!=null && userVo.getUserid()>0) {
128
-            //String schooldomain = userVo.getSchooldomain();
129
-            //if (checkDomain(request, schooldomain, userVo.getSchoolid())) return new ResultVo(1, "该账号不存在");
130 109
             user.setUserid(userVo.getUserid());
131 110
             user.setUsername(userVo.getUsername());
132 111
             user.setSchoolid(userVo.getSchoolid());
@@ -167,8 +146,6 @@ public class UserService extends JedisUtil {
167 146
         UserVo userVo = userMapper.getUserByLoginnameMac(user.getLoginname(),mac);
168 147
 
169 148
         if(userVo!=null && userVo.getUserid()>0) {
170
-            //String schooldomain = userVo.getSchooldomain();
171
-            //if (checkDomain(request, schooldomain, userVo.getSchoolid())) return new ResultVo(1, "该账号不存在");
172 149
             Integer sbindmac = userVo.getSbindmac();
173 150
             user.setUserid(userVo.getUserid());
174 151
             user.setUsername(userVo.getUsername());
@@ -258,7 +235,7 @@ public class UserService extends JedisUtil {
258 235
             userLog.setUltype(user.getUltype());
259 236
             userLog.setVersionnum(user.getVersionnum());
260 237
             userLog.setLogtime(N_Utils.getSecondTimestamp());
261
-            userMapper.saveUserLog(userLog);
238
+            userLogMapper.insertSelective(userLog);
262 239
         } catch (Exception e) {
263 240
             log.error("添加登录日志失败:" + e.getMessage());
264 241
             result = new ResultVo(1, "保存失败");
@@ -275,18 +252,17 @@ public class UserService extends JedisUtil {
275 252
      **/
276 253
     public ResultVo save(TUser user) {
277 254
         Integer schoolid = user.getSchoolid();
278
-        /*Integer usernum = schoolMapper.getUserNumById(schoolid);
255
+        Integer usernum = schoolMapper.getUserNumById(schoolid);
279 256
         if (usernum != null) {
280 257
             Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
281 258
             usernum2 = usernum2 + 1;//学校账号数量+本次添加的人
282 259
             if (usernum.compareTo(usernum2) == -1) {
283 260
                 return new ResultVo(1,"账号数量已超限,请联系管理员");
284 261
             }
285
-        }*/
262
+        }
286 263
         user.setUserstate(1);
287 264
         user.setCreatetime(N_Utils.getSecondTimestamp());
288 265
         setLoginPwd(user);
289
-//        userMapper.insertSelective(user);
290 266
         userMapper.insertUseGeneratedKeys(user);
291 267
         return new ResultVo(0, "保存成功",user.getId());
292 268
     }
@@ -409,11 +385,6 @@ public class UserService extends JedisUtil {
409 385
         }
410 386
     }
411 387
 
412
-    public Integer getNumByLoginName(String loginname) {
413
-        Integer num = userMapper.checkLoginName(loginname);
414
-        return num;
415
-    }
416
-
417 388
     /**
418 389
      * 根据登录账号获取用户详情
419 390
      * @Param [loginname]
@@ -434,14 +405,14 @@ public class UserService extends JedisUtil {
434 405
      **/
435 406
     public void batchSave(List<TUser> users) throws Exception {
436 407
         Integer schoolid = users.get(0).getSchoolid();
437
-        //Integer usernum = schoolMapper.getUserNumById(schoolid);
438
-        //if (usernum != null) {
439
-        //    Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
440
-        //    usernum2 = usernum2 + users.size();//学校账号数量+本次添加的人
441
-        //    if (usernum.compareTo(usernum2) == -1) {
442
-        //        throw new Exception("账号数量已超限,请联系管理员");
443
-        //    }
444
-        //}
408
+        Integer usernum = schoolMapper.getUserNumById(schoolid);
409
+        if (usernum != null) {
410
+            Integer usernum2 = userMapper.getUserNumBySchoolId(schoolid);
411
+            usernum2 = usernum2 + users.size();//学校账号数量+本次添加的人
412
+            if (usernum.compareTo(usernum2) == -1) {
413
+                throw new Exception("账号数量已超限,请联系管理员");
414
+            }
415
+        }
445 416
         userMapper.insertList(users);
446 417
     }
447 418
 
@@ -471,10 +442,6 @@ public class UserService extends JedisUtil {
471 442
             Map<String,Object> map = PoiUtils.readExcelUser(file, 1);
472 443
             List<TUser> teachers = (List<TUser>)map.get("users");
473 444
             map.remove("users");//导入成功的教师信息不返回给前端
474
-            /*if (!CollectionUtils.isEmpty((List<TUser>)map.get("excelExisted"))) {
475
-                map.put("code",1);
476
-                return new ResultVo(0, "导入失败", map);
477
-            }*/
478 445
 
479 446
             List<TUser> users = new ArrayList<>();
480 447
             // 以下教师信息已存在
@@ -603,30 +570,30 @@ public class UserService extends JedisUtil {
603 570
      * @return boolean
604 571
      **/
605 572
     private boolean generateCode(String userphone, String templateCode) {
606
-        //Integer msgNum = msgService.getMsgNumByUserPhone(userphone);//5分钟内发送短信次数
607
-        //if (msgNum != 0) return true;
573
+        Integer msgNum = msgMapper.getMsgNumByUserPhone(userphone);//5分钟内发送短信次数
574
+        if (msgNum != 0) return true;
608 575
 
609 576
         Integer messageCode = N_Utils.messageCode();
610 577
         String msgtxt = "";
611
-        if ("yhzc".equals(templateCode)){//用户注册验证码
612
-            msgtxt += "验证码"+messageCode+",您正在注册成为新用户,感谢您的支持!";
613
-        } else if ("xgmm".equals(templateCode)){//修改密码验证码
614
-            msgtxt += "验证码"+messageCode+",您正在尝试修改登录密码,请妥善保管账户信息。";
615
-        } else if ("dlqr".equals(templateCode)){//登录确认验证码
616
-            msgtxt += "验证码"+messageCode+",您正在登录,若非本人操作,请勿泄露。";
578
+        if ("yhzc".equals(templateCode)) {//用户注册验证码
579
+            msgtxt += "验证码" + messageCode + ",您正在注册成为新用户,感谢您的支持!";
580
+        } else if ("xgmm".equals(templateCode)) {//修改密码验证码
581
+            msgtxt += "验证码" + messageCode + ",您正在尝试修改登录密码,请妥善保管账户信息。";
582
+        } else if ("dlqr".equals(templateCode)) {//登录确认验证码
583
+            msgtxt += "验证码" + messageCode + ",您正在登录,若非本人操作,请勿泄露。";
617 584
         }
618 585
         ZtMsgVo m = new ZtMsgVo();
619 586
         m.setMobile(userphone);
620 587
         m.setContent(msgtxt);
621 588
         SMSSender.sendSms(m);
622
-//        SendSmsUtil.sendMsg(userphone, templateCode, messageCode);
623 589
 
624 590
         //添加短信信息
625
-        //TMsg msg = new TMsg();
626
-        //msg.setUserphone(userphone);
627
-        //msg.setMsgcode(messageCode);
628
-        //msg.setMsgtxt(msgtxt);
629
-        //msgService.save(msg);
591
+        TMsg msg = new TMsg();
592
+        msg.setUserphone(userphone);
593
+        msg.setMsgcode(messageCode);
594
+        msg.setMsgtxt(msgtxt);
595
+        msg.setCreatetime(N_Utils.getSecondTimestamp());
596
+        msgMapper.insertSelective(msg);
630 597
         return false;
631 598
     }
632 599
 
@@ -653,10 +620,10 @@ public class UserService extends JedisUtil {
653 620
      * @return com.xhkjedu.model.baseinfo.ResultVo
654 621
      **/
655 622
     private ResultVo getCodeResultVo(String userphone, Integer messageCode) {
656
-        //TMsg msg = msgService.findByUserPhoneAndCode(userphone,messageCode);//根据手机号和验证码获取短信信息
657
-        //if (msg == null) return new ResultVo(1,"验证码有误");
658
-        //int secondTimestamp = N_Utils.getSecondTimestamp() - 300;//验证码有效时间为5分钟
659
-        //if (msg.getCreatetime()<secondTimestamp) return new ResultVo(1,"验证码失效");
623
+        TMsg msg = msgMapper.findByUserPhoneAndCode(userphone, messageCode);//根据手机号和验证码获取短信信息
624
+        if (msg == null) return new ResultVo(1, "验证码有误");
625
+        int secondTimestamp = N_Utils.getSecondTimestamp() - 300;//验证码有效时间为5分钟
626
+        if (msg.getCreatetime() < secondTimestamp) return new ResultVo(1, "验证码失效");
660 627
         return null;
661 628
     }
662 629
 
@@ -743,8 +710,7 @@ public class UserService extends JedisUtil {
743 710
 
744 711
     //用户选择列表
745 712
     public List<Map> listForSel(AssessParams user) {
746
-        //Integer year = schoolMapper.getYearById(user.getSchoolid());
747
-        Integer year=2021;
713
+        Integer year = schoolMapper.getYearById(user.getSchoolid());
748 714
         return userMapper.listForSel(user, year);
749 715
     }
750 716
 

+ 0
- 26
suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/LsbBookVo.java View File

@@ -1,26 +0,0 @@
1
-package com.xhkjedu.suser.vo.subjectbook;
2
-
3
-import lombok.Data;
4
-
5
-/**
6
- * @ClassName LsbBookVo
7
- * Description 教材--册别
8
- * Author WN
9
- * Date 2020/6/3 10:17
10
- **/
11
-@Data
12
-public class LsbBookVo {
13
-
14
-    //教材id
15
-    private String lsbid;
16
-
17
-    //教材名称
18
-    private String lsbname;
19
-
20
-    //版本id
21
-    private String versionid;
22
-
23
-    //版本名称
24
-    private String versionname;
25
-
26
-}

+ 0
- 22
suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/SubjectVo.java View File

@@ -1,22 +0,0 @@
1
-package com.xhkjedu.suser.vo.subjectbook;
2
-
3
-import lombok.Data;
4
-
5
-/**
6
- * @ClassName SubjectVo
7
- * Description
8
- * Author WN
9
- * Date 2020/6/1 17:58
10
- **/
11
-@Data
12
-public class SubjectVo {
13
-    //科目id
14
-    private String subjectid;
15
-
16
-    //科目名称
17
-    private String subjectname;
18
-
19
-    //归属1平台3学校
20
-    private Integer belong;
21
-
22
-}

+ 0
- 40
suser/src/main/java/com/xhkjedu/suser/vo/subjectbook/TeacherSubjectbookVo.java View File

@@ -1,40 +0,0 @@
1
-package com.xhkjedu.suser.vo.subjectbook;
2
-
3
-import lombok.Data;
4
-
5
-/**
6
- * @author ywx
7
- * @classname TeacherSubjectbookVo
8
- * @description 
9
- * @date 2020/6/5 15:52
10
- **/
11
-@Data
12
-public class TeacherSubjectbookVo {
13
-
14
-    //教师教材关系id
15
-    private Integer tbid;
16
-
17
-    //教材关联关系表id
18
-    private String lsbid;
19
-
20
-    //是否选中:0未选中1已选中
21
-    private Integer selected;
22
-
23
-    //科目id
24
-    private String subjectid;
25
-
26
-    //科目名称
27
-    private String subjectname;
28
-
29
-    //教材名称
30
-    private String lsbname;
31
-
32
-    private String coverpath;//封面图地址
33
-
34
-    //版本id
35
-    private String versionid;
36
-
37
-    //版本名称
38
-    private String versionname;
39
-
40
-}

+ 2
- 2
suser/src/main/java/com/xhkjedu/suser/vo/system/TeacherRoleVo.java View File

@@ -1,11 +1,11 @@
1 1
 package com.xhkjedu.suser.vo.system;
2 2
 
3 3
 import com.xhkjedu.suser.vo.gradeclass.ClassVo;
4
-import com.xhkjedu.suser.vo.subjectbook.TeacherSubjectbookVo;
5 4
 import lombok.Data;
6 5
 
7 6
 import java.util.ArrayList;
8 7
 import java.util.List;
8
+import java.util.Map;
9 9
 
10 10
 /**
11 11
  * @ClassName TeacherRoleVo
@@ -19,7 +19,7 @@ public class TeacherRoleVo {
19 19
     private List<UserRoleVo> rolelist = new ArrayList<>();
20 20
 
21 21
     //教材
22
-    private List<TeacherSubjectbookVo> lsblist = new ArrayList<>();
22
+    private List<Map> lsblist = new ArrayList<>();
23 23
 
24 24
     //班级
25 25
     private List<ClassVo> classlist = new ArrayList<>();

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

@@ -35,18 +35,6 @@
35 35
         set c.classnum=a.num,g.groupnum=(SELECT COUNT(*) FROM t_group_student gs WHERE gs.groupid=g.groupid)
36 36
         where c.classid=#{classid}
37 37
     </update>
38
-    <!--要升级的班级列表-->
39
-    <select id="listClassBySchoolId" resultType="com.xhkjedu.suser.model.gradeclass.TClass">
40
-        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)
41
-    </select>
42
-    <!--升级时要毕业的班级列表-->
43
-    <select id="listClassBiyeBySchoolId" resultType="com.xhkjedu.suser.model.gradeclass.TClass">
44
-        select * from t_class where schoolid=#{schoolid} and year=#{year} and classtype in(1,2) and classstate=#{classstate} and gradeid in(6,9,12)
45
-    </select>
46
-    <!--要升级的班级id字符串-->
47
-    <select id="listClassIdBySchoolId" resultType="java.lang.String">
48
-        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)
49
-    </select>
50 38
     <!--基本信息-->
51 39
     <select id="getById" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
52 40
         select c.classid,c.classname,c.gradeid,c.classnum,tg.groupid,c.classtype,c.createid,c.schoolid,c.year
@@ -54,12 +42,6 @@
54 42
         where c.classid=#{classid} and tg.grouptype=1 limit 1
55 43
     </select>
56 44
 
57
-    <!--获取年级下行政班班级id集合-->
58
-    <select id="listClassidsByGradeid" resultType="java.lang.Integer">
59
-        select c.classid from t_class c
60
-        LEFT JOIN t_school s on c.schoolid=s.schoolid and c.year=s.year
61
-        where c.gradeid=#{gradeid} and c.schoolid=#{schoolid} and c.classtype=1 and c.classstate=1
62
-    </select>
63 45
     <!--根据班级名称获取班级信息-->
64 46
     <select id="getByName" resultType="com.xhkjedu.suser.model.gradeclass.TClass">
65 47
         select c.classid, c.classname, c.gradeid, c.classnum, c.classstate, c.classorder, c.schoolyear, c.year, c.classtype
@@ -73,26 +55,8 @@
73 55
         where ct.classid=#{classid} and u.userstate=1
74 56
     </select>
75 57
 
76
-    <!--修改班级状态-->
77
-    <update id="updateClassState">
78
-       update t_class set classstate=#{classstate} where classid in (${classids})
79
-    </update>
80 58
     <!--修改单个班级状态-->
81 59
     <update id="updateClassstateByClassid">
82 60
        update t_class set classstate=#{classstate} where classid=#{classid}
83 61
     </update>
84
-
85
-    <!--修改班级类型-->
86
-    <update id="updateClasstype">
87
-        update t_class set classtype=#{classtype} where classid=#{classid}
88
-    </update>
89
-    <!--获取班级当前年份-->
90
-    <select id="getYearById" resultType="java.lang.Integer">
91
-        select year from t_class where classid=#{classid}
92
-    </select>
93
-    <!--根据班级名称获取班级id-->
94
-    <select id="getClassIdByName" resultType="java.lang.Integer">
95
-        select c.classid from t_class c where c.schoolid=#{schoolid} and c.gradeid=#{gradeid} and c.classtype=1 and
96
-        c.classstate=1 and c.classname=#{classname} and c.year=#{year}
97
-    </select>
98 62
 </mapper>

+ 0
- 25
suser/src/main/resources/mapper/gradeclass/ClassStudentMapper.xml View File

@@ -45,10 +45,6 @@
45 45
         from t_class_student cs left join t_class c on cs.classid=c.classid
46 46
         where cs.studentid=#{studentid} and c.classtype=1 and c.classstate=1 limit 1
47 47
     </select>
48
-    <!--获取要升级的学生列表-->
49
-    <select id="listStudentByClassIds" resultType="com.xhkjedu.suser.model.gradeclass.TClassStudent">
50
-        select * from t_class_student where classid in(${classIds}) order by classid;
51
-    </select>
52 48
     <!--根据班级id和学生id获取班级学生信息-->
53 49
     <select id="getByClassIdStudentId" resultType="com.xhkjedu.suser.model.gradeclass.TClassStudent">
54 50
         select * from t_class_student where classid=#{classid} and studentid=#{studentid} limit 1
@@ -117,27 +113,6 @@
117 113
         insert ignore into t_class_student (classid,studentid,createid,createtime,schoolid)
118 114
         values (#{student.classid},#{student.studentid},#{student.createid},#{student.createtime},#{student.schoolid})
119 115
     </insert>
120
-    <!--学生所在行政班-->
121
-    <select id="getClassByStuId" resultType="com.xhkjedu.suser.vo.gradeclass.ClassVo">
122
-        select c.gradeid,c.classname from t_class_student cs left join t_class c on cs.classid=c.classid
123
-        left join t_school s on c.schoolid=s.schoolid
124
-        where cs.studentid=#{studentid} and c.year=s.year and c.classtype=1 and c.classstate=1 limit 1
125
-    </select>
126
-    <!--学生列表-->
127
-    <select id="listStu" resultType="com.xhkjedu.suser.vo.paper.AStudentPaperVo">
128
-        select cs.studentid,u.username studentname,u.loginname,c.gradeid,c.classname
129
-        from t_class_student cs left join t_class c on cs.classid=c.classid
130
-        left join t_user u on cs.studentid=u.userid
131
-        where c.schoolid=#{paper.schoolid} and c.gradeid=#{paper.gradeid} and c.year=#{paper.year}
132
-        and c.classtype=1 and u.userstate=1
133
-        <if test="paper.classid!=0">
134
-            and cs.classid=#{paper.classid}
135
-        </if>
136
-        <if test="paper.classids!=null and paper.classids!=''">
137
-            and cs.classid in (${paper.classids})
138
-        </if>
139
-        group by cs.studentid
140
-    </select>
141 116
     <!--获取学生所有提高班-->
142 117
     <select id="listTgClassid" resultType="java.lang.Integer">
143 118
         SELECT c.classid FROM t_class_student cs LEFT JOIN t_class c ON cs.classid=c.classid

+ 0
- 16
suser/src/main/resources/mapper/gradeclass/ClassTeacherMapper.xml View File

@@ -48,10 +48,6 @@
48 48
         and c.classtype in(1,2)
49 49
         order by c.gradeid,c.classtype,c.classorder
50 50
     </select>
51
-    <!--要升级的教师列表-->
52
-    <select id="listTeacherByClassIds" resultType="com.xhkjedu.suser.model.gradeclass.TClassTeacher">
53
-        select * from t_class_teacher where classid in(${classIds}) order by classid;
54
-    </select>
55 51
     <!--前年份教师任教分组学生-->
56 52
     <resultMap id="teacherClass" type="java.util.Map">
57 53
         <result property="classid" column="classid"></result>
@@ -157,14 +153,6 @@
157 153
         and c.classtype in(1,2)
158 154
         order by c.gradeid,c.classtype,c.classorder
159 155
     </select>
160
-    <!--获取教师任教行政和提高班id-->
161
-    <select id="getClassIds" resultType="java.lang.String">
162
-        select group_concat(distinct c.classid)
163
-        from t_class_teacher ct left join  t_class c on ct.classid=c.classid
164
-        left join t_school s on ct.schoolid=s.schoolid
165
-        where ct.teacherid=#{teacherid} and c.year=s.year and c.classstate=1
166
-        and c.classtype in(1,2)
167
-    </select>
168 156
 
169 157
     <!--获取学校年级下教师-->
170 158
     <select id="listTeachersByGradeid" resultType="com.xhkjedu.suser.vo.gradeclass.ClassTeacherVo">
@@ -186,10 +174,6 @@
186 174
     and sb.subjectid=#{ctp.subjectid} and u.usertype=1 and u.userstate=1
187 175
     group by ct.teacherid
188 176
     </select>
189
-    <!--删除班级下所有教师-->
190
-    <delete id="deleteByClassId">
191
-        delete from t_class_teacher where classid=#{classid}
192
-    </delete>
193 177
 
194 178
 
195 179
 

+ 0
- 8
suser/src/main/resources/mapper/gradeclass/GroupMapper.xml View File

@@ -51,16 +51,8 @@
51 51
         order by c.gradeid,c.classtype,c.classorder,g.grouptype asc, g.groupid desc
52 52
     </select>
53 53
 
54
-    <!--分组以及分组下所有学生id-->
55
-    <select id="listStudentidsByGroupids" resultType="java.lang.Integer">
56
-        SELECT DISTINCT studentid FROM t_group_student  WHERE groupid IN (${groupids})
57
-    </select>
58 54
     <!--获取班级的全体分组-->
59 55
     <select id="findByClassId" resultType="com.xhkjedu.suser.model.gradeclass.TGroup">
60 56
         select g.* from t_group g where g.classid=#{classid} and g.grouptype=1
61 57
     </select>
62
-    <!--要升级的全体分组列表-->
63
-    <select id="listStudentByClassIds" resultType="com.xhkjedu.suser.model.gradeclass.TGroup">
64
-        select g.* from t_group g where g.classid in(${classIds}) and g.grouptype=1 order by classid
65
-    </select>
66 58
 </mapper>

+ 0
- 4
suser/src/main/resources/mapper/gradeclass/GroupStudentMapper.xml View File

@@ -8,10 +8,6 @@
8 8
         where gs.groupid=#{groupid}
9 9
         order by convert(tu.username using gbk)
10 10
     </select>
11
-    <!--获取要升级的学生列表-->
12
-    <select id="listStudentByGroupIds" resultType="com.xhkjedu.suser.model.gradeclass.TGroupStudent">
13
-        select * from t_group_student where groupid in(${groupIds}) order by groupid;
14
-    </select>
15 11
     <!--删除分组学生-->
16 12
     <delete id="deleteByGroupId">
17 13
         delete from t_group_student where groupid=#{groupid}

+ 4
- 0
suser/src/main/resources/mapper/gradeclass/SchoolMapper.xml View File

@@ -10,4 +10,8 @@
10 10
         select s.year from t_user u left join t_school s on u.schoolid=s.schoolid
11 11
         where u.userid=#{userid}
12 12
     </select>
13
+    <!--获取学校账号数量-->
14
+    <select id="getUserNumById" resultType="java.lang.Integer">
15
+        select usernum from t_school where schoolid=#{schoolid}
16
+    </select>
13 17
 </mapper>

+ 16
- 0
suser/src/main/resources/mapper/liveplay/CourseMapper.xml View File

@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.suser.mapper.liveplay.CourseMapper">
4
+    <!--更新已报学生数量-->
5
+    <update id="updateStuNum">
6
+        update l_course c set c.stunum=(select tc.classnum from t_class tc where tc.classid=c.classid)
7
+        where c.courseid=#{courseid}
8
+    </update>
9
+    <!--行政班的所有直播课-->
10
+    <select id="listXzCourse" resultType="java.util.Map">
11
+        select c.courseid,c.classid,c.createid,c.schoolid
12
+        from l_course c left join l_course_class cc on cc.courseid=c.courseid
13
+        where c.coursetype=1 and cc.classid=#{classid}
14
+        group by c.courseid
15
+    </select>
16
+</mapper>

+ 33
- 0
suser/src/main/resources/mapper/subjectbook/TeacherPowersbMapper.xml View File

@@ -0,0 +1,33 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.suser.mapper.subjectbook.TeacherPowersbMapper">
4
+    <!-- 根据用户id删除用户教材 -->
5
+    <delete id="deleteByUserid">
6
+        delete from t_teacher_powersb where teacherid=#{userid}
7
+    </delete>
8
+    <!-- 用户id获取教材集合 -->
9
+    <select id="listLsbsByUserid" resultType="java.util.Map">
10
+        SELECT tsb.lsbid,sb.subjectid,s.subjectname,sb.lsbname,sb.coverpath,sb.versionid,v.versionname
11
+        FROM t_teacher_powersb tsb LEFT JOIN t_subject_book sb ON tsb.lsbid=sb.lsbid
12
+        LEFT JOIN t_subject s ON sb.subjectid=s.subjectid
13
+        LEFT JOIN t_version v ON sb.versionid=v.versionid
14
+        WHERE tsb.teacherid=#{userid} and (sb.belong=1 or sb.schoolid=tsb.schoolid)
15
+        ORDER BY s.subjectorder,v.versionorder,sb.lsborder
16
+    </select>
17
+    <!--教师权限科目-->
18
+    <select id="listSubject" resultType="java.util.Map">
19
+        SELECT sb.subjectid,s.subjectname,s.level
20
+        FROM t_teacher_powersb tsb LEFT JOIN t_subject_book sb ON tsb.lsbid=sb.lsbid
21
+        LEFT JOIN t_subject s ON sb.subjectid=s.subjectid
22
+        WHERE tsb.teacherid=#{teacherid} and (sb.belong=1 or sb.schoolid=tsb.schoolid)
23
+        GROUP BY s.subjectid ORDER BY s.subjectorder
24
+    </select>
25
+
26
+    <select id="listBookBySubjectid" resultType="java.util.Map">
27
+        SELECT tsb.lsbid,sb.lsbname,sb.versionid,v.versionname
28
+         FROM t_teacher_powersb tsb LEFT JOIN t_subject_book sb ON tsb.lsbid=sb.lsbid
29
+         LEFT JOIN t_version v ON sb.versionid=v.versionid
30
+         WHERE tsb.teacherid=#{teacherid} AND sb.subjectid=#{subjectid} and (sb.belong=1 or sb.schoolid=tsb.schoolid)
31
+         GROUP BY sb.lsbid ORDER BY v.versionorder,sb.lsborder
32
+    </select>
33
+</mapper>

+ 17
- 0
suser/src/main/resources/mapper/subjectbook/TeacherSubjectBookMapper.xml View File

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.suser.mapper.subjectbook.TeacherSubjectbookMapper">
4
+    <!-- 用户id获取教材集合 -->
5
+    <select id="listLsbsByUserid" resultType="java.lang.String">
6
+        SELECT lsbid FROM t_teacher_subjectbook WHERE teacherid=#{userid}
7
+    </select>
8
+    <!--删除教师收藏教材-->
9
+    <delete id="deleteByLsbIdTeacherId">
10
+        delete from t_teacher_subjectbook
11
+        where teacherid=#{teacherid} and (
12
+        <foreach collection="lsbids" item="lsbid" separator="or">
13
+            lsbid=#{lsbid}
14
+        </foreach>
15
+        )
16
+    </delete>
17
+</mapper>

+ 13
- 0
suser/src/main/resources/mapper/system/MsgMapper.xml View File

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.suser.mapper.system.MsgMapper">
4
+    <!-- 5分钟内发送短信次数 -->
5
+    <select id="getMsgNumByUserPhone" resultType="java.lang.Integer">
6
+        select count(*) from t_msg where userphone=#{userphone} and createtime>=UNIX_TIMESTAMP(now())-300
7
+    </select>
8
+    <!--根据手机号和验证码获取短信信息-->
9
+    <select id="findByUserPhoneAndCode" resultType="com.xhkjedu.suser.model.system.TMsg">
10
+        select msgid,msgtxt,msgcode,userphone,createtime
11
+        from t_msg where userphone=#{userphone} and msgcode=#{msgcode} limit 1
12
+    </select>
13
+</mapper>

+ 2
- 43
suser/src/main/resources/mapper/system/UserMapper.xml View File

@@ -70,13 +70,6 @@
70 70
     <select id="getObjByLoginName" resultType="com.xhkjedu.suser.model.system.TUser">
71 71
         select u.* from t_user u where u.loginname=#{loginname} limit 1
72 72
     </select>
73
-    <!--根据登录名获取学生id和行政和提高班班级id-->
74
-    <select id="getObjByLoginName2" resultType="com.xhkjedu.suser.model.system.TUser">
75
-        select u.userid,u.usertype,u.userstate,u.schoolid,group_concat(distinct c.classid) ultype
76
-        from t_user u left join t_class_student cs on u.userid=cs.studentid
77
-        left join t_class c on cs.classid=c.classid and c.classtype in(1,2) and c.classstate=1
78
-        where u.loginname=#{loginname} limit 1
79
-    </select>
80 73
     <!--修改用户状态-->
81 74
     <update id="updateState">
82 75
         update t_user set userstate=#{userstate} where userid=#{userid}
@@ -135,10 +128,6 @@
135 128
     <update id="updateBindMac">
136 129
         update t_user set bindmac=#{user.bindmac},mac=#{user.mac} where userid=#{user.userid}
137 130
     </update>
138
-    <!--删除学生绑定信息-->
139
-    <update id="delBindmac">
140
-        update t_user set bindmac=0,mac=null where schoolid=#{schoolid}
141
-    </update>
142 131
     <!--通过短信修改密码-->
143 132
     <update id="updatePwdByCode">
144 133
         update t_user set loginpwd=#{user.loginpwd} where userphone=#{user.userphone}
@@ -153,25 +142,6 @@
153 142
         )
154 143
     </update>
155 144
 
156
-    <!--根据用户id获取用户姓名-->
157
-    <select id="getUserNameById" resultType="java.lang.String">
158
-        select username from t_user where userid=#{userid}
159
-    </select>
160
-
161
-    <!--批量修改用户状态-->
162
-    <update id="batchUpdateState">
163
-        update t_user set userstate=#{userstate} where
164
-        <foreach collection="users" item="user" index="index" separator="or">
165
-            userid=${user.studentid}
166
-        </foreach>
167
-    </update>
168
-
169
-    <!--获取学校管理员-->
170
-    <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.suser.vo.system.UserVo">
171
-        select userid,username,loginname,loginpwd from t_user where schoolid=#{schoolid}
172
-        and usertype=0 and userstate=1 order by userid limit 1
173
-    </select>
174
-
175 145
     <!--获取学校账号数量-->
176 146
     <select id="getUserNumBySchoolId" resultType="java.lang.Integer">
177 147
         select count(*) from t_user where schoolid=#{schoolid} and userstate=1
@@ -192,12 +162,8 @@
192 162
         group by u.userid
193 163
         order by convert(u.username using gbk)
194 164
     </select>
195
-    <!--根据班级id用户名获取学生id和数量-->
196
-    <select id="getUserIdByName" resultType="java.util.Map">
197
-        select u.userid,count(distinct u.userid)num
198
-        from t_user u left join t_class_student cs on u.userid=cs.studentid
199
-        where u.schoolid=#{schoolid} and u.userstate=1 and u.username=#{username} and cs.classid=#{classid}
200
-    </select>
165
+
166
+
201 167
     <!--根据班级科目id用户名获取教师id和数量-->
202 168
     <select id="getUserIdByName2" resultType="java.util.Map">
203 169
         select u.userid,count(distinct u.userid)num
@@ -212,11 +178,4 @@
212 178
     <select id="getUsertypeById" resultType="java.lang.Integer">
213 179
         select usertype from t_user where userid=#{userid}
214 180
     </select>
215
-    <!--添加登录日志-->
216
-    <insert id="saveUserLog">
217
-        INSERT INTO t_user_log (userid, username, loginname, loginstate, logtime
218
-        , logip, logaddress, ultype, versionnum, logtxt, schoolid) VALUES
219
-        (#{log.userid},#{log.username},#{log.loginname},#{log.loginstate},#{log.logtime}
220
-        ,#{log.logip},#{log.logaddress},#{log.ultype},#{log.versionnum},#{log.logtxt},#{log.schoolid});
221
-    </insert>
222 181
 </mapper>

+ 11
- 0
suser/src/main/resources/mapper/system/UserModuleMapper.xml View File

@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.suser.mapper.system.UserModuleMapper">
4
+    <!--根据用户id删除没有权限的常用模块-->
5
+    <delete id="deleteNoRoleByUserId">
6
+        DELETE FROM t_user_module WHERE userid=#{userid} AND moduleid
7
+        NOT IN(SELECT rm.moduleid FROM t_user u LEFT JOIN t_user_role ur ON u.userid=ur.userid
8
+        LEFT JOIN t_role_module rm ON ur.roleid=rm.roleid
9
+        WHERE u.userid=#{userid} GROUP BY rm.moduleid)
10
+    </delete>
11
+</mapper>

Loading…
Cancel
Save