Commit b5bd5e3f3c4ff6cf1d165f7e8f3c41c630ece1f2

Authored by 504987307@qq.com
1 parent dd63aaa5
Exists in master

用户信息接口 添加数据

cloud/user_search/src/main/java/com/sincere/userSearch/mapper/UserMapper.java
1 package com.sincere.userSearch.mapper; 1 package com.sincere.userSearch.mapper;
2 2
3 import com.sincere.userSearch.model.StudentInfo; 3 import com.sincere.userSearch.model.StudentInfo;
  4 +import com.sincere.userSearch.model.TeacherGroup;
4 import com.sincere.userSearch.model.TeacherInfo; 5 import com.sincere.userSearch.model.TeacherInfo;
5 6
6 import java.util.List; 7 import java.util.List;
@@ -14,4 +15,6 @@ public interface UserMapper { @@ -14,4 +15,6 @@ public interface UserMapper {
14 StudentInfo selectParentInfo(int studentId) ; 15 StudentInfo selectParentInfo(int studentId) ;
15 16
16 List<String> selectChildrenId(String userId) ; 17 List<String> selectChildrenId(String userId) ;
  18 +
  19 + List<TeacherGroup> selectTeacherGroup(int teacherId);
17 } 20 }
cloud/user_search/src/main/java/com/sincere/userSearch/model/TeacherGroup.java 0 → 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +package com.sincere.userSearch.model;
  2 +
  3 +public class TeacherGroup {
  4 +
  5 + private int num ;
  6 + private String groupName ;
  7 +
  8 + public int getNum() {
  9 + return num;
  10 + }
  11 +
  12 + public void setNum(int num) {
  13 + this.num = num;
  14 + }
  15 +
  16 + public String getGroupName() {
  17 + return groupName;
  18 + }
  19 +
  20 + public void setGroupName(String groupName) {
  21 + this.groupName = groupName;
  22 + }
  23 +}
cloud/user_search/src/main/java/com/sincere/userSearch/model/TeacherInfo.java
@@ -5,14 +5,26 @@ import java.util.List; @@ -5,14 +5,26 @@ import java.util.List;
5 public class TeacherInfo { 5 public class TeacherInfo {
6 6
7 private String userId ; 7 private String userId ;
  8 + private int sex ;
8 private String userName ; 9 private String userName ;
9 private String mobile ; 10 private String mobile ;
10 private int schoolId ; 11 private int schoolId ;
11 private String schoolName ; 12 private String schoolName ;
12 private String face ; 13 private String face ;
13 private String pass ; 14 private String pass ;
  15 + private List<Integer> userTypes ;
  16 + private String teacherNum ;
  17 + private List<String> groups ;
14 private List<TeacherClassInfo> classInfos ; 18 private List<TeacherClassInfo> classInfos ;
15 19
  20 + public int getSex() {
  21 + return sex;
  22 + }
  23 +
  24 + public void setSex(int sex) {
  25 + this.sex = sex;
  26 + }
  27 +
16 public String getUserId() { 28 public String getUserId() {
17 return userId; 29 return userId;
18 } 30 }
@@ -76,4 +88,28 @@ public class TeacherInfo { @@ -76,4 +88,28 @@ public class TeacherInfo {
76 public void setPass(String pass) { 88 public void setPass(String pass) {
77 this.pass = pass; 89 this.pass = pass;
78 } 90 }
  91 +
  92 + public List<Integer> getUserTypes() {
  93 + return userTypes;
  94 + }
  95 +
  96 + public void setUserTypes(List<Integer> userTypes) {
  97 + this.userTypes = userTypes;
  98 + }
  99 +
  100 + public String getTeacherNum() {
  101 + return teacherNum;
  102 + }
  103 +
  104 + public void setTeacherNum(String teacherNum) {
  105 + this.teacherNum = teacherNum;
  106 + }
  107 +
  108 + public List<String> getGroups() {
  109 + return groups;
  110 + }
  111 +
  112 + public void setGroups(List<String> groups) {
  113 + this.groups = groups;
  114 + }
79 } 115 }
cloud/user_search/src/main/java/com/sincere/userSearch/service/impl/UserServiceImpl.java
@@ -4,10 +4,12 @@ import com.sincere.userSearch.mapper.QyhApplyMapper; @@ -4,10 +4,12 @@ import com.sincere.userSearch.mapper.QyhApplyMapper;
4 import com.sincere.userSearch.mapper.UserMapper; 4 import com.sincere.userSearch.mapper.UserMapper;
5 import com.sincere.userSearch.model.StudentInfo; 5 import com.sincere.userSearch.model.StudentInfo;
6 import com.sincere.userSearch.model.TeacherClassInfo; 6 import com.sincere.userSearch.model.TeacherClassInfo;
  7 +import com.sincere.userSearch.model.TeacherGroup;
7 import com.sincere.userSearch.model.TeacherInfo; 8 import com.sincere.userSearch.model.TeacherInfo;
8 import com.sincere.userSearch.service.UserService; 9 import com.sincere.userSearch.service.UserService;
9 import com.sincere.userSearch.vo.rep.ZnxwRepVo; 10 import com.sincere.userSearch.vo.rep.ZnxwRepVo;
10 import com.sincere.userSearch.vo.req.ZnxwReqVo; 11 import com.sincere.userSearch.vo.req.ZnxwReqVo;
  12 +import io.swagger.models.auth.In;
11 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
13 15
@@ -38,6 +40,26 @@ public class UserServiceImpl implements UserService { @@ -38,6 +40,26 @@ public class UserServiceImpl implements UserService {
38 teacherClassInfos.add(classInfo); 40 teacherClassInfos.add(classInfo);
39 } 41 }
40 } 42 }
  43 + List<Integer> userTypes = new ArrayList<>();
  44 + for(TeacherClassInfo info : teacherClassInfos){
  45 + if(!userTypes.contains(info.getUserType())){
  46 + userTypes.add(info.getUserType());
  47 + }
  48 + }
  49 + teacherInfo.setUserTypes(userTypes);
  50 + try {
  51 + List<TeacherGroup> list = userMapper.selectTeacherGroup(teacherInfo.getClassInfos().get(0).getTeacherId());
  52 + if(list != null && list.size() > 0){
  53 + teacherInfo.setTeacherNum(list.get(0).getNum()+"");
  54 + List<String> groups = new ArrayList<>();
  55 + for(TeacherGroup group : list){
  56 + groups.add(group.getGroupName());
  57 + }
  58 + teacherInfo.setGroups(groups);
  59 + }
  60 + }catch (Exception e){
  61 +
  62 + }
