上传代码

master
zhiyong.ning 4 years ago
parent 75d3106b58
commit f22e354b0c
  1. 104
      src/main/java/com/yipin/liuwanr/controller/StaffController.java
  2. 202
      src/main/java/com/yipin/liuwanr/controller/StudentController.java
  3. 229
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  4. 44
      src/main/java/com/yipin/liuwanr/entity/Staff.java
  5. 42
      src/main/java/com/yipin/liuwanr/entity/Student.java
  6. 16
      src/main/java/com/yipin/liuwanr/entity/UserInfo.java
  7. 4
      src/main/java/com/yipin/liuwanr/helper/ExcelImportHelper.java
  8. 6
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  9. 12
      src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
  10. 18
      src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java
  11. 568
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  12. 2
      src/main/java/com/yipin/liuwanr/service/StaffService.java
  13. 2
      src/main/java/com/yipin/liuwanr/service/StudentService.java
  14. 247
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  15. 4
      src/test/java/com/yipin/liuwanr/service/StaffServiceTest.java
  16. 98
      src/test/java/com/yipin/liuwanr/service/StudentServiceTest.java

@ -289,58 +289,58 @@ public class StaffController {
/**
* 添加员工
*/
@Transactional
@PostMapping("/addStaff")
Response addStaff(@RequestBody UserInfoVO vo) {
Response resp = new Response();
//组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
UserInfo userInfo = vo.getUserInfo();
Integer userId = userInfo.getUserId();
String account = userInfo.getAccount();
Integer isNewUser = userInfo.getIsNewUser();
if (account==null||account=="") {
resp.setStatus(300);
resp.setErrmessage("账号为空添加失败!");
} else {
if (isNewUser==0){
HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
int status = (int) sta.get("retcode");
if (status == 200){
resp.setStatus(status);
resp.setMessage(sta.get("retvalue"));
}else{
resp.setStatus(status);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}else if(isNewUser==1){
HashMap<String, Object> ret = userInfoService.addUser(userInfo);
userId = (int) ret.get("userId");
int status = (int) ret.get("retcode");
if (status == 200){
HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
int status1 = (int) sta.get("retcode");
if (status1 == 200){
resp.setStatus(status1);
resp.setMessage(sta.get("retvalue"));
}else{
resp.setStatus(status1);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}else{
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
}
}else{
resp.setStatus(300);
resp.setErrmessage("新老用户为空添加失败!");
}
}
return resp;
}
// @Transactional
// @PostMapping("/addStaff")
// Response addStaff(@RequestBody UserInfoVO vo) {
// Response resp = new Response();
// //组织架构list
// List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
// UserInfo userInfo = vo.getUserInfo();
// Integer userId = userInfo.getUserId();
// String account = userInfo.getAccount();
// Integer isNewUser = userInfo.getIsNewUser();
// if (account==null||account=="") {
// resp.setStatus(300);
// resp.setErrmessage("账号为空添加失败!");
// } else {
// if (isNewUser==0){
// HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
// int status = (int) sta.get("retcode");
// if (status == 200){
// resp.setStatus(status);
// resp.setMessage(sta.get("retvalue"));
// }else{
// resp.setStatus(status);
// resp.setErrmessage(sta.get("retvalue").toString());
// throw new RuntimeException();
// }
// }else if(isNewUser==1){
// HashMap<String, Object> ret = userInfoService.addUser(userInfo);
// userId = (int) ret.get("userId");
// int status = (int) ret.get("retcode");
// if (status == 200){
// HashMap<String, Object> sta = userInfoService.addStuStaff(ORList,userId);
// int status1 = (int) sta.get("retcode");
// if (status1 == 200){
// resp.setStatus(status1);
// resp.setMessage(sta.get("retvalue"));
// }else{
// resp.setStatus(status1);
// resp.setErrmessage(sta.get("retvalue").toString());
// throw new RuntimeException();
// }
// }else{
// resp.setStatus(status);
// resp.setErrmessage(ret.get("retvalue").toString());
// throw new RuntimeException();
// }
// }else{
// resp.setStatus(300);
// resp.setErrmessage("新老用户为空添加失败!");
// }
// }
// return resp;
// }
/**
* 更新员工
*/

@ -36,18 +36,19 @@ public class StudentController {
/**
* 批量导入学生
*
* @param file
* @return
*/
@PostMapping("/readStudent")
Response readStudent(MultipartFile file,@RequestParam Integer schoolId){
Response readStudent(MultipartFile file, @RequestParam Integer schoolId) {
Response resp = new Response();
if(StringUtils.isEmpty(schoolId)) {
if (StringUtils.isEmpty(schoolId)) {
resp.setStatus(300);
resp.setMessage("schoolId is not empty");
return resp;
}
HashMap<String, Object> ret =studentService.readStudent(schoolId,file);
HashMap<String, Object> ret = studentService.readStudent(schoolId, file);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@ -56,8 +57,8 @@ public class StudentController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
return resp;
}
return resp;
}
// /**
@ -99,15 +100,15 @@ public class StudentController {
/**
* 查询学生详情
* 查询学生详情
*/
@GetMapping("/queryStudentDetails")
Response queryStudentDetails(@RequestParam Integer studentId) {
Response resp = new Response();
if (studentId==null) {
if (studentId == null) {
resp.setStatus(300);
resp.setErrmessage("学生id为空,查询失败!");
}else {
} else {
HashMap<String, Object> ret = studentService.queryStudentDetails(studentId);
int status = (int) ret.get("retcode");
if (200 == status) {
@ -118,8 +119,8 @@ public class StudentController {
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
return resp;
}
//
// /**
// * 根据professionalIds(专业id)查询所有学生
@ -218,7 +219,7 @@ public class StudentController {
// }
/**
* 更新学生
* 更新学生
*/
@PostMapping("/updateStudent")
Response updateStudent(@RequestBody UserVO vo) {
@ -227,10 +228,10 @@ public class StudentController {
UserM user = vo.getUser();
Integer studentId = student.getStudentId();
String phone = user.getPhone();
if (studentId==null) {
if (studentId == null) {
resp.setStatus(300);
resp.setErrmessage("学生id为空,修改失败!");
}else if (phone==null||phone==""){
} else if (phone == null || phone == "") {
resp.setStatus(300);
resp.setErrmessage("电话为空,修改失败!");
} else {
@ -246,6 +247,7 @@ public class StudentController {
}
return resp;
}
}
/**
* 添加学生信息
@ -253,54 +255,54 @@ public class StudentController {
* UserInfo:account,userName,roleId,uniqueIdentificationAccount,phone,email,schoolId
* OrganizationRelationship:workNumber,professionalClassId,gradeId,classId,schoolId
*/
@Transactional
@PostMapping("/addStudent")
Response addStudent(@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<String, Object> ret = userInfoService.addUserInfo(userInfo);
int status = (int) ret.get("retcode");
if (200 == status) {
response.setStatus(status);
response.setMessage(ret.get("retvalue"));
Integer userId = userInfo.getUserId();
organizationRelationship.setUserId(userId);
HashMap<String, Object> 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;
}
// @Transactional
// @PostMapping("/addStudent")
// Response addStudent(@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<String, Object> ret = userInfoService.addUserInfo(userInfo);
// int status = (int) ret.get("retcode");
// if (200 == status) {
// response.setStatus(status);
// response.setMessage(ret.get("retvalue"));
// Integer userId = userInfo.getUserId();
// organizationRelationship.setUserId(userId);
// HashMap<String, Object> 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;
// }
/**
* 查询学生信息
@ -313,32 +315,32 @@ public class StudentController {
* @param pageSize
* @return
*/
@GetMapping("/queryStudent")
Response queryStudent(@RequestParam Integer schoolId, String professionalIds, String searchContent, String gradeIds, String classIds, Integer pageNo, Integer pageSize) {
Response response = new Response();
StudentInfo studentInfo = new StudentInfo();
if (schoolId == null) {
response.setStatus(300);
response.setErrmessage("学校信息为空");
} else {
if (searchContent != null && searchContent != "") {
studentInfo.setSearchContent(searchContent);
}
if (professionalIds!=null&&professionalIds!="") {
studentInfo.setProfessionalIds(professionalIds);
}
if (gradeIds!=null&&gradeIds!="") {
studentInfo.setGradeIds(gradeIds);
}
if (classIds!=null&&classIds!="") {
studentInfo.setClassIds(classIds);
}
studentInfo.setSchoolId(schoolId);
HashMap map = userInfoService.queryStudent(studentInfo,pageNo,pageSize);
QueryStudentUtils.statusInformationController(response,map, "retcode", "retvalue");
}
return response;
}
// @GetMapping("/queryStudent")
// Response queryStudent(@RequestParam Integer schoolId, String professionalIds, String searchContent, String gradeIds, String classIds, Integer pageNo, Integer pageSize) {
// Response response = new Response();
// StudentInfo studentInfo = new StudentInfo();
// if (schoolId == null) {
// response.setStatus(300);
// response.setErrmessage("学校信息为空");
// } else {
// if (searchContent != null && searchContent != "") {
// studentInfo.setSearchContent(searchContent);
// }
// if (professionalIds!=null&&professionalIds!="") {
// studentInfo.setProfessionalIds(professionalIds);
// }
// if (gradeIds!=null&&gradeIds!="") {
// studentInfo.setGradeIds(gradeIds);
// }
// if (classIds!=null&&classIds!="") {
// studentInfo.setClassIds(classIds);
// }
// studentInfo.setSchoolId(schoolId);
// HashMap map = userInfoService.queryStudent(studentInfo,pageNo,pageSize);
// QueryStudentUtils.statusInformationController(response,map, "retcode", "retvalue");
// }
// return response;
// }
/**
* 批量删除学生
@ -346,16 +348,16 @@ public class StudentController {
* @param userId 用户id
* @return
*/
@GetMapping("/deleteStudent")
Response deleteStudent(Integer[] userId) {
Response response = new Response();
if (userId!=null&&userId.length > 0) {
userInfoService.deleteStudent(userId);
response.setStatus(200);
} else {
response.setStatus(500);
response.setErrmessage("学生id不能为空");
}
return response;
}
}
// @GetMapping("/deleteStudent")
// Response deleteStudent(Integer[] userId) {
// Response response = new Response();
// if (userId!=null&&userId.length > 0) {
// userInfoService.deleteStudent(userId);
// response.setStatus(200);
// } else {
// response.setStatus(500);
// response.setErrmessage("学生id不能为空");
// }
// return response;
// }
//}

@ -5,6 +5,7 @@ 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.service.UserService;
import com.yipin.liuwanr.vo.UserInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -30,119 +31,11 @@ public class UserInfoController {
private UserInfoService userInfoService;
@Autowired
RedisHelper redisHelper;
private UserService userService;
@Autowired
RedisHelper redisHelper;
// /**
// * 接收参数:
// * UserInfo:account,userName,roleId,uniqueIdentificationAccount,phone,email
// * OrganizationRelationship:workNumber,professionalClassId,gradeId,classId
// */
// @Transactional
// @PostMapping("/addStudent")
// Response addStudent(@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<String, Object> ret = userInfoService.addUserInfo(userInfo);
// int status = (int) ret.get("retcode");
// if (200 == status) {
// response.setStatus(status);
// response.setMessage(ret.get("retvalue"));
// Integer userId = userInfo.getUserId();
// organizationRelationship.setUserId(userId);
// HashMap<String, Object> 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, String professionalIds, String searchContent, String gradeIds, String classIds, Integer pageNo, Integer pageSize) {
// Response response = new Response();
// StudentInfo studentInfo = new StudentInfo();
// if (schoolId == null) {
// response.setStatus(300);
// response.setErrmessage("学校信息为空");
// } else {
// if (searchContent != null && searchContent != "") {
// studentInfo.setSearchContent(searchContent);
// }
// if (professionalIds!=null&&professionalIds!="") {
// studentInfo.setProfessionalIds(professionalIds);
// }
// if (gradeIds!=null&&gradeIds!="") {
// studentInfo.setGradeIds(gradeIds);
// }
// if (classIds!=null&&classIds!="") {
// studentInfo.setClassIds(classIds);
// }
// studentInfo.setSchoolId(schoolId);
// HashMap map = userInfoService.queryStudent(studentInfo,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;
// }
/**
* 添加用户
@ -153,16 +46,16 @@ public class UserInfoController {
Response resp = new Response();
//个人档案实体
List<UserProfiles> userProfilesList = vo.getUserProfilesList();
//组织架构list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList();
//员工list
List<Staff> staffList = vo.getStaffList();
//学生实体
Student student = vo.getStudent();
//用户实体
UserInfo user = vo.getUserInfo();
//用户手机
//用户
String account = user.getAccount();
//用户名称
String name = user.getUserName();
//用户角色id
Integer roleId = user.getRoleId();
//学校id
Integer schoolId = user.getSchoolId();
if(name==null||name==""){
@ -175,32 +68,11 @@ public class UserInfoController {
resp.setStatus(300);
resp.setErrmessage("学校不能为空!");
}else {
HashMap<String, Object> ret = userInfoService.addUser(user);
Integer userId = user.getUserId();
HashMap<String, Object> ret = userInfoService.addUser(user,student,staffList,userProfilesList);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> 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<String, Object> 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());
@ -214,7 +86,7 @@ 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 queryUserInfo(@RequestParam String countries, Integer provinceId, Integer cityId, Integer pageNo, Integer pageSize, Integer schoolId, String roleId, String searchContent, Integer month, String creationTime, String endTime) {
Response resp = new Response();
UserInfo userInfo = new UserInfo();
//设置国家
@ -272,7 +144,7 @@ public class UserInfoController {
@PostMapping("/deleteUserInfo")
public Response deleteUserInfo(@RequestBody List<Integer> userIdList) {
Response resp = new Response();
if (userIdList==null) {
if (userIdList.isEmpty()) {
resp.setStatus(300);
resp.setErrmessage("用户id为空,删除用户失败!");
} else {
@ -281,17 +153,7 @@ public class UserInfoController {
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> 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 {
}else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
@ -326,6 +188,36 @@ public class UserInfoController {
return resp;
}
/**
* 更新用户角色id
*/
@Transactional
@PostMapping("/updateUserRoleId")
public Response updateUserRoleId(@RequestBody UserInfo userInfo) {
Response resp = new Response();
Integer userId = userInfo.getUserId();
String roleId = userInfo.getRoleId();
if (userId==null) {
resp.setStatus(300);
resp.setErrmessage("用户ID为空,修改用户失败!");
}else if (roleId==null){
resp.setStatus(300);
resp.setErrmessage("用户ID为空,修改用户失败!");
} else {
HashMap<String, Object> ret = userInfoService.updateUserRoleId(userId,roleId);
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;
}
/**
* 更新用户个人档案
*/
@ -357,13 +249,15 @@ public class UserInfoController {
*/
@Transactional
@PostMapping("/updateOR")
public Response updateOrganizationRelationship(@RequestBody List<OrganizationRelationship> OrganizationRelationshipList) {
public Response updateOrganizationRelationship(@RequestBody UserInfoVO vo) {
Response resp = new Response();
if (OrganizationRelationshipList.isEmpty()) {
List<Staff> staffList = vo.getStaffList();
List<Student> studentList = vo.getStudentList();
if (staffList.isEmpty()&&studentList.isEmpty()) {
resp.setStatus(300);
resp.setErrmessage("用户组织关系为空,修改组织关系失败!");
} else {
HashMap<String, Object> ret = userInfoService.updateOrganizationRelationship(OrganizationRelationshipList);
HashMap<String, Object> ret = userInfoService.updateOR(staffList,studentList);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@ -410,7 +304,7 @@ 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") String roleId, HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response();
UserInfo userInfo = new UserInfo();
if (userId == null) {
@ -742,4 +636,29 @@ public class UserInfoController {
}
return resp;
}
/**
* 查询平台
*/
@GetMapping("/queryStuAndSta")
Response queryStuAndSta(@RequestParam Integer platformId,Integer userId) {
Response resp = new Response();
UserInfo userInfo = new UserInfo();
//平台id
if (platformId==null) {
resp.setStatus(300);
resp.setErrmessage("平台id为空!");
}else{
HashMap<String, Object> ret = userInfoService.queryStuAndSta(platformId,userId);
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;
}
}

@ -1,6 +1,8 @@
package com.yipin.liuwanr.entity;
public class Staff {
//绑定用户id
private Integer userId;
//账号
private String account;
//员工主键ID
@ -8,7 +10,7 @@ public class Staff {
//员工名称
private String staffName;
//员工工号
private String staffWorkNumber;
private String workNumber;
//电话
private String phone;
//邮件
@ -37,7 +39,26 @@ public class Staff {
private String staffProfessionalArchitectureIds;
//绑定学校id
private Integer schoolId;
//绑定学校名称
private String schoolName;
//平台id
private Integer platformId;
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public String getAccount() {
return account;
}
@ -46,6 +67,14 @@ public class Staff {
this.account = account;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getSchoolId() {
return schoolId;
}
@ -106,12 +135,15 @@ public class Staff {
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getStaffWorkNumber() {
return staffWorkNumber;
public String getWorkNumber() {
return workNumber;
}
public void setStaffWorkNumber(String staffWorkNumber) {
this.staffWorkNumber = staffWorkNumber;
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public String getPhone() {
return phone;
}
@ -154,7 +186,7 @@ public class Staff {
return "Staff{" +
"staffId=" + staffId +
", staffName='" + staffName + '\'' +
", staffWorkNumber='" + staffWorkNumber + '\'' +
", workNumber='" + workNumber + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", logNumber=" + logNumber +

@ -2,6 +2,8 @@ package com.yipin.liuwanr.entity;
public class Student {
//绑定用户id
private Integer userId;
//账号
private String account;
//学生主键ID
@ -9,7 +11,7 @@ public class Student {
//学生名称
private String studentName;
//学生学号
private String studentNumber;
private String workNumber;
//电话
private String phone;
//邮箱
@ -18,6 +20,8 @@ public class Student {
private Integer roleId;
//绑定学校ID
private Integer schoolId;
//绑定学校名称
private String schoolName;
//绑定专业ID
private Integer professionalId;
//绑定年级ID
@ -58,6 +62,32 @@ public class Student {
private String attendance;
//学生专业组织架构名称
private String stuProfessionalArchitectureName;
//平台id
private Integer platformId;
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getAccount() {
return account;
@ -163,11 +193,11 @@ public class Student {
public void setStudentName(String studentName) {
this.studentName = studentName;
}
public String getStudentNumber() {
return studentNumber;
public String getWorkNumber() {
return workNumber;
}
public void setStudentNumber(String studentNumber) {
this.studentNumber = studentNumber;
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public String getPhone() {
return phone;
@ -235,7 +265,7 @@ public class Student {
return "Student{" +
"studentId=" + studentId +
", studentName='" + studentName + '\'' +
", studentNumber='" + studentNumber + '\'' +
", workNumber='" + workNumber + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", roleId=" + roleId +

@ -11,7 +11,7 @@ public class UserInfo {
//用户id
private Integer userId;
//角色id
private Integer roleId;
private String roleId;
//用户姓名
private String userName;
//用户账号
@ -92,8 +92,6 @@ public class UserInfo {
private String oneDepartmentName;
//二级部门名称
private String twoDepartmentName;
//是否新用户
private Integer isNewUser;
//组织架构id
private Integer organizationRelationshipId;
@ -105,14 +103,6 @@ public class UserInfo {
this.organizationRelationshipId = organizationRelationshipId;
}
public Integer getIsNewUser() {
return isNewUser;
}
public void setIsNewUser(Integer isNewUser) {
this.isNewUser = isNewUser;
}
public String getWorkNumber() {
return workNumber;
}
@ -441,11 +431,11 @@ public class UserInfo {
this.professionalName = professionalName;
}
public Integer getRoleId() {
public String getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
public void setRoleId(String roleId) {
this.roleId = roleId;
}

@ -147,7 +147,7 @@ public class ExcelImportHelper {
// 角色id
student.setRoleId(4);
// 学生学号
student.setStudentNumber(studentNumber.getStringCellValue());
student.setWorkNumber(studentNumber.getStringCellValue());
//专业
student.setProfessionalName(professionalName.getStringCellValue());
//年级
@ -209,7 +209,7 @@ public class ExcelImportHelper {
// 角色id
staff.setRoleId(3);
// 职工工号
staff.setStaffWorkNumber(staffWorkNumber.getStringCellValue());
staff.setWorkNumber(staffWorkNumber.getStringCellValue());
// 专业
staff.setStaffProfessionalArchitectureName(staffProfessionalArchitectureName.getStringCellValue());
//部门

@ -41,9 +41,9 @@ public interface AssesmentMapper {
*/
@Select({"<script>",
"SELECT a.id,a.assesmentName as assesmentName,a.assessmentSize as assessmentSize,p.projectName as projectName,a.timeSum as timeSum,GROUP_CONCAT(c.className) as className,"
+ "a.releaseType as releaseType,a.creationTime as creationTime,a.endTime as endTime,a.assesmentState as assesmentState FROM "
+ "(assessment a left join hr_project_management p on a.experimentId=p.projectId ) left join class c on FIND_IN_SET(c.classId,a.classId )>0 "
+ "WHERE a.staffId=#{staffId} AND a.courseId=#{courseId} ",
+ "a.releaseType as releaseType,a.creationTime as creationTime,a.endTime as endTime,a.assesmentState as assesmentState FROM "
+ "(assessment a left join hr_project_management p on a.experimentId=p.projectId ) left join class c on FIND_IN_SET(c.classId,a.classId )>0 "
+ "WHERE a.staffId=#{staffId} AND a.courseId=#{courseId} ",
" <if test='month==1'>and a.creationTime>DATE_SUB(CURDATE(), INTERVAL 1 MONTH)</if>",
" <if test='month==3'>and a.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>",
" <if test='month==6'>and a.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>",

@ -13,7 +13,7 @@ public interface StaffMapper {
// @Insert("INSERT INTO staff(staffName,staffWorkNumber,phone,email,staffProfessionalArchitectureId,staffGradeId,roleId,isdel,uniqueIdentificationAccount,schoolId)VALUES(#{staffName},#{staffWorkNumber},#{phone},#{email},#{staffProfessionalArchitectureId},#{staffGradeId},#{roleId},0,#{uniqueIdentificationAccount},#{schoolId})")
// void addStaff(Staff staff);
//添加员工
@Insert("INSERT INTO staff(staffName,staffWorkNumber,phone,email,staffProfessionalArchitectureId,staffGradeId,roleId,isdel,uniqueIdentificationAccount,schoolId)VALUES(#{staffName},#{staffWorkNumber},#{phone},#{email},#{staffProfessionalArchitectureId},#{staffGradeId},#{roleId},0,#{uniqueIdentificationAccount},#{schoolId})")
@Insert("INSERT INTO staff(staffName,workNumber,phone,email,staffProfessionalArchitectureId,staffGradeId,roleId,isdel,uniqueIdentificationAccount,schoolId)VALUES(#{staffName},#{workNumber},#{phone},#{email},#{staffProfessionalArchitectureId},#{staffGradeId},#{roleId},0,#{uniqueIdentificationAccount},#{schoolId})")
void addStaff(Staff staff);
@Select({"<script>",
@ -53,7 +53,7 @@ public interface StaffMapper {
List<OrganizationRelationship> queryRole(Integer userId);
//修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
@Update("UPDATE staff SET staffName = #{staffName},workNumber = #{workNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
+ "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where staffId = #{staffId}")
void updateStaff(Staff staff);
@ -91,9 +91,9 @@ public interface StaffMapper {
*/
@Insert({
"<script>",
"insert into staff(staffName,staffWorkNumber,staffGradeId,staffProfessionalArchitectureId,roleId,phone,uniqueIdentificationAccount,email,schoolId,isdel) values ",
"insert into staff(staffName,workNumber,staffGradeId,staffProfessionalArchitectureId,roleId,phone,uniqueIdentificationAccount,email,schoolId,isdel) values ",
"<foreach collection='list' item='staff' index='index' separator=','>",
"(#{staff.staffName}, #{staff.staffWorkNumber}, #{staff.staffGradeId},#{staff.staffProfessionalArchitectureId}, #{staff.roleId} ,#{staff.phone},#{staff.uniqueIdentificationAccount},#{staff.email},#{staff.schoolId},0)",
"(#{staff.staffName}, #{staff.workNumber}, #{staff.staffGradeId},#{staff.staffProfessionalArchitectureId}, #{staff.roleId} ,#{staff.phone},#{staff.uniqueIdentificationAccount},#{staff.email},#{staff.schoolId},0)",
"</foreach>",
"</script>"
})
@ -110,9 +110,9 @@ public interface StaffMapper {
//=======全承珠
@Select({"<script>",
"select staffId,staffWorkNumber,logNumber from staff where isdel=0",
"select staffId,workNumber,logNumber from staff where isdel=0",
"<if test='phone!=null'>and phone=#{phone} </if>",
"<if test='workNumber!=null'>and staffWorkNumber=#{workNumber} </if>",
"<if test='workNumber!=null'>and workNumber=#{workNumber} </if>",
"<if test='uniqueIdentificationAccount!=null'>and uniqueIdentificationAccount=#{uniqueIdentificationAccount} </if>",
"</script>"})
Staff queryStaffQ(UserM user);

@ -14,8 +14,8 @@ import io.lettuce.core.dynamic.annotation.Param;
public interface StudentMapper {
//添加学生
@Insert("INSERT INTO student(studentName,studentNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId,isdel,uniqueIdentificationAccount)"
+ "VALUES(#{studentName},#{studentNumber},#{phone},#{email},#{roleId},#{schoolId},#{professionalId},#{gradeId},#{classId},0,#{uniqueIdentificationAccount})")
@Insert("INSERT INTO student(studentName,workNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId,isdel,uniqueIdentificationAccount)"
+ "VALUES(#{studentName},#{workNumber},#{phone},#{email},#{roleId},#{schoolId},#{professionalId},#{gradeId},#{classId},0,#{uniqueIdentificationAccount})")
void addStudent(Student student);
//通过专业id查询所有学生信息
@ -47,7 +47,7 @@ public interface StudentMapper {
//查询学生详情
@Select({ "<script>",
"SELECT uniqueIdentificationAccount,studentName,studentNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId from student where isdel = 0 and studentId = #{studentId}",
"SELECT uniqueIdentificationAccount,studentName,workNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId from student where isdel = 0 and studentId = #{studentId}",
"</script> " })
List<Student> queryStudentDetails(Integer studentId);
@ -63,12 +63,12 @@ public interface StudentMapper {
//查询学生详情
@Select({ "<script>",
"SELECT s.uniqueIdentificationAccount,s.studentName,s.studentNumber,s.phone,s.email,s.roleId,s.schoolId,s.professionalId,s.gradeId,s.classId,u.* from student s,user u where s.isdel = 0 and s.studentId = #{studentId} and s.phone = u.phone",
"SELECT s.uniqueIdentificationAccount,s.studentName,s.workNumber,s.phone,s.email,s.roleId,s.schoolId,s.professionalId,s.gradeId,s.classId,u.* from student s,user u where s.isdel = 0 and s.studentId = #{studentId} and s.phone = u.phone",
"</script> " })
List<UserM> queryStudentDetailsU(Integer studentId);
//修改学生
@Update("UPDATE student SET studentName = #{studentName},studentNumber = #{studentNumber},phone = #{phone},email = #{email},roleId = #{roleId}"
@Update("UPDATE student SET studentName = #{studentName},workNumber = #{workNumber},phone = #{phone},email = #{email},roleId = #{roleId}"
+ ",schoolId = #{schoolId},professionalId = #{professionalId},gradeId = #{gradeId},classId = #{classId} where studentId = #{studentId}")
void updateStudent(Student student);
@ -95,9 +95,9 @@ public interface StudentMapper {
@Insert({ "<script>",
"insert into student(studentName, studentNumber,phone,roleId,schoolId,professionalId,gradeId,classId,uniqueIdentificationAccount,email,isAssess,isdel) values ",
"insert into student(studentName, workNumber,phone,roleId,schoolId,professionalId,gradeId,classId,uniqueIdentificationAccount,email,isAssess,isdel) values ",
"<foreach collection='list' item='student' index='index' separator=','>",
"(#{student.studentName}, #{student.studentNumber}, #{student.phone},#{student.roleId},#{student.schoolId},#{student.professionalId},#{student.gradeId}, #{student.classId} ,#{student.uniqueIdentificationAccount},#{student.email},0,0)",
"(#{student.studentName}, #{student.workNumber}, #{student.phone},#{student.roleId},#{student.schoolId},#{student.professionalId},#{student.gradeId}, #{student.classId} ,#{student.uniqueIdentificationAccount},#{student.email},0,0)",
"</foreach>", "</script>" })
void bacthAddStudent(@Param("students") List<Student> students);
@ -111,9 +111,9 @@ public interface StudentMapper {
//========全承珠
@Select({"<script>",
"select studentId,studentNumber,classId,loginNumber from student where isdel=0",
"select studentId,workNumber,classId,loginNumber from student where isdel=0",
"<if test='phone!=null'>and phone=#{phone} </if>",
"<if test='workNumber!=null'>and studentNumber=#{workNumber} </if>",
"<if test='workNumber!=null'>and workNumber=#{workNumber} </if>",
"<if test='uniqueIdentificationAccount!=null'>and uniqueIdentificationAccount=#{uniqueIdentificationAccount} </if>",
"</script>"})
Student queryStudentQ(UserM user);

@ -9,272 +9,304 @@ import org.apache.ibatis.mapping.FetchType;
import java.util.List;
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)")
@Options(useGeneratedKeys=true, keyProperty="userId", keyColumn="userId")
Integer insertUserInfo(UserInfo userInfo);
@Select({"<script>" ,
"SELECT DISTINCT\n" +
"\tu.logInNumber,\n" +
"\tu.userName,\n" +
"\tu.lastLoginTime,\n" +
"\to.roleId,\n" +
"\to.gradeId,\n" +
"\to.classId,\n" +
"\to.workNumber,\n" +
"\to.professionalId \n" +
"FROM\n" +
"\thr_user_info u,\n" +
"\thr_organization_relationship o \n" +
"WHERE\n" +
"\to.roleId = 4 \n" +
"\tAND u.schoolId = 1 \n" +
"\tAND u.isdel = 0 \n",
"<if test='searchContent!=null'>AND (u.userName like CONCAT('%',#{searchContent},'%') or u.userId like CONCAT('%',#{searchContent},'%'))</if>",
"<if test='gradeIds!=null'>and FIND_IN_SET(o.gradeId,#{gradeIds})</if>",
"<if test='professionalIds!=null'>and FIND_IN_SET(o.professionalId,#{professionalIds})</if>",
"<if test='classIds!=null'>and FIND_IN_SET(o.classId,#{classIds})</if>",
"ORDER BY o.classId desc",
"</script>"})
List<StudentInfo> queryStudent(StudentInfo studentInfo);
@Update({"<script>" +
"UPDATE hr_user_info SET isdel=1 WHERE userId IN " +
"<foreach collection='list' item='userId' index='index' separator=',' open='(' close=')'>#{userId}</foreach>" +
"</script>"})
Integer updateStudentInfo(List list);
@Update({ "<script>",
"UPDATE lw_user SET",
"<when test='mobile!=null'>", "mobile=#{mobile},", "</when>",
"<when test='email!=null'>", "email=#{email},", "</when>",
"<when test='nickname!=null'>", "nickname=#{nickname},", "</when>",
"<when test='sex!=-1'>", "sex=#{sex},", "</when>",
"<when test='sign!=null'>", "sign=#{sign},", "</when>",
"<when test='birthday!=null'>", "birthday=#{birthday},", "</when>",
"<when test='avatar!=null'>", "avatar=#{avatar},", "</when>",
"<when test='country!=null'>", "country=#{country},", "</when>",
"<when test='province!=null'>", "province=#{province},", "</when>",
"<when test='city!=null'>", "city=#{city},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
"</script>"})
void update(User user);
@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(),0,#{sex},#{userAvatars},0)")
@Options(useGeneratedKeys=true, keyProperty="userId", keyColumn="userId")
void addUser(UserInfo user);
@Select({"<script>",
"SELECT u.userId,u.userName,s.schoolName,s.provinceId,s.cityId,s.provinceName,s.cityName,u.countries,u.creationTime,u.account,u.logInNumber,u.schoolId,hor.platformId,hor.roleId FROM hr_user_info u,hr_organization_relationship hor,school s WHERE u.userId = hor.userId and u.schoolId = s.schoolId and u.isdel = 0 and hor.isdel = 0",
" <if test='countries!=null and countries !=\"\" '>and u.countries = #{countries} </if>",
" <if test='provinceId!=null and provinceId !=\"\" '>and s.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null and schoolId !=\"\"'>and u.schoolId = #{schoolId} </if>",
" <if test='cityId!=null and cityId !=\"\" '>and s.cityId = #{cityId} </if>",
" <if test='roleId!=null and roleId !=\"\" '>and hor.roleId = #{roleId} </if>",
" <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.userName, s.schoolName,u.account) LIKE CONCAT('%',#{searchContent},'%')</if>",
" <if test='month==3'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>",
" <if test='month==6'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>",
" <if test='month==9'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)</if>",
" <if test='month==12'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 12 MONTH)</if>",
" <if test='creationTime!=null and endTime!=null and endTime!=\"\" and creationTime!=\"\" '> and u.creationTime between #{creationTime} and #{endTime}</if>",
"GROUP BY u.userId order by u.creationTime desc",
"</script> "})
List<UserInfo> queryUserInfo(UserInfo userInfo);
@Update( {"<script>",
"UPDATE hr_user_info set isdel=1 where userId = #{userId}",
"</script>" })
void deleteUser(Integer 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},sex = #{sex},userAvatars = #{userAvatars} where userId = #{userId}")
void updateUser(UserInfo user);
//修改个人档案添加功能(删除后添加用户个人档案)
@Insert({ "<script>",
"INSERT INTO hr_personal_file(personalCareerId,schoolId,schoolName,disciplineId,disciplineName,professionalClassId,professionalClassName,professionalId,professionalName,userId,updatetime) values " +
"(#{personalCareerId},#{schoolId},#{schoolName},#{disciplineId},#{disciplineName},#{professionalClassId},#{professionalClassName},#{professionalId},#{professionalName},#{userId},now())",
"</script>" })
void updateUserProfiles(UserProfiles userProfiles);
//修改个人档案删除功能
@Delete( {"<script>",
"Delete from hr_personal_file where userId = #{userId}",
"</script>" })
void deleteUserProfiles(Integer userId);
//修改用户组织关系添加功能
@Insert({ "<script>",
"INSERT INTO hr_organization_relationship(userId,platformId,schoolId,schoolName,roleId,workNumber,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,professionalId,professionalName,gradeId,gradeName,classId,className,updatetime,customerId) " +
"VALUES(#{userId},#{platformId},#{schoolId},#{schoolName},#{roleId},#{workNumber},#{oneDepartmentId},#{oneDepartmentName},#{twoDepartmentId},#{twoDepartmentName},#{professionalId},#{professionalName},#{gradeId},#{gradeName},#{classId},#{className},now(),#{customerId})",
"</script>" })
void updateOrganizationRelationship(OrganizationRelationship organizationRelationship);
//修改用户组织架构删除功能
@Delete( {"<script>",
"Delete from hr_organization_relationship where userId = #{userId} and platformId = #{platformId}",
"</script>" })
void deleteOR(Integer userId,Integer platformId);
//修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
+ "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where phone = #{phone}")
void updateStaff(Staff staff);
//修改学生
@Update("UPDATE student SET studentName = #{studentName},studentNumber = #{studentNumber},phone = #{phone},email = #{email},roleId = #{roleId}"
+ ",schoolId = #{schoolId},professionalId = #{professionalId},gradeId = #{gradeId},classId = #{classId} where phone = #{phone}")
void updateStudent(Student student);
//登陆
@Select("SELECT hui.schoolId,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.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ")
UserInfo logins(UserInfo userInfo);
//登陆账号密码
@Select("SELECT hui.schoolId,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.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 password = #{password} ")
UserInfo loginsAP(UserInfo userInfo);
//查询用户角色
@Select("SELECT userId,roleId from hr_organization_relationship where userId = #{userId} and schoolId = #{schoolId}")
List<OrganizationRelationship> loginRole(Integer userId,Integer schoolId);
//查询用户组织关系
@Select("SELECT schoolId,schoolName,userId from hr_organization_relationship where userId = #{userId} GROUP BY schoolId")
List<OrganizationRelationship> queryOrganizationRelationship(Integer userId);
//查询用户组织关系
@Select("SELECT * from hr_organization_relationship where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}")
List<OrganizationRelationship> queryOrganizationRelationshipAll(Integer userId,Integer roleId,Integer schoolId);
//查询用户绑定平台信息
@Select("SELECT hp.* FROM hr_platform hp,hr_organization_relationship hor WHERE hor.platformId = hp.platformId and hor.userId = #{userId} and hor.isdel = 0 GROUP BY platformId")
List<Platform> queryUserPlatform(Integer userId);
//查询用户手机
@Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}")
List<UserInfo> queryPhone(String phone);
//查询用户详情
@Select({"<script>",
"SELECT * from hr_user_info where isdel = 0 and userId = #{userId}",
"</script> "})
UserInfo queryUserInfoDetails(Integer userId);
//查询用户详情
@Select({"<script>",
"SELECT * from hr_personal_file where userId = #{userId}",
"</script> "})
List<UserProfiles> queryUserProfiles(Integer userId);
//查询用户组织架构详情
@Select({"<script>",
"SELECT * from hr_organization_relationship where userId = #{userId} and platformId = #{platformId}",
"</script> "})
List<OrganizationRelationship> queryUserOR(Integer userId,Integer platformId);
//查询用户组织架构详情
@Select({"<script>",
"SELECT * from hr_organization_relationship where userId = #{userId}",
"</script> "})
List<OrganizationRelationship> queryUserIdOR(Integer userId);
//模糊查询客户
@Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0",
" <if test='searchContent!=null and searchContent !=\"\" '>and customerName like CONCAT('%',#{searchContent},'%')</if>",
" <if test='customerIds!=null'>"
+ "<foreach collection='customerIds' item='customerIds' open='and customerId not in (' separator=',' close=')'> #{customerIds}"
+"</foreach>"
+ "</if>",
"</script> "})
List<Customer> queryCustomer(@Param("searchContent")String searchContent, @Param("customerIds")List<Integer> customerIds);
/**
* 批量插入用户
* @param users
*/
@Insert({
"<script>",
"insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ",
"<foreach collection='users' item='user' index='index' separator=','>",
"(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)",
"</foreach>",
"</script>"
})
void addUserM(@Param("users") List<UserM> users);
//修改用户头像
@Update("update hr_user_info set userAvatars=#{userAvatars} where userId=#{userId}")
void updateUserAvatars(@Param("userAvatars") String userAvatars, @Param("userId") Integer userId);
//更新用户登录次数和最后一次登录时间
@Update({ "UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"})
void updateLogInNumber(UserM user);
//更新学生登录次数和最后一次登录时间
@Update({ "UPDATE student SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE phone=#{phone}"})
void updateStudentLogInNumber(UserM user);
//更新员工登录次数和最后一次登录时间
@Update({ "UPDATE staff SET logNumber=logNumber+1, lastTimeOfLanding=now() WHERE phone=#{phone}"})
void updateStaffLogInNumber(UserM user);
//查询账号是否存在
@Select("SELECT account,email,userName,userId,uniqueIdentificationAccount,phone from hr_user_info where isdel = 0 and account = #{account}")
List<UserInfo> queryAccountIsExist(String account);
//查询账号是否存在
@Select("SELECT hor.* from hr_organization_relationship hor,hr_user_info hui where hor.isdel = 0 and hui.account = #{account} and hor.userId = hui.userId and hor.schoolId = #{schoolId}")
List<OrganizationRelationship> queryAccountIsExistOR(String account,Integer schoolId);
//查询学号、工号是否存在
@Select("SELECT userId,workNumber,schoolId,roleId from hr_organization_relationship where workNumber = #{workNumber} and roleId = #{roleId} and schoolId = #{schoolId}")
List<OrganizationRelationship> queryWorkNumberIsExist(String workNumber,Integer roleId,Integer schoolId);
//查询平台
@Select("SELECT platformId,platformName,domainName,createTime from hr_platform where FIND_IN_SET (platformId,#{platformId})")
List<Platform> queryPlatform(String platformId);
//删除平台
@Select("Update hr_organization_relationship set isdel = 1 where platformId = #{platformId} and userId = #{userId}")
void deletePlatform(Integer platformId,Integer userId);
//========全承珠
@Select("select userId,password,accountRole,logInNumber,workNumber,phone,uniqueIdentificationAccount,schoolId from user "
+ " where isdel=0 and password=#{password} and (phone=#{userAccount} or workNumber=#{userAccount} or uniqueIdentificationAccount=#{userAccount})")
UserM loginsQ(@Param("userAccount") String userAccount, @Param("password") String password);
@Update("update user set lastTimeOfLanding=#{time},logInNumber=#{logInNumber} where userId=#{userId}")
void updateUserQ(@Param("time") String time, @Param("logInNumber") Integer logInNumber, @Param("userId") Integer userId);
/**
* 批量插入个人档案
*/
@Insert({
"<script>",
"insert into hr_personal_file(personalCareerId,schoolId,disciplineId,professionalClassId,professionalId,userId,schoolName,disciplineName,professionalClassName,professionalName) values ",
"(#{personalCareerId}, #{schoolId}, #{disciplineId}, #{professionalClassId} ,#{professionalId},#{userId},#{schoolName},#{disciplineName},#{professionalClassName},#{professionalName})",
"</script>"
})
void addPersonalFile(UserProfiles userProfiles);
//添加用户组织关系
@Insert({ "<script>",
"INSERT INTO hr_organization_relationship(userId,platformId,schoolId,schoolName,roleId,workNumber,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,professionalId,professionalName,gradeId,gradeName,classId,className,updatetime,customerId,creationTime) " +
"VALUES(#{userId},#{platformId},#{schoolId},#{schoolName},#{roleId},#{workNumber},#{oneDepartmentId},#{oneDepartmentName},#{twoDepartmentId},#{twoDepartmentName},#{professionalId},#{professionalName},#{gradeId},#{gradeName},#{classId},#{className},now(),#{customerId},now())",
"</script>" })
void addOrganizationRelationship(OrganizationRelationship organizationRelationship);
//删除用户组织架构关系
@Update( {"<script>",
"UPDATE hr_organization_relationship set isdel=1 where userId = #{userId}",
"</script>" })
void deleteOrganizationRelationship(Integer userId);
public interface UserInfoMapper {
@Update({"<script>",
"UPDATE lw_user SET",
"<when test='mobile!=null'>", "mobile=#{mobile},", "</when>",
"<when test='email!=null'>", "email=#{email},", "</when>",
"<when test='nickname!=null'>", "nickname=#{nickname},", "</when>",
"<when test='sex!=-1'>", "sex=#{sex},", "</when>",
"<when test='sign!=null'>", "sign=#{sign},", "</when>",
"<when test='birthday!=null'>", "birthday=#{birthday},", "</when>",
"<when test='avatar!=null'>", "avatar=#{avatar},", "</when>",
"<when test='country!=null'>", "country=#{country},", "</when>",
"<when test='province!=null'>", "province=#{province},", "</when>",
"<when test='city!=null'>", "city=#{city},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
"</script>"})
void update(User user);
@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(),0,#{sex},#{userAvatars},0)")
@Options(useGeneratedKeys = true, keyProperty = "userId", keyColumn = "userId")
void addUser(UserInfo user);
@Insert("INSERT INTO student(workNumber,schoolId,professionalId,gradeId,classId,professionalName,gradeName,className,userId,platformId,roleId,isdel)"
+ " VALUES(#{workNumber},#{schoolId},#{professionalId},#{gradeId},#{classId},#{professionalName},#{gradeName},#{className},#{userId},#{platformId},#{roleId},0)")
void userAddStudent(Student student);
@Insert("INSERT INTO staff(workNumber,schoolId,staffProfessionalArchitectureId,staffGradeId,staffProfessionalArchitectureName,staffGradeName,roleId,userId,platformId,isdel)"
+ " VALUES(#{workNumber},#{schoolId},#{staffProfessionalArchitectureId},#{staffGradeId},#{staffProfessionalArchitectureName},#{staffGradeName},#{roleId},#{userId},#{platformId},0)")
void userAddStaff(Staff staff);
@Select({"<script>",
"SELECT u.userId,u.userName,s.schoolName,s.provinceId,s.cityId,s.provinceName,s.cityName,u.countries,u.creationTime,u.account,u.logInNumber,u.schoolId,u.roleId FROM hr_user_info u,school s WHERE u.schoolId = s.schoolId and u.isdel = 0",
" <if test='countries!=null and countries !=\"\" '>and u.countries = #{countries} </if>",
" <if test='provinceId!=null and provinceId !=\"\" '>and s.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null and schoolId !=\"\"'>and u.schoolId = #{schoolId} </if>",
" <if test='cityId!=null and cityId !=\"\" '>and s.cityId = #{cityId} </if>",
" <if test='roleId!=null and roleId !=\"\" '>and u.roleId LIKE CONCAT('%',#{roleId},'%')</if>",
" <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.userName, s.schoolName,u.account) LIKE CONCAT('%',#{searchContent},'%')</if>",
" <if test='month==3'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>",
" <if test='month==6'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>",
" <if test='month==9'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)</if>",
" <if test='month==12'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 12 MONTH)</if>",
" <if test='creationTime!=null and endTime!=null and endTime!=\"\" and creationTime!=\"\" '> and u.creationTime between #{creationTime} and #{endTime}</if>",
"GROUP BY u.userId order by u.creationTime desc",
"</script> "})
List<UserInfo> queryUserInfo(UserInfo userInfo);
@Update({"<script>",
"UPDATE hr_user_info set isdel=1 where userId = #{userId}",
"</script>"})
void deleteUser(Integer userId);
@Update({"<script>",
"UPDATE staff set isdel=1 where userId = #{userId}",
"</script>"})
void deleteStaff(Integer userId);
@Update({"<script>",
"UPDATE staff set isdel=1 where userId = #{userId}",
"</script>"})
void deleteStudent(Integer 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},sex = #{sex},userAvatars = #{userAvatars} where userId = #{userId}")
void updateUser(UserInfo user);
//修改用户
@Update("UPDATE hr_user_info SET roleId = #{roleId} where userId = #{userId}")
void updateUserRoleId(Integer userId,String roleId);
//修改个人档案添加功能(删除后添加用户个人档案)
@Insert({"<script>",
"INSERT INTO hr_personal_file(personalCareerId,schoolId,schoolName,disciplineId,disciplineName,professionalClassId,professionalClassName,professionalId,professionalName,userId,updatetime) values " +
"(#{personalCareerId},#{schoolId},#{schoolName},#{disciplineId},#{disciplineName},#{professionalClassId},#{professionalClassName},#{professionalId},#{professionalName},#{userId},now())",
"</script>"})
void updateUserProfiles(UserProfiles userProfiles);
//修改个人档案删除功能
@Delete({"<script>",
"Delete from hr_personal_file where userId = #{userId}",
"</script>"})
void deleteUserProfiles(Integer userId);
//修改用户组织关系添加功能
@Insert({"<script>",
"INSERT INTO hr_organization_relationship(userId,platformId,schoolId,schoolName,roleId,workNumber,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,professionalId,professionalName,gradeId,gradeName,classId,className,updatetime,customerId) " +
"VALUES(#{userId},#{platformId},#{schoolId},#{schoolName},#{roleId},#{workNumber},#{oneDepartmentId},#{oneDepartmentName},#{twoDepartmentId},#{twoDepartmentName},#{professionalId},#{professionalName},#{gradeId},#{gradeName},#{classId},#{className},now(),#{customerId})",
"</script>"})
void updateOrganizationRelationship(OrganizationRelationship organizationRelationship);
//修改员工组织架构删除功能
@Delete({"<script>",
"Delete from staff where userId = #{userId} and platformId = #{platformId}",
"</script>"})
void deleteStaffOR(Integer userId, Integer platformId);
//修改学生组织架构删除功能
@Delete({"<script>",
"Delete from student where userId = #{userId} and platformId = #{platformId}",
"</script>"})
void deleteStudentOR(Integer userId, Integer platformId);
//修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
+ "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where phone = #{phone}")
void updateStaff(Staff staff);
//修改学生
@Update("UPDATE student SET studentName = #{studentName},studentNumber = #{studentNumber},phone = #{phone},email = #{email},roleId = #{roleId}"
+ ",schoolId = #{schoolId},professionalId = #{professionalId},gradeId = #{gradeId},classId = #{classId} where phone = #{phone}")
void updateStudent(Student student);
//登陆
@Select("SELECT hui.schoolId,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.sex,hui.uniqueIdentificationAccount,hui.userAvatars,hui.userId,hui.userName,hui.weChatID from hr_user_info hui where hui.isdel=0 and hui.userId = #{userId} ")
UserInfo logins(UserInfo userInfo);
//登陆账号密码
@Select("SELECT hui.schoolId,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.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 password = #{password} ")
UserInfo loginsAP(UserInfo userInfo);
//查询用户角色
@Select("SELECT userId,roleId from hr_organization_relationship where userId = #{userId} and schoolId = #{schoolId}")
List<OrganizationRelationship> loginRole(Integer userId, Integer schoolId);
//查询用户组织关系
@Select("SELECT schoolId,schoolName,userId from hr_organization_relationship where userId = #{userId} GROUP BY schoolId")
List<OrganizationRelationship> queryOrganizationRelationship(Integer userId);
//查询用户组织关系
@Select("SELECT * from hr_organization_relationship where userId = #{userId} and roleId = #{roleId} and schoolId = #{schoolId}")
List<OrganizationRelationship> queryOrganizationRelationshipAll(Integer userId, String roleId, Integer schoolId);
// //查询用户绑定平台信息
// @Select("SELECT hp.* FROM hr_platform hp,hr_organization_relationship hor WHERE hor.platformId = hp.platformId and hor.userId = #{userId} and hor.isdel = 0 GROUP BY platformId")
// List<Platform> queryUserPlatform(Integer userId);
//查询用户绑定学生的平台信息
@Select("SELECT hp.* FROM hr_platform hp,student stu WHERE stu.platformId = hp.platformId and stu.userId = #{userId} and stu.isdel = 0 GROUP BY platformId")
List<Platform> queryUserPlatformStudent(Integer userId);
//查询用户绑定员工的平台信息
@Select("SELECT hp.* FROM hr_platform hp,staff sta WHERE sta.platformId = hp.platformId and sta.userId = #{userId} and sta.isdel = 0 GROUP BY platformId")
List<Platform> queryUserPlatformStaff(Integer userId);
//查询用户手机
@Select("SELECT userId from hr_user_info where isdel=0 and phone = #{phone}")
List<UserInfo> queryPhone(String phone);
//查询用户详情
@Select({"<script>",
"SELECT * from hr_user_info where isdel = 0 and userId = #{userId}",
"</script> "})
UserInfo queryUserInfoDetails(Integer userId);
//查询用户详情
@Select({"<script>",
"SELECT * from hr_personal_file where userId = #{userId}",
"</script> "})
List<UserProfiles> queryUserProfiles(Integer userId);
//查询用户组织架构详情
@Select({"<script>",
"SELECT * from hr_organization_relationship where userId = #{userId} and platformId = #{platformId}",
"</script> "})
List<OrganizationRelationship> queryUserOR(Integer userId, Integer platformId);
//查询员工组织架构详情
@Select({"<script>",
"SELECT sta.*,sch.schoolName from staff sta,school sch where sta.userId = #{userId} and sta.platformId = #{platformId} and sta.schoolId = sch.schoolId",
"</script> "})
List<Staff> queryStaffOR(Integer userId, Integer platformId);
//查询学生组织架构详情
@Select({"<script>",
"SELECT stu.*,sch.schoolName from student stu,school sch where stu.userId = #{userId} and stu.platformId = #{platformId} and stu.schoolId = sch.schoolId",
"</script> "})
List<Student> queryStudentOR(Integer userId, Integer platformId);
//查询用户组织架构详情
@Select({"<script>",
"SELECT * from hr_organization_relationship where userId = #{userId}",
"</script> "})
List<OrganizationRelationship> queryUserIdOR(Integer userId);
//查询用户员工详情
@Select({"<script>",
"SELECT * from staff where userId = #{userId}",
"</script> "})
List<Staff> queryUserStaff(Integer userId);
//查询用户学生详情
@Select({"<script>",
"SELECT * from student where userId = #{userId}",
"</script> "})
List<Student> queryUserStudent(Integer userId);
//模糊查询客户
@Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0",
" <if test='searchContent!=null and searchContent !=\"\" '>and customerName like CONCAT('%',#{searchContent},'%')</if>",
" <if test='customerIds!=null'>"
+ "<foreach collection='customerIds' item='customerIds' open='and customerId not in (' separator=',' close=')'> #{customerIds}"
+ "</foreach>"
+ "</if>",
"</script> "})
List<Customer> queryCustomer(@Param("searchContent") String searchContent, @Param("customerIds") List<Integer> customerIds);
/**
* 批量插入用户
*
* @param users
*/
@Insert({
"<script>",
"insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ",
"<foreach collection='users' item='user' index='index' separator=','>",
"(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)",
"</foreach>",
"</script>"
})
void addUserM(@Param("users") List<UserM> users);
//修改用户头像
@Update("update hr_user_info set userAvatars=#{userAvatars} where userId=#{userId}")
void updateUserAvatars(@Param("userAvatars") String userAvatars, @Param("userId") Integer userId);
//更新用户登录次数和最后一次登录时间
@Update({"UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"})
void updateLogInNumber(UserM user);
//更新学生登录次数和最后一次登录时间
@Update({"UPDATE student SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE phone=#{phone}"})
void updateStudentLogInNumber(UserM user);
//更新员工登录次数和最后一次登录时间
@Update({"UPDATE staff SET logNumber=logNumber+1, lastTimeOfLanding=now() WHERE phone=#{phone}"})
void updateStaffLogInNumber(UserM user);
//查询账号是否存在
@Select("SELECT account,email,userName,userId,uniqueIdentificationAccount,phone from hr_user_info where isdel = 0 and account = #{account}")
List<UserInfo> queryAccountIsExist(String account);
//查询账号是否存在
@Select("SELECT hor.* from hr_organization_relationship hor,hr_user_info hui where hor.isdel = 0 and hui.account = #{account} and hor.userId = hui.userId and hor.schoolId = #{schoolId}")
List<OrganizationRelationship> queryAccountIsExistOR(String account, Integer schoolId);
//查询学号、工号是否存在
@Select("SELECT userId,workNumber,schoolId,roleId from hr_organization_relationship where workNumber = #{workNumber} and roleId = #{roleId} and schoolId = #{schoolId}")
List<OrganizationRelationship> queryWorkNumberIsExist(String workNumber, Integer roleId, Integer schoolId);
//查询平台
@Select("SELECT platformId,platformName,domainName,createTime from hr_platform where FIND_IN_SET (platformId,#{platformId})")
List<Platform> queryPlatform(String platformId);
//查询学生
@Select("SELECT * from student where platformId = #{platformId} and userId = #{userId} and isdel=0")
List<Student> queryStudent1(Integer platformId, Integer userId);
//查询员工
@Select("SELECT * from staff where platformId = #{platformId} and userId = #{userId} and isdel=0")
List<Staff> queryStaff(Integer platformId, Integer userId);
//删除平台
@Update("Update hr_organization_relationship set isdel = 1 where platformId = #{platformId} and userId = #{userId}")
void deletePlatform(Integer platformId, Integer userId);
//========全承珠
@Select("select userId,password,accountRole,logInNumber,workNumber,phone,uniqueIdentificationAccount,schoolId from user "
+ " where isdel=0 and password=#{password} and (phone=#{userAccount} or workNumber=#{userAccount} or uniqueIdentificationAccount=#{userAccount})")
UserM loginsQ(@Param("userAccount") String userAccount, @Param("password") String password);
@Update("update user set lastTimeOfLanding=#{time},logInNumber=#{logInNumber} where userId=#{userId}")
void updateUserQ(@Param("time") String time, @Param("logInNumber") Integer logInNumber, @Param("userId") Integer userId);
/**
* 批量插入个人档案
*/
@Insert({
"<script>",
"insert into hr_personal_file(personalCareerId,schoolId,disciplineId,professionalClassId,professionalId,userId,schoolName,disciplineName,professionalClassName,professionalName) values ",
"(#{personalCareerId}, #{schoolId}, #{disciplineId}, #{professionalClassId} ,#{professionalId},#{userId},#{schoolName},#{disciplineName},#{professionalClassName},#{professionalName})",
"</script>"
})
void addPersonalFile(UserProfiles userProfiles);
//添加用户组织关系
@Insert({"<script>",
"INSERT INTO hr_organization_relationship(userId,platformId,schoolId,schoolName,roleId,workNumber,oneDepartmentId,oneDepartmentName,twoDepartmentId,twoDepartmentName,professionalId,professionalName,gradeId,gradeName,classId,className,updatetime,customerId,creationTime) " +
"VALUES(#{userId},#{platformId},#{schoolId},#{schoolName},#{roleId},#{workNumber},#{oneDepartmentId},#{oneDepartmentName},#{twoDepartmentId},#{twoDepartmentName},#{professionalId},#{professionalName},#{gradeId},#{gradeName},#{classId},#{className},now(),#{customerId},now())",
"</script>"})
void addOrganizationRelationship(OrganizationRelationship organizationRelationship);
//删除用户组织架构关系
@Update({"<script>",
"UPDATE hr_organization_relationship set isdel=1 where userId = #{userId}",
"</script>"})
void deleteOrganizationRelationship(Integer userId);
}

@ -64,7 +64,7 @@ public class StaffService {
//用户角色
user.setAccountRole(staff.getRoleId());
//工号
user.setWorkNumber(staff.getStaffWorkNumber());
user.setWorkNumber(staff.getWorkNumber());
//手机号
user.setPhone(staff.getPhone());
//邮箱

@ -256,7 +256,7 @@ public class StudentService {
// 用户角色
user.setAccountRole(student.getRoleId());
// 工号
user.setWorkNumber(student.getStudentNumber());
user.setWorkNumber(student.getWorkNumber());
// 手机号
user.setPhone(student.getPhone());
// 邮箱

@ -50,108 +50,6 @@ public class UserInfoService {
@Autowired
private OrganizationRelationshipMapper organizationRelationshipMapper;
/**
* 批量删除学生信息
*/
@Transactional
public HashMap<String,Object> deleteStudent(Integer[] ids){
HashMap<String, Object> resp = new HashMap<String, Object>();
// UpdateWrapper<UserInfo> updateWrapper = new UpdateWrapper<UserInfo>();
// UserInfo userInfo = new UserInfo();
// for (Integer id:ids){
// userInfo.setUserId(id);
// }
// //修改学生状态信息码为1
// updateWrapper.eq("isdel",1);
// int update = userInfoMapper.update(userInfo, updateWrapper);
ArrayList<Object> list = new ArrayList<>();
for (Integer id : ids){
list.add(id);
}
int update = userInfoMapper.updateStudentInfo(list);
if (update>0){
resp.put(RETCODE,200);
}else{
resp.put(RETCODE,500);
resp.put(RETVALUE,"student/delete Invalid");
}
return resp;
}
/**
* 添加学生信息
*/
public HashMap<String,Object> addUserInfo(UserInfo userInfo){
HashMap<String, Object> resp = new HashMap<>();
try {
userInfo.setPassword("hanran123");
int insert = userInfoMapper.insertUserInfo(userInfo);
if (insert>0){
resp.put(RETCODE,200);
}else{
resp.put(RETCODE,400);
resp.put(RETVALUE,"student/insertUSERINFO Invalid");
}
}catch (RuntimeException e){
logger.error(e);
resp.put(RETCODE,500);
resp.put(RETVALUE,"student/insertUSERINFO abnormal");
}
return resp;
}
public HashMap<String,Object> addOrganizationRelationship(OrganizationRelationship ship){
HashMap<String, Object> resp = new HashMap<>();
try {
// userInfoMapper.insert(userInfo);
// int insert = organizationRelationshipMapper.insert(ship);
int insert = organizationRelationshipMapper.insertOrganizationRelationship(ship);
if (insert>0){
resp.put(RETCODE,200);
}else{
resp.put(RETCODE,400);
resp.put(RETVALUE,"student/insertORGANIZA Invalid");
}
}catch (RuntimeException e){
resp.put(RETCODE,500);
resp.put(RETVALUE,"student/insertORGANIZA abnormal");
}
return resp;
}
/**
* 批量查询学生信息
*/
@Transactional
public HashMap<String,Object> queryStudent(StudentInfo studentInfo,Integer pageNo,Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(pageNo!=null&&pageSize!=null) {
PageHelper.startPage(pageNo, pageSize);
List<StudentInfo> list = userInfoMapper.queryStudent(studentInfo);
PageInfo<StudentInfo> info=new PageInfo(list);
int total1 = (int) info.getTotal();
int totalPages;
totalPages = total1 / pageSize;
if (total1 % pageSize != 0){
totalPages ++;
}
long total = total1;
resp.put("retvalue", new PageResult(total, list,totalPages));
resp.put("retcode", 200);
}else {
List<StudentInfo> list = userInfoMapper.queryStudent(studentInfo);
resp.put("retvalue", list);
resp.put("retcode", 200);
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询用户失败!");
return resp;
}
return resp;
}
public HashMap<String, Object> login(String id, String password){
HashMap<String, Object> resp = new HashMap<String, Object>();
User user = null;
@ -198,19 +96,33 @@ public class UserInfoService {
}
//添加用户
public HashMap<String, Object> addUser(UserInfo user){
@Transactional
public HashMap<String, Object> addUser(UserInfo user,Student student,List<Staff> staffList,List<UserProfiles> userProfilesList){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
user.setPassword("huoran123");//设置默认密码
userInfoMapper.addUser(user);
Integer userId = user.getUserId();
resp.put("userId",userId);
student.setUserId(userId);
userInfoMapper.userAddStudent(student);
int size = userProfilesList.size();
for (int i = 0;i<size; i++){
UserProfiles userProfiles = userProfilesList.get(i);
userProfiles.setUserId(userId);
userInfoMapper.addPersonalFile(userProfiles);
}
int staffListSize = staffList.size();
for (int i = 0;i<staffListSize;i++){
Staff staff = staffList.get(i);
staff.setUserId(userId);
userInfoMapper.userAddStaff(staff);
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加用户失败!");
return resp;
throw new RuntimeException();
}
return resp;
}
@ -246,6 +158,7 @@ public class UserInfoService {
return resp;
}
//删除用户
@Transactional
public HashMap<String, Object> deleteUserInfo(List<Integer> userIdList){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -253,13 +166,15 @@ public class UserInfoService {
for (int i=0;i<size;i++){
Integer userId=userIdList.get(i);
userInfoMapper.deleteUser(userId);
userInfoMapper.deleteStaff(userId);
userInfoMapper.deleteStudent(userId);
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "删除用户失败");
return resp;
throw new RuntimeException();
}
return resp;
}
@ -299,6 +214,22 @@ public class UserInfoService {
return resp;
}
//更新用户
@Transactional
public HashMap<String, Object> updateUserRoleId(Integer userId,String roleId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.updateUserRoleId(userId,roleId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "更新用户失败!");
throw new RuntimeException();
}
return resp;
}
//更新个人档案
@Transactional
public HashMap<String, Object> updateUserProfiles(List<UserProfiles> userProfilesList){
@ -321,18 +252,53 @@ public class UserInfoService {
return resp;
}
// //更新用户组织架构
// @Transactional
// public HashMap<String, Object> updateOrganizationRelationship(List<OrganizationRelationship> OrganizationRelationshipList){
// HashMap<String, Object> resp = new HashMap<String, Object>();
// try {
// Integer size = OrganizationRelationshipList.size();
// Integer userId = OrganizationRelationshipList.get(0).getUserId();
// Integer platformId = OrganizationRelationshipList.get(0).getPlatformId();
// userInfoMapper.deleteOR(userId,platformId);
// for (int i=0; i<size; i++){
// OrganizationRelationship organizationRelationship = OrganizationRelationshipList.get(i);
// userInfoMapper.updateOrganizationRelationship(organizationRelationship);
// }
// resp.put("retcode", 200);
// } catch (RuntimeException e) {
// logger.error(e.getMessage());
// resp.put("retcode", 500);
// resp.put("retvalue", "更新用户个人档案失败!");
// throw new RuntimeException();
// }
// return resp;
// }
//更新用户组织架构
@Transactional
public HashMap<String, Object> updateOrganizationRelationship(List<OrganizationRelationship> OrganizationRelationshipList){
public HashMap<String, Object> updateOR(List<Staff> staffList,List<Student> studentList){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer size = OrganizationRelationshipList.size();
Integer userId = OrganizationRelationshipList.get(0).getUserId();
Integer platformId = OrganizationRelationshipList.get(0).getPlatformId();
userInfoMapper.deleteOR(userId,platformId);
for (int i=0; i<size; i++){
OrganizationRelationship organizationRelationship = OrganizationRelationshipList.get(i);
userInfoMapper.updateOrganizationRelationship(organizationRelationship);
if (!staffList.isEmpty()){
int size = staffList.size();
Integer userId = staffList.get(0).getUserId();
Integer platformId = staffList.get(0).getPlatformId();
userInfoMapper.deleteStaffOR(userId,platformId);
for (int i=0; i<size; i++){
Staff staff = staffList.get(i);
userInfoMapper.userAddStaff(staff);
}
}
if (!studentList.isEmpty()){
int size = studentList.size();
Integer userId = studentList.get(0).getUserId();
Integer platformId = studentList.get(0).getPlatformId();
userInfoMapper.deleteStudentOR(userId,platformId);
for (int i=0; i<size; i++){
Student student = studentList.get(i);
userInfoMapper.userAddStudent(student);
}
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
@ -407,7 +373,7 @@ public class UserInfoService {
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
Integer userId = userInfo.getUserId();
Integer roleId = userInfo.getRoleId();
String roleId = userInfo.getRoleId();
Integer schoolId = userInfo.getSchoolId();
try {
UserInfo user=userInfoMapper.logins(userInfo);
@ -465,10 +431,14 @@ public class UserInfoService {
if (userInfo!=null){
List<UserProfiles> userProfiles = userInfoMapper.queryUserProfiles(userId);
obj.put("userProfilesList",userProfiles);
List<Platform> platformList = userInfoMapper.queryUserPlatform(userId);
obj.put("platformList",platformList);
List<OrganizationRelationship> ORList = userInfoMapper.queryUserIdOR(userId);
obj.put("ORList",ORList);
List<Platform> staffPlatformList = userInfoMapper.queryUserPlatformStaff(userId);
obj.put("staffPlatformList",staffPlatformList);
List<Platform> studentPlatformList= userInfoMapper.queryUserPlatformStudent(userId);
obj.put("studentPlatformList",studentPlatformList);
List<Staff> staffList = userInfoMapper.queryUserStaff(userId);
obj.put("staffList",staffList);
List<Student> studentList = userInfoMapper.queryUserStudent(userId);
obj.put("studentList",studentList);
resp.put("retvalue", obj);
resp.put("retcode", 200);
}else {
@ -488,8 +458,12 @@ public class UserInfoService {
//查询用户组织架构详情
public HashMap<String, Object> queryUserOR(Integer userId,Integer platformId){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryUserOR(userId,platformId));
// resp.put("retvalue", userInfoMapper.queryUserOR(userId,platformId));
obj.put("staff", userInfoMapper.queryStaffOR(userId,platformId));
obj.put("student", userInfoMapper.queryStudentOR(userId,platformId));
resp.put("retvalue",obj);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -643,32 +617,26 @@ public class UserInfoService {
return resp;
}
//添加学生和员工信息
@Transactional
public HashMap<String, Object> addStuStaff(List<OrganizationRelationship> ORList,Integer userId) {
//查询平台
public HashMap<String, Object> queryPlatform(String platformId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
int size = ORList.size();
for (int i=0;i<size;i++){
OrganizationRelationship organizationRelationship = ORList.get(i);
organizationRelationship.setUserId(userId);
userInfoMapper.addOrganizationRelationship(organizationRelationship);
}
resp.put("retvalue", userInfoMapper.queryPlatform(platformId));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!");
throw new RuntimeException("添加学生和员工信息失败!");
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
//查询平台
public HashMap<String, Object> queryPlatform(String platformId){
//删除平台
public HashMap<String, Object> deletePlatform(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryPlatform(platformId));
userInfoMapper.deletePlatform(platformId,userId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -680,10 +648,13 @@ public class UserInfoService {
}
//删除平台
public HashMap<String, Object> deletePlatform(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
public HashMap<String, Object> queryStuAndSta(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
userInfoMapper.deletePlatform(platformId,userId);
obj.put("Staff", userInfoMapper.queryStaff(platformId,userId));
obj.put("Student", userInfoMapper.queryStudent1(platformId,userId));
resp.put("retvalue", obj);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());

@ -104,7 +104,7 @@ public class StaffServiceTest {
staff.setStaffGradeId(2050);
staff.setStaffName("zha");
staff.setStaffProfessionalArchitectureId(2057);
staff.setStaffWorkNumber("1222");
staff.setWorkNumber("1222");
staff.setUniqueIdentificationAccount("204312221598238094000");
HashMap<String, Object> addStaff = staffService.addStaff(staff);
for (String s : addStaff.keySet()) {
@ -172,7 +172,7 @@ public class StaffServiceTest {
staff.setStaffId(118);
staff.setStaffName("世杰-教师");
staff.setStaffProfessionalArchitectureId(2057);
staff.setStaffWorkNumber("123");
staff.setWorkNumber("123");
staff.setUniqueIdentificationAccount("20431231596424406000");
userVO.setStaff(staff);
user.setAccountRole(3);

@ -21,62 +21,62 @@ public class StudentServiceTest {
/**
* 新增学生
*/
@Test
public void addStudent(){
UserInfo userInfo = new UserInfo();
OrganizationRelationship ship = new OrganizationRelationship();
userInfo.setAccount("");
userInfo.setUniqueIdentificationAccount("huoran999");
userInfo.setSchoolId(1);
userInfo.setUserName("michonne");
userInfo.setRoleId(4);
userInfo.setPassword("123456");
ship.setProfessionalId(1);
ship.setGradeId(1);
ship.setClassId(1);
ship.setWorkNumber("888");
HashMap<String, Object> map = userInfoService.addUserInfo(userInfo);
userInfoService.addOrganizationRelationship(ship);
for (String s : map.keySet()) {
System.out.println("key:" + s + "," + "value:" + map.get(s));
}
HashMap<String, Object> map1 = userInfoService.addOrganizationRelationship(ship);
for (String ss : map1.keySet()) {
System.out.println("key:" + ss + "," + "value:" + map.get(ss));
}
}
// @Test
// public void addStudent(){
// UserInfo userInfo = new UserInfo();
// OrganizationRelationship ship = new OrganizationRelationship();
// userInfo.setAccount("");
// userInfo.setUniqueIdentificationAccount("huoran999");
// userInfo.setSchoolId(1);
// userInfo.setUserName("michonne");
// userInfo.setRoleId(4);
// userInfo.setPassword("123456");
// ship.setProfessionalId(1);
// ship.setGradeId(1);
// ship.setClassId(1);
// ship.setWorkNumber("888");
// HashMap<String, Object> map = userInfoService.addUserInfo(userInfo);
// userInfoService.addOrganizationRelationship(ship);
// for (String s : map.keySet()) {
// System.out.println("key:" + s + "," + "value:" + map.get(s));
// }
// HashMap<String, Object> map1 = userInfoService.addOrganizationRelationship(ship);
// for (String ss : map1.keySet()) {
// System.out.println("key:" + ss + "," + "value:" + map.get(ss));
// }
// }
/**
* 查询学生信息
*/
@Test
public void queryStudent(){
StudentInfo studentInfo = new StudentInfo();
OrganizationRelationship organizationRelationship = new OrganizationRelationship();
studentInfo.setSchoolId(1);
studentInfo.setSearchContent("8");
Integer pageNo = 1;
Integer pageSize = 3;
HashMap<String, Object> map = userInfoService.queryStudent(studentInfo, pageNo, pageSize);
for (String s : map.keySet()) {
System.out.println("key:" + s + "," + "value:" + map.get(s));
}
}
// @Test
// public void queryStudent(){
// StudentInfo studentInfo = new StudentInfo();
//
// OrganizationRelationship organizationRelationship = new OrganizationRelationship();
// studentInfo.setSchoolId(1);
// studentInfo.setSearchContent("8");
//
//
// Integer pageNo = 1;
// Integer pageSize = 3;
// HashMap<String, Object> map = userInfoService.queryStudent(studentInfo, pageNo, pageSize);
// for (String s : map.keySet()) {
// System.out.println("key:" + s + "," + "value:" + map.get(s));
// }
// }
/**
* 测试删除学生信息
*/
@Test
public void deleteStudent(){
Integer[] userInfo = new Integer[]{13,14,15};
HashMap<String, Object> map = userInfoService.deleteStudent(userInfo);
for (String s : map.keySet()) {
System.out.println("key:" + s + "," + "value:" + map.get(s));
}
}
// @Test
// public void deleteStudent(){
// Integer[] userInfo = new Integer[]{13,14,15};
//
// HashMap<String, Object> map = userInfoService.deleteStudent(userInfo);
// for (String s : map.keySet()) {
// System.out.println("key:" + s + "," + "value:" + map.get(s));
// }
// }
}

Loading…
Cancel
Save