From 5585f78693d7a50287826513f63b1b14ecf6f3c8 Mon Sep 17 00:00:00 2001 From: mzh820631607 Date: Mon, 14 Sep 2020 15:55:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=A6=E7=94=9F=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=9A=84=E6=B7=BB=E5=8A=A0=E5=AD=A6=E7=94=9F=E5=92=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=A6=E7=94=9F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../liuwanr/controller/StudentController.java | 6 +- .../controller/UserInfoController.java | 391 ++++++++++++------ .../entity/OrganizationRelationship.java | 30 ++ .../liuwanr/helper/QueryStudentUtils.java | 14 +- .../OrganizationRelationshipMapper.java | 9 +- .../yipin/liuwanr/mapper/UserInfoMapper.java | 32 +- .../liuwanr/service/UserInfoService.java | 202 +++++++-- .../liuwanr/service/StudentServiceTest.java | 91 ++++ 8 files changed, 594 insertions(+), 181 deletions(-) create mode 100644 src/test/java/com/yipin/liuwanr/service/StudentServiceTest.java diff --git a/src/main/java/com/yipin/liuwanr/controller/StudentController.java b/src/main/java/com/yipin/liuwanr/controller/StudentController.java index 5d82eeb..0b46d8c 100644 --- a/src/main/java/com/yipin/liuwanr/controller/StudentController.java +++ b/src/main/java/com/yipin/liuwanr/controller/StudentController.java @@ -135,7 +135,7 @@ public class StudentController { resp.setErrmessage("学校id为空,查询失败!"); }else{ HashMap ret = studentService.queryStudentByProfessionalIds(professionalId, pageNo, pageSize, schoolId); - QueryStudentUtils.queryStudentByIds(resp, ret, "retcode", "retvalue"); + QueryStudentUtils.statusInformationEntity(resp, ret, "retcode", "retvalue"); } return resp; } @@ -156,7 +156,7 @@ public class StudentController { resp.setErrmessage("学校id为空,查询失败!"); }else { HashMap ret = studentService.queryStudentByGradeIds(gradeId, pageNo, pageSize, schoolId); - QueryStudentUtils.queryStudentByIds(resp, ret, "retcode", "retvalue"); + QueryStudentUtils.statusInformationEntity(resp, ret, "retcode", "retvalue"); } return resp; } @@ -177,7 +177,7 @@ public class StudentController { resp.setErrmessage("学校id为空,查询失败!"); }else { HashMap ret = studentService.queryStudentByClassIds(classId, pageNo, pageSize, schoolId); - QueryStudentUtils.queryStudentByIds(resp, ret, "retcode", "retvalue"); + QueryStudentUtils.statusInformationEntity(resp, ret, "retcode", "retvalue"); } return resp; } diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index d8f84f0..bc8a02d 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -1,11 +1,13 @@ package com.yipin.liuwanr.controller; import com.yipin.liuwanr.entity.*; +import com.yipin.liuwanr.helper.QueryStudentUtils; import com.yipin.liuwanr.helper.RedisHelper; import com.yipin.liuwanr.service.StaffService; import com.yipin.liuwanr.service.StudentService; import com.yipin.liuwanr.service.UserInfoService; import com.yipin.liuwanr.vo.UserInfoVO; +import jdk.nashorn.internal.ir.IfNode; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -13,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -32,8 +35,131 @@ public class UserInfoController { @Autowired RedisHelper redisHelper; + /** - * 添加用户 + * 接收参数: + * UserInfo:account,userName,roleId,uniqueIdentificationAccount,phone,email + * OrganizationRelationship:workNumber,professionalClassId,gradeId,classId + */ + + @PostMapping("/addStudent") + Response addUserInfo(@RequestBody UserInfoVO vo) { + Response response = new Response(); +// Student student = vo.getStudent(); + UserInfo userInfo = vo.getUserInfo(); + OrganizationRelationship organizationRelationship = vo.getOrganizationRelationship(); + String account = userInfo.getAccount(); + String userName = userInfo.getUserName(); + Integer roleId = userInfo.getRoleId(); + String uniqueIdentificationAccount = userInfo.getUniqueIdentificationAccount(); + String phone = userInfo.getPhone(); + String email = userInfo.getEmail(); + String workNumber = organizationRelationship.getWorkNumber(); + Integer professionalId = organizationRelationship.getProfessionalId(); + Integer gradeId = organizationRelationship.getGradeId(); + Integer classId = organizationRelationship.getClassId(); + +// UserM user = vo.getUser(); + if (account==null||userName==null||roleId!=4||uniqueIdentificationAccount==null||workNumber==null||professionalId<=0||gradeId<=0||classId<=0) { + response.setStatus(300); + response.setErrmessage("Parameter Invalid"); + } else { + HashMap ret = userInfoService.addUserInfo(userInfo); + int status = (int) ret.get("retcode"); + if (200 == status) { + response.setStatus(status); + response.setMessage(ret.get("retvalue")); + HashMap ret1 = userInfoService.addOrganizationRelationship(organizationRelationship); + int status1 = (int)ret.get("retcode"); + if (status1 == 200){ + response.setStatus(status1); + response.setMessage(ret1.get("retvalue")); + }else { + response.setStatus(status1); + response.setErrmessage(ret1.get("retvalue").toString()); + throw new RuntimeException(); + } + } else { + response.setStatus(status); + response.setErrmessage(ret.get("retvalue").toString()); + throw new RuntimeException(); + } + } + return response; + } + + /** + * 查询学生信息 + * @param schoolId + * @param professionalIds + * @param searchContent + * @param gradeIds + * @param classIds + * @param pageNo + * @param pageSize + * @return + */ + @GetMapping("/queryStudent") + Response queryStudent(@RequestParam Integer schoolId, Integer[] professionalIds, String searchContent, Integer[] gradeIds, Integer[] classIds, Integer pageNo, Integer pageSize) { + Response response = new Response(); + UserInfo userInfo = new UserInfo(); + OrganizationRelationship ship = new OrganizationRelationship(); + HashMap ids = new HashMap<>(8); + if (schoolId == null) { + response.setStatus(300); + response.setErrmessage("学校信息为空"); + } else { + if (searchContent != null && searchContent != "") { + userInfo.setSearchContent(searchContent); + } + if (professionalIds.length > 0) { +// List professionalList = Arrays.asList(professionalId); + for (Integer professionalId:professionalIds){ + ship.setProfessionalId(professionalId); + } + } + if (gradeIds.length > 0) { +// List gradeList = Arrays.asList(gradeIds); + for (Integer gradeId:gradeIds){ + ship.setGradeId(gradeId); + } + } + if (classIds.length > 0) { +// List classList = Arrays.asList(classIds); + for (Integer classId:classIds){ + ship.setClassId(classId); + } + } + userInfo.setSchoolId(schoolId); +// HashMap map = userInfoService.queryStudent(userInfo,ship,pageNo,pageSize); +// QueryStudentUtils.statusInformationController(response,map, "retcode", "retvalue"); + } + + + return response; + } + + /** + * 批量删除学生 + * + * @param ids 用户id + * @return + */ + @GetMapping("/deleteStudent") + Response deleteStudent(Integer[] ids) { + Response response = new Response(); + if (ids.length > 0) { + userInfoService.deleteStudent(ids); + response.setStatus(200); + } else { + response.setStatus(500); + response.setErrmessage("学生id不能为空"); + } + return response; + } + + /** + * 添加用户 */ @Transactional @PostMapping("/addUser") @@ -59,45 +185,45 @@ public class UserInfoController { Integer cityId = user.getCityId(); //学校id Integer schoolId = user.getSchoolId(); - if(name==null||name==""){ + if (name == null || name == "") { resp.setStatus(300); resp.setErrmessage("姓名不能为空!"); - }else if(provinceId==null){ + } else if (provinceId == null) { resp.setStatus(300); resp.setErrmessage("省份不能为空!"); - }else if(cityId==null){ + } else if (cityId == null) { resp.setStatus(300); resp.setErrmessage("城市不能为空!"); - }else if(schoolId==null){ + } else if (schoolId == null) { resp.setStatus(300); resp.setErrmessage("学校不能为空!"); - }else { + } else { HashMap ret = userInfoService.addUser(user); Integer userId = user.getUserId(); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); resp.setMessage(ret.get("retvalue")); - HashMap stu = userInfoService.addPersonalFile(userProfilesList,userId); - int stuStatus = (int) stu.get("retcode"); - if (stuStatus == 200){ - resp.setStatus(stuStatus); - resp.setMessage(stu.get("retvalue")); - }else { - resp.setStatus(stuStatus); - resp.setErrmessage(stu.get("retvalue").toString()); - throw new RuntimeException(); - } - HashMap sta = userInfoService.addStuStaff(ORList,userId); - int staStatus = (int) sta.get("retcode"); - if (staStatus == 200){ - resp.setStatus(staStatus); - resp.setMessage(sta.get("retvalue")); - }else { - resp.setStatus(staStatus); - resp.setErrmessage(sta.get("retvalue").toString()); - throw new RuntimeException(); - } + HashMap stu = userInfoService.addPersonalFile(userProfilesList, userId); + int stuStatus = (int) stu.get("retcode"); + if (stuStatus == 200) { + resp.setStatus(stuStatus); + resp.setMessage(stu.get("retvalue")); + } else { + resp.setStatus(stuStatus); + resp.setErrmessage(stu.get("retvalue").toString()); + throw new RuntimeException(); + } + HashMap sta = userInfoService.addStuStaff(ORList, userId); + int staStatus = (int) sta.get("retcode"); + if (staStatus == 200) { + resp.setStatus(staStatus); + resp.setMessage(sta.get("retvalue")); + } else { + resp.setStatus(staStatus); + resp.setErrmessage(sta.get("retvalue").toString()); + throw new RuntimeException(); + } } else { resp.setStatus(status); resp.setErrmessage(ret.get("retvalue").toString()); @@ -108,49 +234,50 @@ public class UserInfoController { } /** - * 查询用户(根据国家、省份、城市) + * 查询用户(根据国家、省份、城市) */ @GetMapping("/queryUserInfo") Response queryUserInfo(@RequestParam String countries, Integer provinceId, Integer cityId, Integer pageNo, Integer pageSize, Integer schoolId, Integer roleId, String searchContent, Integer month, String creationTime, String endTime) { Response resp = new Response(); - UserInfo userInfo = new UserInfo(); + UserInfo userInfo = new UserInfo(); //设置国家 - if (countries != null&&countries!="") { + if (countries != null && countries != "") { userInfo.setCountries(countries); } //设置省份 - if(provinceId!=null) { + if (provinceId != null) { userInfo.setProvinceId(provinceId); } //设置城市 - if(cityId!=null) { + if (cityId != null) { userInfo.setCityId(cityId); } //学校 - if (schoolId!=null) { + if (schoolId != null) { userInfo.setSchoolId(schoolId); } //角色 - if (roleId!=null) { + if (roleId != null) { userInfo.setRoleId(roleId); } //搜索内容 - if (searchContent!=null&&searchContent!="") { + if (searchContent != null && searchContent != "") { userInfo.setSearchContent(searchContent); } //月份 - if (month!=null) { - userInfo.setMonth(month);; + if (month != null) { + userInfo.setMonth(month); + ; } //创建时间 - if (creationTime!=null&&creationTime!="") { + if (creationTime != null && creationTime != "") { userInfo.setCreationTime(creationTime); } //结束时间 - if (endTime!=null&&endTime!="") { + if (endTime != null && endTime != "") { userInfo.setEndTime(endTime); } - HashMap ret = userInfoService.queryUserInfo(userInfo,pageNo,pageSize); + HashMap ret = userInfoService.queryUserInfo(userInfo, pageNo, pageSize); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -163,49 +290,49 @@ public class UserInfoController { } /** - * 删除用户(根据ID修改isdel状态,0可见 1不可见) + * 删除用户(根据ID修改isdel状态,0可见 1不可见) */ @Transactional @PostMapping("/deleteUserInfo") public Response deleteUserInfo(@RequestBody List userIdList) { Response resp = new Response(); - if (userIdList==null) { - resp.setStatus(300); - resp.setErrmessage("用户id为空,删除用户失败!"); - } else { - HashMap ret = userInfoService.deleteUserInfo(userIdList); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - HashMap sta = userInfoService.deleteOrganizationRelationship(userIdList); - int staStatus = (int) sta.get("retcode"); - if (200 == staStatus) { - resp.setStatus(staStatus); - resp.setMessage(sta.get("retvalue")); - }else{ - resp.setStatus(staStatus); - resp.setErrmessage(sta.get("retvalue").toString()); - throw new RuntimeException(); - } - }else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); + if (userIdList == null) { + resp.setStatus(300); + resp.setErrmessage("用户id为空,删除用户失败!"); + } else { + HashMap ret = userInfoService.deleteUserInfo(userIdList); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + HashMap sta = userInfoService.deleteOrganizationRelationship(userIdList); + int staStatus = (int) sta.get("retcode"); + if (200 == staStatus) { + resp.setStatus(staStatus); + resp.setMessage(sta.get("retvalue")); + } else { + resp.setStatus(staStatus); + resp.setErrmessage(sta.get("retvalue").toString()); throw new RuntimeException(); } + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + throw new RuntimeException(); } + } return resp; } /** - * 更新用户 + * 更新用户 */ @Transactional @PostMapping("/updateUserInfo") public Response updateUserInfo(@RequestBody UserInfo userInfo) { Response resp = new Response(); Integer userId = userInfo.getUserId(); - if (userId==null) { + if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户ID为空,修改用户失败!"); } else { @@ -224,7 +351,7 @@ public class UserInfoController { } /** - * 更新用户个人档案 + * 更新用户个人档案 */ @Transactional @PostMapping("/updateUserProfiles") @@ -250,7 +377,7 @@ public class UserInfoController { } /** - * 更新用户组织关系 + * 更新用户组织关系 */ @Transactional @PostMapping("/updateOR") @@ -275,19 +402,19 @@ public class UserInfoController { } /** - * 登陆查询学校 + * 登陆查询学校 */ @GetMapping("/loginSchool") Response loginSchool(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) { Response resp = new Response(); - UserInfo userInfo = new UserInfo(); - if (account == null || account=="") { + UserInfo userInfo = new UserInfo(); + if (account == null || account == "") { resp.setStatus(300); resp.setErrmessage("用户账号为空,登录失败!"); - }else if(password ==null || password=="") { + } else if (password == null || password == "") { resp.setStatus(300); resp.setErrmessage("用户密码为空,登录失败!"); - }else{ + } else { userInfo.setAccount(account); userInfo.setPassword(password); HashMap ret = userInfoService.loginSchool(userInfo); @@ -304,23 +431,22 @@ public class UserInfoController { } /** - * 登陆 + * 登陆 */ @GetMapping("/logins") - Response logins(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId,@RequestParam("roleId") Integer roleId, HttpServletRequest req, HttpServletResponse res) { + Response logins(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId, @RequestParam("roleId") Integer roleId, HttpServletRequest req, HttpServletResponse res) { Response resp = new Response(); - UserInfo userInfo = new UserInfo(); + UserInfo userInfo = new UserInfo(); if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id为空,登录失败!"); - }else if(schoolId ==null) { + } else if (schoolId == null) { resp.setStatus(300); resp.setErrmessage("用户学校id为空,登录失败!"); - }else if(roleId ==null) { + } else if (roleId == null) { resp.setStatus(300); resp.setErrmessage("用户角色id为空,登录失败!"); - } - else{ + } else { userInfo.setRoleId(roleId); userInfo.setUserId(userId); userInfo.setSchoolId(schoolId); @@ -338,19 +464,19 @@ public class UserInfoController { } /** - * 登陆查询角色 + * 登陆查询角色 */ @GetMapping("/loginRole") Response loginRole(@RequestParam("userId") Integer userId, @RequestParam("schoolId") Integer schoolId, HttpServletRequest req, HttpServletResponse res) { Response resp = new Response(); - OrganizationRelationship OR = new OrganizationRelationship(); + OrganizationRelationship OR = new OrganizationRelationship(); if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id为空,登录失败!"); - }else if(schoolId ==null) { + } else if (schoolId == null) { resp.setStatus(300); resp.setErrmessage("角色id为空,登录失败!"); - }else{ + } else { OR.setUserId(userId); OR.setSchoolId(schoolId); HashMap ret = userInfoService.loginRole(OR); @@ -367,15 +493,15 @@ public class UserInfoController { } /** - * 查询用户详情(ID) + * 查询用户详情(ID) */ @GetMapping("/queryUserInfoDetails") Response queryUserInfoDetails(@RequestParam Integer userId) { Response resp = new Response(); - if (userId==null) { + if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id为空!查询失败!"); - }else { + } else { HashMap ret = userInfoService.queryUserInfoDetails(userId); int status = (int) ret.get("retcode"); if (200 == status) { @@ -390,19 +516,19 @@ public class UserInfoController { } /** - * 查询用户组织架构OR(organization relationship) + * 查询用户组织架构OR(organization relationship) */ @GetMapping("/queryUserOR") - Response queryUserOR(@RequestParam Integer userId,Integer platformId) { + Response queryUserOR(@RequestParam Integer userId, Integer platformId) { Response resp = new Response(); - if (userId==null) { + if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id为空!查询失败!"); - }else if (platformId==null){ + } else if (platformId == null) { resp.setStatus(300); resp.setErrmessage("平台id为空!查询失败!"); } else { - HashMap ret = userInfoService.queryUserOR(userId,platformId); + HashMap ret = userInfoService.queryUserOR(userId, platformId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -416,15 +542,15 @@ public class UserInfoController { } /** - * 查询用户个人档案 + * 查询用户个人档案 */ @GetMapping("/queryUserProfiles") Response queryUserProfiles(@RequestParam Integer userId) { Response resp = new Response(); - if (userId==null) { + if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id为空!查询失败!"); - }else { + } else { HashMap ret = userInfoService.queryUserProfiles(userId); int status = (int) ret.get("retcode"); if (200 == status) { @@ -441,11 +567,11 @@ public class UserInfoController { @PostMapping("/uploadUserAvatars") Response uploadUserAvatars(MultipartFile file, Integer userId) { Response resp = new Response(); - if (userId==null) {//前台传来的值是否为空 + if (userId == null) {//前台传来的值是否为空 resp.setStatus(300); resp.setErrmessage("Parameter Invalid"); - }else { - HashMap ret = userInfoService.uploadUserAvatars(file,userId); + } else { + HashMap ret = userInfoService.uploadUserAvatars(file, userId); int status = (int) ret.get("retcode"); if (200 == status) { @@ -460,7 +586,7 @@ public class UserInfoController { } /** - * 更新登录次数和时间 + * 更新登录次数和时间 */ @PostMapping("/updateLogInNumber") Response updateLogInNumber(@RequestBody UserM user) { @@ -468,13 +594,13 @@ public class UserInfoController { Integer userId = user.getUserId(); String phone = user.getPhone(); Integer accountRole = user.getAccountRole(); - if (userId==null) { + if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id不能为空!"); - }else if(phone==null||phone==""){ + } else if (phone == null || phone == "") { resp.setStatus(300); resp.setErrmessage("用户电话不能为空!"); - } else if(accountRole==null){ + } else if (accountRole == null) { resp.setStatus(300); resp.setErrmessage("用户角色不能为空!"); } else { @@ -490,34 +616,35 @@ public class UserInfoController { } return resp; } + /** - * 用户模块查询客户 + * 用户模块查询客户 */ @GetMapping("/queryCustomer") - Response queryCustomer(@RequestParam String searchContent,@RequestParam List customerIds) { + Response queryCustomer(@RequestParam String searchContent, @RequestParam List customerIds) { Response resp = new Response(); - HashMap ret = userInfoService.queryCustomer(searchContent,customerIds); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + HashMap ret = userInfoService.queryCustomer(searchContent, customerIds); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } return resp; } /** - * 查询账号是否存在 + * 查询账号是否存在 */ @GetMapping("/queryAccountIsExist") Response queryAccountIsExist(@RequestParam String account) { Response resp = new Response(); - if (account==null&&account=="") { + if (account == null && account == "") { resp.setStatus(300); resp.setErrmessage("账号为空!"); - }else { + } else { HashMap ret = userInfoService.queryAccountIsExist(account); int status = (int) ret.get("retcode"); if (200 == status) { @@ -532,20 +659,19 @@ public class UserInfoController { } /** - * 查询学号、工号是否存在 + * 查询学号、工号是否存在 */ @GetMapping("/queryWorkNumberIsExist") - Response queryWorkNumberIsExist(@RequestParam String workNumber,Integer roleId,Integer schoolId) { + Response queryWorkNumberIsExist(@RequestParam String workNumber, Integer roleId, Integer schoolId) { Response resp = new Response(); - if (workNumber==null) { + if (workNumber == null) { resp.setStatus(300); resp.setErrmessage("学号、工号为空!"); - }else if (roleId==null){ - resp.setStatus(300); - resp.setErrmessage("角色id为空!"); - } - else { - HashMap ret = userInfoService.queryWorkNumberIsExist(workNumber,roleId,schoolId); + } else if (roleId == null) { + resp.setStatus(300); + resp.setErrmessage("角色id为空!"); + } else { + HashMap ret = userInfoService.queryWorkNumberIsExist(workNumber, roleId, schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -559,17 +685,17 @@ public class UserInfoController { } /** - * 查询平台 + * 查询平台 */ @GetMapping("/queryPlatform") Response queryPlatform(@RequestParam String platformId) { Response resp = new Response(); - UserInfo userInfo = new UserInfo(); + UserInfo userInfo = new UserInfo(); //平台id - if (platformId==null&&platformId=="") { + if (platformId == null && platformId == "") { resp.setStatus(300); resp.setErrmessage("平台id为空!"); - }else{ + } else { HashMap ret = userInfoService.queryPlatform(platformId); int status = (int) ret.get("retcode"); if (200 == status) { @@ -584,7 +710,7 @@ public class UserInfoController { } /** - * 删除平台 + * 删除平台 */ @PostMapping("/deletePlatform") Response deletePlatform(@RequestBody OrganizationRelationship OR) { @@ -592,15 +718,14 @@ public class UserInfoController { Integer platformId = OR.getPlatformId(); Integer userId = OR.getUserId(); //平台id - if (platformId==null) { + if (platformId == null) { resp.setStatus(300); resp.setErrmessage("平台id为空!"); - }else if(userId==null){ + } else if (userId == null) { resp.setStatus(300); resp.setErrmessage("用户id为空!"); - } - else{ - HashMap ret = userInfoService.deletePlatform(platformId,userId); + } else { + HashMap ret = userInfoService.deletePlatform(platformId, userId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); diff --git a/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java b/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java index 3328525..2cd6061 100644 --- a/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java +++ b/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java @@ -33,6 +33,10 @@ public class OrganizationRelationship { private String professionalName; //年级ID private Integer gradeId; + + private String professionalIds; + private String gradeIds; + private String classIds; //年级名称 private String gradeName; //班级ID @@ -42,6 +46,32 @@ public class OrganizationRelationship { //客户ID private Integer customerId; + public String getProfessionalIds() { + return professionalIds; + } + + public void setProfessionalIds(String professionalIds) { + this.professionalIds = professionalIds; + } + + public String getGradeIds() { + return gradeIds; + } + + public void setGradeIds(String gradeIds) { + this.gradeIds = gradeIds; + } + + public String getClassIds() { + return classIds; + } + + public void setClassIds(String classIds) { + this.classIds = classIds; + } + + + public String getOneDepartmentIds() { return oneDepartmentIds; } diff --git a/src/main/java/com/yipin/liuwanr/helper/QueryStudentUtils.java b/src/main/java/com/yipin/liuwanr/helper/QueryStudentUtils.java index a5bdfc6..a6add87 100644 --- a/src/main/java/com/yipin/liuwanr/helper/QueryStudentUtils.java +++ b/src/main/java/com/yipin/liuwanr/helper/QueryStudentUtils.java @@ -13,7 +13,8 @@ public class QueryStudentUtils { * @param retcode * @param retvalue */ - public static void queryStudentByIds(Response resp,HashMap hashMap,String retcode,String retvalue){ + //com.yipin.liuwanr.entity.Response + public static void statusInformationEntity(Response resp,HashMap hashMap,String retcode,String retvalue){ int status = (int)hashMap.get(retcode); if (status==200){ @@ -23,6 +24,17 @@ public class QueryStudentUtils { resp.setStatus(status); resp.setMessage(hashMap.get(retvalue.toString())); } + } + //com.yipin.liuwanr.controller.Response + public static void statusInformationController(com.yipin.liuwanr.controller.Response resp, HashMap hashMap, String retcode, String retvalue){ + int status = (int)hashMap.get(retcode); + if (status==200){ + resp.setStatus(status); + resp.setMessage(hashMap.get(retvalue)); + }else{ + resp.setStatus(status); + resp.setMessage(hashMap.get(retvalue.toString())); + } } } diff --git a/src/main/java/com/yipin/liuwanr/mapper/OrganizationRelationshipMapper.java b/src/main/java/com/yipin/liuwanr/mapper/OrganizationRelationshipMapper.java index 8436979..1c74204 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/OrganizationRelationshipMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/OrganizationRelationshipMapper.java @@ -3,13 +3,20 @@ package com.yipin.liuwanr.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.yipin.liuwanr.entity.OrganizationRelationship; import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper -public interface OrganizationRelationshipMapper { +public interface OrganizationRelationshipMapper{ + + @Insert({""}) + Integer insertOrganizationRelationship(OrganizationRelationship organizationRelationship); @Select("select organizationRelationshipId,schoolName,professionalName,gradeName,className,workNumber,roleId " + "from hr_organization_relationship where userId=#{userId} ") diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index 8c04ffb..59b9022 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -1,5 +1,6 @@ package com.yipin.liuwanr.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.yipin.liuwanr.entity.*; import com.yipin.liuwanr.vo.UserInfoVO; import com.yipin.liuwanr.vo.UserVO; @@ -8,7 +9,36 @@ import org.apache.ibatis.mapping.FetchType; import java.util.List; -public interface UserInfoMapper { +public interface UserInfoMapper{ + + @Insert("INSERT INTO hr_user_info(userName,uniqueIdentificationAccount,documentType,IDNumber,provinceId,cityId,countries,dateBirth,educationDegree,schoolId,phone,weChatID,email,account,password,creationTime,logInNumber,sex,userAvatars,isdel)" + + " VALUES(#{userName},#{uniqueIdentificationAccount},#{documentType},#{IDNumber},#{provinceId},#{cityId},#{countries},#{dateBirth},#{educationDegree},#{schoolId},#{phone},#{weChatID},#{email},#{account},#{password},now(),#{logInNumber},#{sex},#{userAvatars},0)") + Integer insertUserInfo(UserInfo userInfo); + + /** + * 批量查询学生信息 + * @param + * @return + */ + @Select({ ""}) +// List queryStudent(UserInfo userInfo,OrganizationRelationship organizationRelationship); + List queryStudent(String searchContent,Integer schoolId,Integer gradeId,Integer classId,Integer professionalId); + + @Update({""}) + Integer updateStudentInfo(List list); @Update({ "