41 teacherInfo.setClassInfos(teacherClassInfos); 63 teacherInfo.setClassInfos(teacherClassInfos);
42 } 64 }
43 return teacherInfos ; 65 return teacherInfos ;
cloud/user_search/src/main/resources/mapper/UserMapper.xml
@@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
4 4
5 <resultMap id="TeacherInfo" type="com.sincere.userSearch.model.TeacherInfo"> 5 <resultMap id="TeacherInfo" type="com.sincere.userSearch.model.TeacherInfo">
6 <result column="user_id" property="userId"/> 6 <result column="user_id" property="userId"/>
  7 + <result column="sex" property="sex"/>
7 <result column="name" property="userName"/> 8 <result column="name" property="userName"/>
8 <result column="mobile" property="mobile"/> 9 <result column="mobile" property="mobile"/>
9 <result column="face" property="face"/> 10 <result column="face" property="face"/>
@@ -22,7 +23,7 @@ @@ -22,7 +23,7 @@
22 </collection> 23 </collection>
23 </resultMap> 24 </resultMap>
24 <select id="selectTeacherInfo" parameterType="java.lang.String" resultMap="TeacherInfo"> 25 <select id="selectTeacherInfo" parameterType="java.lang.String" resultMap="TeacherInfo">
25 - SELECT u.user_id , u.name , u.mobile , u.face , u.pass, s.school_id AS schoolid, s.numType, s.school_name AS schoolname,s.school_area as schoolArea, 26 + SELECT u.user_id , u.name , u.sex , u.mobile , u.face , u.pass, s.school_id AS schoolid, s.numType, s.school_name AS schoolname,s.school_area as schoolArea,
26 c.class_id AS classid, c.class_name AS classname, 27 c.class_id AS classid, c.class_name AS classname,
27 sj.subject_id AS subjectid, sj.subject_name AS subjectname, sj.subId as SysSubjectId, 28 sj.subject_id AS subjectid, sj.subject_name AS subjectname, sj.subId as SysSubjectId,
28 ur.usertype, ur.customerId AS TeacherId,c.grade AS grade,(SELECT grade FROM dbo.SZ_Grade WHERE id=c.grade) gradename 29 ur.usertype, ur.customerId AS TeacherId,c.grade AS grade,(SELECT grade FROM dbo.SZ_Grade WHERE id=c.grade) gradename
@@ -34,6 +35,21 @@ @@ -34,6 +35,21 @@
34 WHERE ur.usertype not in (2,3,33,34) AND ur.state=1 AND ur.user_id=#{userId} order by ur.class_id desc 35 WHERE ur.usertype not in (2,3,33,34) AND ur.state=1 AND ur.user_id=#{userId} order by ur.class_id desc
35 </select> 36 </select>
36 37
  38 + <resultMap id="TeacherGroup" type="com.sincere.userSearch.model.TeacherGroup">
  39 + <result column="num" property="num"/>
  40 + <result column="group_name" property="groupName"/>
  41 + </resultMap>
  42 + <select id="selectTeacherGroup" parameterType="java.lang.Integer" resultMap="TeacherGroup">
  43 + SELECT
  44 + SZ_Teacher.num ,
  45 + SZ_TeaGroup.group_name
  46 + FROM
  47 + SZ_Teacher
  48 + JOIN SZ_Teacher_Group ON SZ_Teacher.teacher_id = SZ_Teacher_Group.teacher_id
  49 + join SZ_TeaGroup on SZ_Teacher_Group.group_id = SZ_TeaGroup.group_id
  50 + WHERE
  51 + SZ_Teacher.teacher_id = ${teacherId}
  52 + </select>
37 53
38 <resultMap id="StudentInfo" type="com.sincere.userSearch.model.StudentInfo"> 54 <resultMap id="StudentInfo" type="com.sincere.userSearch.model.StudentInfo">
39 <result column="user_id" property="userId"/> 55 <result column="user_id" property="userId"/>