From 82a8abb90604df154247f3b9d38c8745ed598e61 Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Mon, 31 Aug 2020 14:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExperimentalClassController.java | 17 --- .../liuwanr/controller/StaffController.java | 48 ++++++-- .../controller/UserInfoController.java | 109 +++++++++++------- .../entity/OrganizationRelationship.java | 10 ++ .../mapper/ExperimentalClassMapper.java | 4 +- .../com/yipin/liuwanr/mapper/StaffMapper.java | 2 +- .../yipin/liuwanr/mapper/StudentMapper.java | 2 +- .../yipin/liuwanr/mapper/UserInfoMapper.java | 72 +++++++++--- .../service/ExperimentalClassService.java | 4 +- .../liuwanr/service/UserInfoService.java | 91 ++++++++++----- .../yipin/liuwanr/service/UserService.java | 30 ++--- 11 files changed, 254 insertions(+), 135 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java index 91f037a..0c04329 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java @@ -254,23 +254,6 @@ public class ExperimentalClassController { } - //新增学生显示数据 - @GetMapping("/queryExperimentalClass") - Response queryExperimentalClass(@RequestParam Integer experimentalClassId) { - Response resp = new Response(); - HashMap ret=classService.queryExperimentalClass(experimentalClassId); - 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; - } - - /** * 查询学生行政班级 * @param experimentalClassId diff --git a/src/main/java/com/yipin/liuwanr/controller/StaffController.java b/src/main/java/com/yipin/liuwanr/controller/StaffController.java index 21e8128..014033b 100644 --- a/src/main/java/com/yipin/liuwanr/controller/StaffController.java +++ b/src/main/java/com/yipin/liuwanr/controller/StaffController.java @@ -41,9 +41,9 @@ public class StaffController { Response readStaff(MultipartFile file,Integer schoolId){ Response resp = new Response(); if(StringUtils.isEmpty(schoolId)) { - resp.setStatus(300); - resp.setMessage("schoolId is not empty"); - return resp; + resp.setStatus(300); + resp.setMessage("schoolId is not empty"); + return resp; } HashMap ret =staffService.readStaff(file,schoolId); int status = (int) ret.get("retcode"); @@ -62,7 +62,7 @@ public class StaffController { */ @Transactional @PostMapping("/addStaff") - Response addCustomer(@RequestBody UserVO vo) { + Response addStaff(@RequestBody UserVO vo) { Response resp = new Response(); Staff staff = vo.getStaff(); UserM user = vo.getUser(); @@ -98,7 +98,7 @@ public class StaffController { * 查询员工 */ @GetMapping("/queryStaff") - Response queryCustomer(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) { + Response queryStaff(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) { Response resp = new Response(); Staff staff = new Staff(); if (schoolId==null){ @@ -125,8 +125,8 @@ public class StaffController { resp.setErrmessage(ret.get("retvalue").toString()); } } - return resp; -} + return resp; + } /** * 查询员工详情 @@ -151,6 +151,40 @@ public class StaffController { return resp; } + /** + * 查询员工 + */ + @GetMapping("/getStaff") + Response getStaff(@RequestParam Integer schoolId,String nameAndNumber,String staffProfessionalArchitectureIds,Integer pageNo,Integer pageSize,String staffGradeIds) { + Response resp = new Response(); + Staff staff = new Staff(); + if (schoolId==null){ + resp.setStatus(300); + resp.setErrmessage("学校id为空,查询失败!"); + }else { + if (nameAndNumber!=null&&nameAndNumber!="") { + staff.setNameAndNumber(nameAndNumber); + } + if (staffProfessionalArchitectureIds!=null&&staffProfessionalArchitectureIds!="") { + staff.setStaffProfessionalArchitectureIds(staffProfessionalArchitectureIds); + } + if (staffGradeIds!=null&&staffGradeIds!="") { + staff.setStaffGradeIds(staffGradeIds); + } + staff.setSchoolId(schoolId); + HashMap ret = staffService.queryStaff(staff,pageNo,pageSize); + 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; + } + /** * 删除员工 */ diff --git a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java index 40efd6a..a3986b9 100644 --- a/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java +++ b/src/main/java/com/yipin/liuwanr/controller/UserInfoController.java @@ -6,7 +6,6 @@ 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 com.yipin.liuwanr.vo.UserVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -223,42 +222,19 @@ public class UserInfoController { * 更新用户 */ @Transactional - @PostMapping("/updateUser") - public Response updateUser(@RequestBody UserInfoVO vo) { + @PostMapping("/updateUserInfo") + public Response updateUserInfo(@RequestBody UserInfo userInfo) { Response resp = new Response(); - UserInfo user = vo.getUserInfo(); - Staff staff = vo.getStaff(); - Student student = vo.getStudent(); - Integer userId = user.getUserId(); + Integer userId = userInfo.getUserId(); if (userId==null) { resp.setStatus(300); resp.setErrmessage("用户ID为空,修改用户失败!"); } else { - HashMap ret = userInfoService.updateUser(user); + HashMap ret = userInfoService.updateUser(userInfo); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); resp.setMessage(ret.get("retvalue")); - HashMap sta = userInfoService.updateStaff(staff); - int staStatus = (int) sta.get("retcode"); - if (200 == status) { - resp.setStatus(staStatus); - resp.setMessage(sta.get("retvalue")); - HashMap stu = userInfoService.updateStudent(student); - int stuStatus = (int) stu.get("retcode"); - if (200 == status) { - resp.setStatus(stuStatus); - resp.setMessage(stu.get("retvalue")); - }else{ - resp.setStatus(stuStatus); - resp.setErrmessage(stu.get("retvalue").toString()); - throw new RuntimeException("修改学生失败!"); - } - }else{ - resp.setStatus(staStatus); - resp.setErrmessage(sta.get("retvalue").toString()); - throw new RuntimeException("修改员工失败!"); - } } else { resp.setStatus(status); resp.setErrmessage(ret.get("retvalue").toString()); @@ -268,6 +244,55 @@ public class UserInfoController { return resp; } + /** + * 更新用户个人档案 + */ + @Transactional + @PostMapping("/updateUserProfiles") + public Response updateUserProfiles(@RequestBody List userProfilesList) { + Response resp = new Response(); + if (userProfilesList.isEmpty()) { + resp.setStatus(300); + resp.setErrmessage("用户个人档案为空,修改失败!"); + } else { + HashMap ret = userInfoService.updateUserProfiles(userProfilesList); + 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()); + throw new RuntimeException("修改用户个人档案失败!"); + } + } + return resp; + } + + /** + * 更新用户组织关系 + */ + @Transactional + @PostMapping("/updateOR") + public Response updateOrganizationRelationship(@RequestBody List OrganizationRelationshipList) { + Response resp = new Response(); + if (OrganizationRelationshipList.isEmpty()) { + resp.setStatus(300); + resp.setErrmessage("用户组织关系为空,修改组织关系失败!"); + } else { + HashMap ret = userInfoService.updateOrganizationRelationship(OrganizationRelationshipList); + 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()); + throw new RuntimeException("修改用户失败!"); + } + } + return resp; + } /** * 登陆(前台传来的key必须是phone、password) @@ -401,18 +426,9 @@ public class UserInfoController { * 用户模块查询客户 */ @GetMapping("/queryCustomer") - Response queryCustomer(@RequestParam Integer cityId, Integer provinceId) { + Response queryCustomer(@RequestParam String searchContent,@RequestParam List customerIds) { Response resp = new Response(); - if(provinceId == null){ - resp.setStatus(300); - resp.setErrmessage("省份id为空!查询失败!"); - }else if (cityId==null) { - resp.setStatus(300); - resp.setErrmessage("城市id为空!查询失败!"); - }else { - HashMap ret = userInfoService.queryCustomer(cityId,provinceId); - resp.setStatus(200); - resp.setErrmessage("查询成功!"); + HashMap ret = userInfoService.queryCustomer(searchContent,customerIds); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -421,7 +437,6 @@ public class UserInfoController { resp.setStatus(status); resp.setErrmessage(ret.get("retvalue").toString()); } - } return resp; } @@ -452,13 +467,17 @@ public class UserInfoController { * 查询学号、工号是否存在 */ @GetMapping("/queryWorkNumberIsExist") - Response queryWorkNumberIsExist(@RequestParam String workNumber) { + Response queryWorkNumberIsExist(@RequestParam String workNumber,Integer roleId,Integer schoolId) { Response resp = new Response(); if (workNumber==null) { resp.setStatus(300); - resp.setErrmessage("账号为空!"); - }else { - HashMap ret = userInfoService.queryWorkNumberIsExist(workNumber); + resp.setErrmessage("学号、工号为空!"); + }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); @@ -470,4 +489,6 @@ public class UserInfoController { } return resp; } + + } \ No newline at end of file diff --git a/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java b/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java index 1be7df7..ff5aac8 100644 --- a/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java +++ b/src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java @@ -1,6 +1,8 @@ package com.yipin.liuwanr.entity; public class OrganizationRelationship { + //组织关系id + private Integer organizationRelationshipId; //用户id private Integer userId; //平台ID @@ -34,6 +36,14 @@ public class OrganizationRelationship { //班级名称 private String className; + public Integer getOrganizationRelationshipId() { + return organizationRelationshipId; + } + + public void setOrganizationRelationshipId(Integer organizationRelationshipId) { + this.organizationRelationshipId = organizationRelationshipId; + } + public Integer getUserId() { return userId; } diff --git a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java index 45eedcd..618feab 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java @@ -33,9 +33,9 @@ public interface ExperimentalClassMapper { @Select({" "}) - List queryExperimentalClass(Integer schoolId,Integer courseId); + List queryExperimentalClass(Integer schoolId,Integer courseId,Integer userId); //查询实验班级学生专业 @Select({""}) - Staff queryStaffQ(UserInfo user); + Staff queryStaffQ(UserM user); @Update("update staff set lastTimeOfLanding=#{lastTime},logNumber=#{logNumber} where staffId=#{staffId}") diff --git a/src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java b/src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java index d438b7b..0b35459 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java @@ -113,7 +113,7 @@ public interface StudentMapper { "and studentNumber=#{workNumber} ", "and uniqueIdentificationAccount=#{uniqueIdentificationAccount} ", ""}) - Student queryStudentQ(UserInfo user); + Student queryStudentQ(UserM user); @Update("update student set lastLoginTime=#{lastTime},loginNumber=#{loginNumber} where studentId=#{studentId}") diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java index 962a189..9a3d442 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java @@ -64,11 +64,49 @@ public interface UserInfoMapper { void deleteStudent(UserInfo user); //修改用户 - @Update("UPDATE user SET name = #{name},sex = #{sex},documentType = #{documentType},countries = #{countries},educationDegree = #{educationDegree}," - + "IDNumber = #{IDNumber},accountRole = #{accountRole},provinceId = #{provinceId},subjectsTaught = #{subjectsTaught},cityId = #{cityId}," - + "phone = #{phone},teachingProfessional = #{teachingProfessional},WeChatID = #{WeChatID},dateBirth = #{dateBirth},email = #{email},schoolId = #{schoolId},disciplineId = #{disciplineId},professionalId = #{professionalId},professionalClassId = #{professionalClassId} where userId = #{userId}") + @Update("UPDATE hr_user_info SET userName = #{userName},uniqueIdentificationAccount = #{uniqueIdentificationAccount},documentType = #{documentType},IDNumber = #{IDNumber},provinceId = #{provinceId}," + + "cityId = #{cityId},countries = #{countries},dateBirth = #{dateBirth},educationDegree = #{educationDegree},schoolId = #{schoolId}," + + "phone = #{phone},weChatID = #{weChatID},email = #{email},account = #{account},creationTime = #{creationTime},logInNumber = #{logInNumber},sex = #{sex},userAvatars = #{userAvatars} where userId = #{userId}") void updateUser(UserInfo user); + //修改用户个人档案 + @Update({ "" }) + void updateUserProfiles(UserProfiles userProfiles); + + //修改用户组织关系 + @Update({ "" }) + void updateOrganizationRelationship(OrganizationRelationship organizationRelationship); + //修改员工 @Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId}," + "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where phone = #{phone}") @@ -80,12 +118,12 @@ public interface UserInfoMapper { void updateStudent(Student student); //登陆 - @Select("SELECT * from hr_user_info where isdel=0 and account = #{account} and password = #{password}") + @Select("SELECT hui.account,hui.cityId,hui.countries,hui.creationTime,hui.dateBirth,hui.documentType,hui.educationDegree,hui.email,hui.iDNumber,hui.logInNumber,hui.phone,hui.provinceId,hui.schoolId,hui.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.account = #{account} and hui.password = #{password}") UserInfo logins(UserInfo userInfo); - //查询用户roleId - @Select("SELECT schoolId,roleId from hr_organization_relationship where userId = #{userId}") - OrganizationRelationship queryOrganizationRelationship(Integer userId); + //查询用户组织关系 + @Select("SELECT * from hr_organization_relationship where userId = #{userId}") + List queryOrganizationRelationship(Integer userId); //查询用户手机 @Select("SELECT u.* from user u where isdel=0 and phone = #{phone}") @@ -95,7 +133,7 @@ public interface UserInfoMapper { @Select({" "}) - List queryUserInfoDetails(Integer userId); + UserInfo queryUserInfoDetails(Integer userId); //查询用户详情 @Select({" "}) List queryUserProfiles(Integer userId); + //模糊查询客户 @Select({" "}) - List queryCustomer(Integer cityId, Integer provinceId); + List queryCustomer(@Param("searchContent")String searchContent, @Param("customerIds")List customerIds); /** * 批量插入用户 - * @param user + * @param users */ @Insert({ "