Commit cd21c8416be4f7efeb5e03ab12f7befd332382f7
1 parent
e5d1fbed
Exists in
master
用户信息接口
Showing
12 changed files
with
530 additions
and
18 deletions
Show diff stats
cloud/autho/src/main/resources/mapper/UserMapper.xml
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | </select> | 8 | </select> |
9 | 9 | ||
10 | <select id="loginStudent" parameterType="com.sincere.autho.dto.req.LoginReqDto" resultType="java.lang.String"> | 10 | <select id="loginStudent" parameterType="com.sincere.autho.dto.req.LoginReqDto" resultType="java.lang.String"> |
11 | - select user_id from SZ_User where othername = #{account} and pass = #{password} | 11 | + select user_id from SZ_User where name = #{account} and pass = #{password} |
12 | </select> | 12 | </select> |
13 | 13 | ||
14 | </mapper> | 14 | </mapper> |
cloud/user_search/src/main/java/com/sincere/userSearch/Swagger2.java
@@ -36,7 +36,7 @@ public class Swagger2 { | @@ -36,7 +36,7 @@ public class Swagger2 { | ||
36 | .enableUrlTemplating(true) | 36 | .enableUrlTemplating(true) |
37 | .select() | 37 | .select() |
38 | // 扫描所有有注解的api,用这种方式更灵活 | 38 | // 扫描所有有注解的api,用这种方式更灵活 |
39 | - .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) | 39 | + .apis(RequestHandlerSelectors.basePackage("com.sincere.userSearch.control")) |
40 | .paths(PathSelectors.any()) | 40 | .paths(PathSelectors.any()) |
41 | .build().globalOperationParameters(pars); | 41 | .build().globalOperationParameters(pars); |
42 | 42 |
cloud/user_search/src/main/java/com/sincere/userSearch/controller/UserController.java
1 | package com.sincere.userSearch.controller; | 1 | package com.sincere.userSearch.controller; |
2 | 2 | ||
3 | +import com.sincere.common.exception.ResultException; | ||
4 | +import com.sincere.common.util.TokenUtils; | ||
5 | +import com.sincere.userSearch.model.StudentInfo; | ||
3 | import com.sincere.userSearch.service.UserService; | 6 | import com.sincere.userSearch.service.UserService; |
4 | import com.sincere.userSearch.vo.BaseVo; | 7 | import com.sincere.userSearch.vo.BaseVo; |
5 | import com.sincere.userSearch.vo.UserInfo; | 8 | import com.sincere.userSearch.vo.UserInfo; |
9 | +import com.sincere.userSearch.vo.rep.Info; | ||
6 | import com.sincere.userSearch.vo.rep.ZnxwRepVo; | 10 | import com.sincere.userSearch.vo.rep.ZnxwRepVo; |
11 | +import com.sincere.userSearch.vo.req.UserInfoReqVo; | ||
7 | import com.sincere.userSearch.vo.req.ZnxwReqVo; | 12 | import com.sincere.userSearch.vo.req.ZnxwReqVo; |
8 | import io.swagger.annotations.Api; | 13 | import io.swagger.annotations.Api; |
9 | import io.swagger.annotations.ApiOperation; | 14 | import io.swagger.annotations.ApiOperation; |
10 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.web.bind.annotation.*; | 16 | import org.springframework.web.bind.annotation.*; |
12 | 17 | ||
18 | +import javax.servlet.http.HttpServletRequest; | ||
19 | +import java.util.ArrayList; | ||
20 | +import java.util.List; | ||
21 | + | ||
13 | @RestController | 22 | @RestController |
14 | @RequestMapping("/user") | 23 | @RequestMapping("/user") |
15 | @Api(value = "用户中心") | 24 | @Api(value = "用户中心") |
@@ -23,28 +32,47 @@ public class UserController { | @@ -23,28 +32,47 @@ public class UserController { | ||
23 | */ | 32 | */ |
24 | @ApiOperation("获取智能校卫agentid") | 33 | @ApiOperation("获取智能校卫agentid") |
25 | @RequestMapping(value = "getZNXWWebApp" , method = RequestMethod.POST) | 34 | @RequestMapping(value = "getZNXWWebApp" , method = RequestMethod.POST) |
26 | - public BaseVo<ZnxwRepVo> getZNXWWebApp(@RequestBody ZnxwReqVo znxwReqVo , UserInfo userInfo){ | 35 | + public BaseVo<ZnxwRepVo> getZNXWWebApp(@RequestBody ZnxwReqVo znxwReqVo){ |
27 | BaseVo<ZnxwRepVo> result = new BaseVo<>() ; | 36 | BaseVo<ZnxwRepVo> result = new BaseVo<>() ; |
28 | ZnxwRepVo data = userService.selectAgentId(znxwReqVo) ; | 37 | ZnxwRepVo data = userService.selectAgentId(znxwReqVo) ; |
29 | result.setData(data); | 38 | result.setData(data); |
30 | return result ; | 39 | return result ; |
31 | } | 40 | } |
32 | 41 | ||
33 | - | ||
34 | - public void getUserRole(){ | ||
35 | - | ||
36 | - } | ||
37 | - | ||
38 | /** | 42 | /** |
39 | * 用户类型 0-班主任; 1-任课老师; 2-学生; 3-家长; 10-学校管理员; | 43 | * 用户类型 0-班主任; 1-任课老师; 2-学生; 3-家长; 10-学校管理员; |
40 | */ | 44 | */ |
41 | @ApiOperation("根据userId 获取用户信息") | 45 | @ApiOperation("根据userId 获取用户信息") |
42 | - @RequestMapping(value = "getUserInfo" , method = RequestMethod.GET) | ||
43 | - public String getUserInfo(UserInfo userInfo){ | ||
44 | - return userInfo.getUserId() ; | 46 | + @RequestMapping(value = "getUserInfo" , method = RequestMethod.POST) |
47 | + public BaseVo<Info> getUserInfo(@RequestBody UserInfoReqVo userInfoReqVo , HttpServletRequest request){ | ||
48 | + String userId = getToken(request) ; | ||
49 | + BaseVo<Info> result = new BaseVo<>() ; | ||
50 | + Info info = new Info() ; | ||
51 | + if(userInfoReqVo.getUserType() == 2){ | ||
52 | + //学生 | ||
53 | + List<StudentInfo> studentInfos = new ArrayList<>(); | ||
54 | + studentInfos.add(userService.selectStudentInfo(userId)); | ||
55 | + info.setStudentInfos(studentInfos); | ||
56 | + }else if(userInfoReqVo.getUserType() == 3){ | ||
57 | + //家长 | ||
58 | + info.setParentInfos(userService.selectParentInfo(userId)); | ||
59 | + }else { | ||
60 | + //教师 | ||
61 | + info.setTeacherInfos(userService.selectTeacherInfo(userId)); | ||
62 | + } | ||
63 | + result.setData(info); | ||
64 | + return result ; | ||
45 | } | 65 | } |
46 | 66 | ||
47 | - public void getUserId(){ | ||
48 | 67 | ||
68 | + private String getToken(HttpServletRequest request){ | ||
69 | + String token = request.getHeader("X-Authorization"); | ||
70 | + try{ | ||
71 | + String userId = TokenUtils.validToken(token) ; | ||
72 | + return userId ; | ||
73 | + }catch (ResultException e){ | ||
74 | + System.out.println(e.getMessage()); | ||
75 | + } | ||
76 | + return null ; | ||
49 | } | 77 | } |
50 | } | 78 | } |
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; | ||
4 | +import com.sincere.userSearch.model.TeacherInfo; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
3 | public interface UserMapper { | 8 | public interface UserMapper { |
9 | + | ||
10 | + List<TeacherInfo> selectTeacherInfo(String userId) ; | ||
11 | + | ||
12 | + StudentInfo selectStudentInfo(String userId) ; | ||
13 | + | ||
14 | + StudentInfo selectParentInfo(int studentId) ; | ||
15 | + | ||
16 | + List<String> selectChildrenId(String userId) ; | ||
4 | } | 17 | } |
cloud/user_search/src/main/java/com/sincere/userSearch/model/StudentInfo.java
0 → 100644
@@ -0,0 +1,141 @@ | @@ -0,0 +1,141 @@ | ||
1 | +package com.sincere.userSearch.model; | ||
2 | + | ||
3 | +public class StudentInfo { | ||
4 | + | ||
5 | + private String userId ; | ||
6 | + private int studentId ; | ||
7 | + private String studentName ; | ||
8 | + private int schoolId ; | ||
9 | + private String schoolName ; | ||
10 | + private String face ; | ||
11 | + private String pass ; | ||
12 | + private String otherName ; | ||
13 | + private String studentCode ; | ||
14 | + private int classId ; | ||
15 | + private String className ; | ||
16 | + | ||
17 | + private String parentUserId ; | ||
18 | + private String parentMobile ; | ||
19 | + private String parentPass ; | ||
20 | + private String parentName ; | ||
21 | + | ||
22 | + public String getUserId() { | ||
23 | + return userId; | ||
24 | + } | ||
25 | + | ||
26 | + public void setUserId(String userId) { | ||
27 | + this.userId = userId; | ||
28 | + } | ||
29 | + | ||
30 | + public int getStudentId() { | ||
31 | + return studentId; | ||
32 | + } | ||
33 | + | ||
34 | + public void setStudentId(int studentId) { | ||
35 | + this.studentId = studentId; | ||
36 | + } | ||
37 | + | ||
38 | + public String getStudentName() { | ||
39 | + return studentName; | ||
40 | + } | ||
41 | + | ||
42 | + public void setStudentName(String studentName) { | ||
43 | + this.studentName = studentName; | ||
44 | + } | ||
45 | + | ||
46 | + public int getSchoolId() { | ||
47 | + return schoolId; | ||
48 | + } | ||
49 | + | ||
50 | + public void setSchoolId(int schoolId) { | ||
51 | + this.schoolId = schoolId; | ||
52 | + } | ||
53 | + | ||
54 | + public String getSchoolName() { | ||
55 | + return schoolName; | ||
56 | + } | ||
57 | + | ||
58 | + public void setSchoolName(String schoolName) { | ||
59 | + this.schoolName = schoolName; | ||
60 | + } | ||
61 | + | ||
62 | + public String getFace() { | ||
63 | + return face; | ||
64 | + } | ||
65 | + | ||
66 | + public void setFace(String face) { | ||
67 | + this.face = face; | ||
68 | + } | ||
69 | + | ||
70 | + public String getPass() { | ||
71 | + return pass; | ||
72 | + } | ||
73 | + | ||
74 | + public void setPass(String pass) { | ||
75 | + this.pass = pass; | ||
76 | + } | ||
77 | + | ||
78 | + public String getOtherName() { | ||
79 | + return otherName; | ||
80 | + } | ||
81 | + | ||
82 | + public void setOtherName(String otherName) { | ||
83 | + this.otherName = otherName; | ||
84 | + } | ||
85 | + | ||
86 | + public String getStudentCode() { | ||
87 | + return studentCode; | ||
88 | + } | ||
89 | + | ||
90 | + public void setStudentCode(String studentCode) { | ||
91 | + this.studentCode = studentCode; | ||
92 | + } | ||
93 | + | ||
94 | + public int getClassId() { | ||
95 | + return classId; | ||
96 | + } | ||
97 | + | ||
98 | + public void setClassId(int classId) { | ||
99 | + this.classId = classId; | ||
100 | + } | ||
101 | + | ||
102 | + public String getClassName() { | ||
103 | + return className; | ||
104 | + } | ||
105 | + | ||
106 | + public void setClassName(String className) { | ||
107 | + this.className = className; | ||
108 | + } | ||
109 | + | ||
110 | + public String getParentUserId() { | ||
111 | + return parentUserId; | ||
112 | + } | ||
113 | + | ||
114 | + public void setParentUserId(String parentUserId) { | ||
115 | + this.parentUserId = parentUserId; | ||
116 | + } | ||
117 | + | ||
118 | + public String getParentMobile() { | ||
119 | + return parentMobile; | ||
120 | + } | ||
121 | + | ||
122 | + public void setParentMobile(String parentMobile) { | ||
123 | + this.parentMobile = parentMobile; | ||
124 | + } | ||
125 | + | ||
126 | + public String getParentPass() { | ||
127 | + return parentPass; | ||
128 | + } | ||
129 | + | ||
130 | + public void setParentPass(String parentPass) { | ||
131 | + this.parentPass = parentPass; | ||
132 | + } | ||
133 | + | ||
134 | + public String getParentName() { | ||
135 | + return parentName; | ||
136 | + } | ||
137 | + | ||
138 | + public void setParentName(String parentName) { | ||
139 | + this.parentName = parentName; | ||
140 | + } | ||
141 | +} |
cloud/user_search/src/main/java/com/sincere/userSearch/model/TeacherClassInfo.java
0 → 100644
@@ -0,0 +1,77 @@ | @@ -0,0 +1,77 @@ | ||
1 | +package com.sincere.userSearch.model; | ||
2 | + | ||
3 | +public class TeacherClassInfo { | ||
4 | + | ||
5 | + private int classId ; | ||
6 | + private String className ; | ||
7 | + private String subjectId ; | ||
8 | + private String subjectName ; | ||
9 | + private int userType ; | ||
10 | + private int teacherId ; | ||
11 | + private String grade ; | ||
12 | + private String gradeName ; | ||
13 | + | ||
14 | + public int getClassId() { | ||
15 | + return classId; | ||
16 | + } | ||
17 | + | ||
18 | + public void setClassId(int classId) { | ||
19 | + this.classId = classId; | ||
20 | + } | ||
21 | + | ||
22 | + public String getClassName() { | ||
23 | + return className; | ||
24 | + } | ||
25 | + | ||
26 | + public void setClassName(String className) { | ||
27 | + this.className = className; | ||
28 | + } | ||
29 | + | ||
30 | + public String getSubjectId() { | ||
31 | + return subjectId; | ||
32 | + } | ||
33 | + | ||
34 | + public void setSubjectId(String subjectId) { | ||
35 | + this.subjectId = subjectId; | ||
36 | + } | ||
37 | + | ||
38 | + public String getSubjectName() { | ||
39 | + return subjectName; | ||
40 | + } | ||
41 | + | ||
42 | + public void setSubjectName(String subjectName) { | ||
43 | + this.subjectName = subjectName; | ||
44 | + } | ||
45 | + | ||
46 | + public int getUserType() { | ||
47 | + return userType; | ||
48 | + } | ||
49 | + | ||
50 | + public void setUserType(int userType) { | ||
51 | + this.userType = userType; | ||
52 | + } | ||
53 | + | ||
54 | + public int getTeacherId() { | ||
55 | + return teacherId; | ||
56 | + } | ||
57 | + | ||
58 | + public void setTeacherId(int teacherId) { | ||
59 | + this.teacherId = teacherId; | ||
60 | + } | ||
61 | + | ||
62 | + public String getGrade() { | ||
63 | + return grade; | ||
64 | + } | ||
65 | + | ||
66 | + public void setGrade(String grade) { | ||
67 | + this.grade = grade; | ||
68 | + } | ||
69 | + | ||
70 | + public String getGradeName() { | ||
71 | + return gradeName; | ||
72 | + } | ||
73 | + | ||
74 | + public void setGradeName(String gradeName) { | ||
75 | + this.gradeName = gradeName; | ||
76 | + } | ||
77 | +} |
cloud/user_search/src/main/java/com/sincere/userSearch/model/TeacherInfo.java
0 → 100644
@@ -0,0 +1,79 @@ | @@ -0,0 +1,79 @@ | ||
1 | +package com.sincere.userSearch.model; | ||
2 | + | ||
3 | +import java.util.List; | ||
4 | + | ||
5 | +public class TeacherInfo { | ||
6 | + | ||
7 | + private String userId ; | ||
8 | + private String userName ; | ||
9 | + private String mobile ; | ||
10 | + private int schoolId ; | ||
11 | + private String schoolName ; | ||
12 | + private String face ; | ||
13 | + private String pass ; | ||
14 | + private List<TeacherClassInfo> classInfos ; | ||
15 | + | ||
16 | + public String getUserId() { | ||
17 | + return userId; | ||
18 | + } | ||
19 | + | ||
20 | + public void setUserId(String userId) { | ||
21 | + this.userId = userId; | ||
22 | + } | ||
23 | + | ||
24 | + public String getUserName() { | ||
25 | + return userName; | ||
26 | + } | ||
27 | + | ||
28 | + public void setUserName(String userName) { | ||
29 | + this.userName = userName; | ||
30 | + } | ||
31 | + | ||
32 | + public String getMobile() { | ||
33 | + return mobile; | ||
34 | + } | ||
35 | + | ||
36 | + public void setMobile(String mobile) { | ||
37 | + this.mobile = mobile; | ||
38 | + } | ||
39 | + | ||
40 | + public int getSchoolId() { | ||
41 | + return schoolId; | ||
42 | + } | ||
43 | + | ||
44 | + public void setSchoolId(int schoolId) { | ||
45 | + this.schoolId = schoolId; | ||
46 | + } | ||
47 | + | ||
48 | + public String getSchoolName() { | ||
49 | + return schoolName; | ||
50 | + } | ||
51 | + | ||
52 | + public void setSchoolName(String schoolName) { | ||
53 | + this.schoolName = schoolName; | ||
54 | + } | ||
55 | + | ||
56 | + public String getFace() { | ||
57 | + return face; | ||
58 | + } | ||
59 | + | ||
60 | + public void setFace(String face) { | ||
61 | + this.face = face; | ||
62 | + } | ||
63 | + | ||
64 | + public List<TeacherClassInfo> getClassInfos() { | ||
65 | + return classInfos; | ||
66 | + } | ||
67 | + | ||
68 | + public void setClassInfos(List<TeacherClassInfo> classInfos) { | ||
69 | + this.classInfos = classInfos; | ||
70 | + } | ||
71 | + | ||
72 | + public String getPass() { | ||
73 | + return pass; | ||
74 | + } | ||
75 | + | ||
76 | + public void setPass(String pass) { | ||
77 | + this.pass = pass; | ||
78 | + } | ||
79 | +} |
cloud/user_search/src/main/java/com/sincere/userSearch/service/UserService.java
1 | package com.sincere.userSearch.service; | 1 | package com.sincere.userSearch.service; |
2 | 2 | ||
3 | +import com.sincere.userSearch.model.StudentInfo; | ||
4 | +import com.sincere.userSearch.model.TeacherInfo; | ||
3 | import com.sincere.userSearch.vo.rep.ZnxwRepVo; | 5 | import com.sincere.userSearch.vo.rep.ZnxwRepVo; |
4 | import com.sincere.userSearch.vo.req.ZnxwReqVo; | 6 | import com.sincere.userSearch.vo.req.ZnxwReqVo; |
5 | 7 | ||
8 | +import java.util.List; | ||
9 | + | ||
6 | public interface UserService { | 10 | public interface UserService { |
7 | 11 | ||
8 | ZnxwRepVo selectAgentId(ZnxwReqVo znxwReqVo); | 12 | ZnxwRepVo selectAgentId(ZnxwReqVo znxwReqVo); |
9 | 13 | ||
14 | + List<TeacherInfo> selectTeacherInfo(String userId) ; | ||
15 | + | ||
16 | + StudentInfo selectStudentInfo(String userId) ; | ||
17 | + | ||
18 | + List<StudentInfo> selectParentInfo(String userId) ; | ||
19 | + | ||
10 | } | 20 | } |
cloud/user_search/src/main/java/com/sincere/userSearch/service/impl/UserServiceImpl.java
1 | package com.sincere.userSearch.service.impl; | 1 | package com.sincere.userSearch.service.impl; |
2 | 2 | ||
3 | import com.sincere.userSearch.mapper.QyhApplyMapper; | 3 | import com.sincere.userSearch.mapper.QyhApplyMapper; |
4 | +import com.sincere.userSearch.mapper.UserMapper; | ||
5 | +import com.sincere.userSearch.model.StudentInfo; | ||
6 | +import com.sincere.userSearch.model.TeacherClassInfo; | ||
7 | +import com.sincere.userSearch.model.TeacherInfo; | ||
4 | import com.sincere.userSearch.service.UserService; | 8 | import com.sincere.userSearch.service.UserService; |
5 | import com.sincere.userSearch.vo.rep.ZnxwRepVo; | 9 | import com.sincere.userSearch.vo.rep.ZnxwRepVo; |
6 | import com.sincere.userSearch.vo.req.ZnxwReqVo; | 10 | import com.sincere.userSearch.vo.req.ZnxwReqVo; |
7 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
8 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
9 | 13 | ||
14 | +import java.util.ArrayList; | ||
15 | +import java.util.List; | ||
16 | + | ||
10 | @Service | 17 | @Service |
11 | public class UserServiceImpl implements UserService { | 18 | public class UserServiceImpl implements UserService { |
12 | 19 | ||
13 | @Autowired | 20 | @Autowired |
14 | QyhApplyMapper qyhApplyMapper ; | 21 | QyhApplyMapper qyhApplyMapper ; |
15 | 22 | ||
23 | + @Autowired | ||
24 | + UserMapper userMapper ; | ||
25 | + | ||
16 | @Override | 26 | @Override |
17 | public ZnxwRepVo selectAgentId(ZnxwReqVo znxwReqVo) { | 27 | public ZnxwRepVo selectAgentId(ZnxwReqVo znxwReqVo) { |
18 | return qyhApplyMapper.selectAgentId(znxwReqVo); | 28 | return qyhApplyMapper.selectAgentId(znxwReqVo); |
19 | } | 29 | } |
30 | + | ||
31 | + @Override | ||
32 | + public List<TeacherInfo> selectTeacherInfo(String userId) { | ||
33 | + List<TeacherInfo> teacherInfos = userMapper.selectTeacherInfo(userId); | ||
34 | + for(TeacherInfo teacherInfo : teacherInfos ){ | ||
35 | + List<TeacherClassInfo> teacherClassInfos = new ArrayList<>() ; | ||
36 | + for(TeacherClassInfo classInfo : teacherInfo.getClassInfos()){ | ||
37 | + if(classInfo.getClassId() != 0){ | ||
38 | + teacherClassInfos.add(classInfo); | ||
39 | + } | ||
40 | + } | ||
41 | + teacherInfo.setClassInfos(teacherClassInfos); | ||
42 | + } | ||
43 | + return teacherInfos ; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public StudentInfo selectStudentInfo(String userId) { | ||
48 | + StudentInfo studentInfo = userMapper.selectStudentInfo(userId); | ||
49 | + if(studentInfo != null){ | ||
50 | + StudentInfo parent = userMapper.selectParentInfo(studentInfo.getStudentId()) ; | ||
51 | + studentInfo.setParentMobile(parent.getParentMobile()); | ||
52 | + studentInfo.setParentName(parent.getParentName()); | ||
53 | + studentInfo.setParentPass(parent.getParentPass()); | ||
54 | + studentInfo.setParentUserId(parent.getParentUserId()); | ||
55 | + return studentInfo ; | ||
56 | + } | ||
57 | + return null ; | ||
58 | + } | ||
59 | + | ||
60 | + @Override | ||
61 | + public List<StudentInfo> selectParentInfo(String userId) { | ||
62 | + List<String> children = userMapper.selectChildrenId(userId) ; | ||
63 | + List<StudentInfo> patentInfo = new ArrayList<>(); | ||
64 | + for(String child : children){ | ||
65 | + StudentInfo studentInfo = selectStudentInfo(child); | ||
66 | + if(studentInfo != null){ | ||
67 | + patentInfo.add(studentInfo); | ||
68 | + } | ||
69 | + } | ||
70 | + return patentInfo; | ||
71 | + } | ||
20 | } | 72 | } |
cloud/user_search/src/main/java/com/sincere/userSearch/vo/rep/Info.java
0 → 100644
@@ -0,0 +1,37 @@ | @@ -0,0 +1,37 @@ | ||
1 | +package com.sincere.userSearch.vo.rep; | ||
2 | + | ||
3 | +import com.sincere.userSearch.model.StudentInfo; | ||
4 | +import com.sincere.userSearch.model.TeacherInfo; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +public class Info { | ||
9 | + | ||
10 | + private List<TeacherInfo> teacherInfos ; | ||
11 | + private List<StudentInfo> parentInfos ; | ||
12 | + private List<StudentInfo> studentInfos ; | ||
13 | + | ||
14 | + public List<TeacherInfo> getTeacherInfos() { | ||
15 | + return teacherInfos; | ||
16 | + } | ||
17 | + | ||
18 | + public void setTeacherInfos(List<TeacherInfo> teacherInfos) { | ||
19 | + this.teacherInfos = teacherInfos; | ||
20 | + } | ||
21 | + | ||
22 | + public List<StudentInfo> getParentInfos() { | ||
23 | + return parentInfos; | ||
24 | + } | ||
25 | + | ||
26 | + public void setParentInfos(List<StudentInfo> parentInfos) { | ||
27 | + this.parentInfos = parentInfos; | ||
28 | + } | ||
29 | + | ||
30 | + public List<StudentInfo> getStudentInfos() { | ||
31 | + return studentInfos; | ||
32 | + } | ||
33 | + | ||
34 | + public void setStudentInfos(List<StudentInfo> studentInfos) { | ||
35 | + this.studentInfos = studentInfos; | ||
36 | + } | ||
37 | +} |
cloud/user_search/src/main/java/com/sincere/userSearch/vo/req/UserInfoReqVo.java
0 → 100644
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +package com.sincere.userSearch.vo.req; | ||
2 | + | ||
3 | +public class UserInfoReqVo { | ||
4 | + private int userType ; // 2:学生;3:家长;其他都是老师 | ||
5 | + | ||
6 | + public int getUserType() { | ||
7 | + return userType; | ||
8 | + } | ||
9 | + | ||
10 | + public void setUserType(int userType) { | ||
11 | + this.userType = userType; | ||
12 | + } | ||
13 | +} |
cloud/user_search/src/main/resources/mapper/UserMapper.xml
@@ -2,13 +2,75 @@ | @@ -2,13 +2,75 @@ | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
3 | <mapper namespace="com.sincere.userSearch.mapper.UserMapper"> | 3 | <mapper namespace="com.sincere.userSearch.mapper.UserMapper"> |
4 | 4 | ||
5 | - <resultMap id="ZnxwMap" type="com.sincere.userSearch.vo.rep.ZnxwRepVo"> | ||
6 | - <result column="AgentId" property="agentId" /> | ||
7 | - <result column="school_name" property="schoolName" /> | 5 | + <resultMap id="TeacherInfo" type="com.sincere.userSearch.model.TeacherInfo"> |
6 | + <result column="user_id" property="userId"/> | ||
7 | + <result column="name" property="userName"/> | ||
8 | + <result column="mobile" property="mobile"/> | ||
9 | + <result column="face" property="face"/> | ||
10 | + <result column="pass" property="pass"/> | ||
11 | + <result column="schoolid" property="schoolId"/> | ||
12 | + <result column="schoolname" property="schoolName"/> | ||
13 | + <collection property="classInfos" ofType="com.sincere.userSearch.model.TeacherClassInfo"> | ||
14 | + <result column="classid" property="classId"/> | ||
15 | + <result column="classname" property="className"/> | ||
16 | + <result column="subjectid" property="subjectId"/> | ||
17 | + <result column="subjectname" property="subjectName"/> | ||
18 | + <result column="usertype" property="userType"/> | ||
19 | + <result column="TeacherId" property="teacherId"/> | ||
20 | + <result column="grade" property="grade"/> | ||
21 | + <result column="gradename" property="gradeName"/> | ||
22 | + </collection> | ||
8 | </resultMap> | 23 | </resultMap> |
9 | - <select id="selectAgentId" parameterType="com.sincere.userSearch.vo.req.ZnxwReqVo" resultMap="ZnxwMap"> | ||
10 | - SELECT EM_QYHApply.AgentId , SZ_School.school_name FROM EM_QYHApply join SZ_School on EM_QYHApply.SchoolId = SZ_School.school_id | ||
11 | - where EM_QYHApply.SchoolId = #{schoolId} and EM_QYHApply.Type = #{type} and EM_QYHApply.ApplyName = '智能校卫' | 24 | + <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 | + 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 | + ur.usertype, ur.customerId AS TeacherId,c.grade AS grade,(SELECT grade FROM dbo.SZ_Grade WHERE id=c.grade) gradename | ||
29 | + FROM dbo.SZ_UserRole ur | ||
30 | + join sz_user u on ur.user_id = u.user_id | ||
31 | + INNER JOIN dbo.SZ_School s ON s.school_id = ur.school_id AND ur.isconfirm=1 | ||
32 | + LEFT JOIN dbo.SZ_Class c ON (c.state=1 AND ur.school_id = c.school_id AND c.class_id=ur.class_id AND c.is_finish=0) | ||
33 | + LEFT JOIN dbo.SZ_Subject sj ON sj.subject_id=ur.subject_id | ||
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 | ||
12 | </select> | 35 | </select> |
13 | 36 | ||
37 | + | ||
38 | + <resultMap id="StudentInfo" type="com.sincere.userSearch.model.StudentInfo"> | ||
39 | + <result column="user_id" property="userId"/> | ||
40 | + <result column="student_id" property="studentId"/> | ||
41 | + <result column="name" property="studentName"/> | ||
42 | + <result column="school_id" property="schoolId"/> | ||
43 | + <result column="school_name" property="schoolName"/> | ||
44 | + <result column="photo" property="face"/> | ||
45 | + <result column="pass" property="pass"/> | ||
46 | + <result column="othername" property="otherName"/> | ||
47 | + <result column="studentcode" property="studentCode"/> | ||
48 | + <result column="class_id" property="classId"/> | ||
49 | + <result column="class_name" property="className"/> | ||
50 | + </resultMap> | ||
51 | + <select id="selectStudentInfo" parameterType="java.lang.String" resultMap="StudentInfo"> | ||
52 | + select sz_v_school_student.* , sz_school.school_name from sz_v_school_student join sz_school | ||
53 | + on sz_v_school_student.school_id = sz_school.school_id where user_id = #{userId} | ||
54 | + </select> | ||
55 | + | ||
56 | + | ||
57 | + <resultMap id="ParentInfo" type="com.sincere.userSearch.model.StudentInfo"> | ||
58 | + <result column="user_id" property="parentUserId"/> | ||
59 | + <result column="mobile" property="parentMobile"/> | ||
60 | + <result column="name" property="parentName"/> | ||
61 | + <result column="pass" property="parentPass"/> | ||
62 | + </resultMap> | ||
63 | + <select id="selectParentInfo" parameterType="java.lang.Integer" resultMap="ParentInfo"> | ||
64 | + select sz_user.user_id , sz_user.name ,sz_user.pass ,sz_user.mobile from sz_user where user_id = ( | ||
65 | + select user_id from sz_userRole where customerid = | ||
66 | + (select parent_id from SZ_SPRole where student_id = #{studentId})) | ||
67 | + </select> | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + <select id="selectChildrenId" parameterType="java.lang.String" resultType="java.lang.String"> | ||
72 | + select user_id from SZ_UserRole where state = 1 and CustomerId in ( | ||
73 | + select student_id from SZ_SPRole where parent_id in ( | ||
74 | + select DISTINCT customerId from SZ_UserRole where user_id = #{userId} and UserType = 3)) | ||
75 | + </select> | ||
14 | </mapper> | 76 | </mapper> |