上传代码

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

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

@ -5,6 +5,7 @@ import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService; import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.StudentService; import com.yipin.liuwanr.service.StudentService;
import com.yipin.liuwanr.service.UserInfoService; import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.service.UserService;
import com.yipin.liuwanr.vo.UserInfoVO; import com.yipin.liuwanr.vo.UserInfoVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -30,119 +31,11 @@ public class UserInfoController {
private UserInfoService userInfoService; private UserInfoService userInfoService;
@Autowired @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(); Response resp = new Response();
//个人档案实体 //个人档案实体
List<UserProfiles> userProfilesList = vo.getUserProfilesList(); List<UserProfiles> userProfilesList = vo.getUserProfilesList();
//组织架构list //员工list
List<OrganizationRelationship> ORList = vo.getOrganizationRelationshipList(); List<Staff> staffList = vo.getStaffList();
//学生实体
Student student = vo.getStudent();
//用户实体 //用户实体
UserInfo user = vo.getUserInfo(); UserInfo user = vo.getUserInfo();
//用户手机 //用户
String account = user.getAccount(); String account = user.getAccount();
//用户名称 //用户名称
String name = user.getUserName(); String name = user.getUserName();
//用户角色id
Integer roleId = user.getRoleId();
//学校id //学校id
Integer schoolId = user.getSchoolId(); Integer schoolId = user.getSchoolId();
if(name==null||name==""){ if(name==null||name==""){
@ -175,32 +68,11 @@ public class UserInfoController {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("学校不能为空!"); resp.setErrmessage("学校不能为空!");
}else { }else {
HashMap<String, Object> ret = userInfoService.addUser(user); HashMap<String, Object> ret = userInfoService.addUser(user,student,staffList,userProfilesList);
Integer userId = user.getUserId();
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
resp.setMessage(ret.get("retvalue")); 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 { } else {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
@ -214,7 +86,7 @@ public class UserInfoController {
* 查询用户(根据国家省份城市) * 查询用户(根据国家省份城市)
*/ */
@GetMapping("/queryUserInfo") @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(); Response resp = new Response();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
//设置国家 //设置国家
@ -272,7 +144,7 @@ public class UserInfoController {
@PostMapping("/deleteUserInfo") @PostMapping("/deleteUserInfo")
public Response deleteUserInfo(@RequestBody List<Integer> userIdList) { public Response deleteUserInfo(@RequestBody List<Integer> userIdList) {
Response resp = new Response(); Response resp = new Response();
if (userIdList==null) { if (userIdList.isEmpty()) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空,删除用户失败!"); resp.setErrmessage("用户id为空,删除用户失败!");
} else { } else {
@ -281,17 +153,7 @@ public class UserInfoController {
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
resp.setMessage(ret.get("retvalue")); resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> sta = userInfoService.deleteOrganizationRelationship(userIdList); }else {
int staStatus = (int) sta.get("retcode");
if (200 == staStatus) {
resp.setStatus(staStatus);
resp.setMessage(sta.get("retvalue"));
}else{
resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}else {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
@ -326,6 +188,36 @@ public class UserInfoController {
return resp; 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 @Transactional
@PostMapping("/updateOR") @PostMapping("/updateOR")
public Response updateOrganizationRelationship(@RequestBody List<OrganizationRelationship> OrganizationRelationshipList) { public Response updateOrganizationRelationship(@RequestBody UserInfoVO vo) {
Response resp = new Response(); 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.setStatus(300);
resp.setErrmessage("用户组织关系为空,修改组织关系失败!"); resp.setErrmessage("用户组织关系为空,修改组织关系失败!");
} else { } else {
HashMap<String, Object> ret = userInfoService.updateOrganizationRelationship(OrganizationRelationshipList); HashMap<String, Object> ret = userInfoService.updateOR(staffList,studentList);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -410,7 +304,7 @@ public class UserInfoController {
* 登陆 * 登陆
*/ */
@GetMapping("/logins") @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(); Response resp = new Response();
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
if (userId == null) { if (userId == null) {
@ -742,4 +636,29 @@ public class UserInfoController {
} }
return resp; 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; package com.yipin.liuwanr.entity;
public class Staff { public class Staff {
//绑定用户id
private Integer userId;
//账号 //账号
private String account; private String account;
//员工主键ID //员工主键ID
@ -8,7 +10,7 @@ public class Staff {
//员工名称 //员工名称
private String staffName; private String staffName;
//员工工号 //员工工号
private String staffWorkNumber; private String workNumber;
//电话 //电话
private String phone; private String phone;
//邮件 //邮件
@ -37,7 +39,26 @@ public class Staff {
private String staffProfessionalArchitectureIds; private String staffProfessionalArchitectureIds;
//绑定学校id //绑定学校id
private Integer schoolId; 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() { public String getAccount() {
return account; return account;
} }
@ -46,6 +67,14 @@ public class Staff {
this.account = account; this.account = account;
} }
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getSchoolId() { public Integer getSchoolId() {
return schoolId; return schoolId;
} }
@ -106,12 +135,15 @@ public class Staff {
public void setStaffName(String staffName) { public void setStaffName(String staffName) {
this.staffName = 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() { public String getPhone() {
return phone; return phone;
} }
@ -154,7 +186,7 @@ public class Staff {
return "Staff{" + return "Staff{" +
"staffId=" + staffId + "staffId=" + staffId +
", staffName='" + staffName + '\'' + ", staffName='" + staffName + '\'' +
", staffWorkNumber='" + staffWorkNumber + '\'' + ", workNumber='" + workNumber + '\'' +
", phone='" + phone + '\'' + ", phone='" + phone + '\'' +
", email='" + email + '\'' + ", email='" + email + '\'' +
", logNumber=" + logNumber + ", logNumber=" + logNumber +

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

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

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

@ -41,9 +41,9 @@ public interface AssesmentMapper {
*/ */
@Select({"<script>", @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," "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 " + "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 " + "(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} ", + "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==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==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>", " <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})") // @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); // 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); void addStaff(Staff staff);
@Select({"<script>", @Select({"<script>",
@ -53,7 +53,7 @@ public interface StaffMapper {
List<OrganizationRelationship> queryRole(Integer userId); 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}") + "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where staffId = #{staffId}")
void updateStaff(Staff staff); void updateStaff(Staff staff);
@ -91,9 +91,9 @@ public interface StaffMapper {
*/ */
@Insert({ @Insert({
"<script>", "<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=','>", "<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>", "</foreach>",
"</script>" "</script>"
}) })
@ -110,9 +110,9 @@ public interface StaffMapper {
//=======全承珠 //=======全承珠
@Select({"<script>", @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='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>", "<if test='uniqueIdentificationAccount!=null'>and uniqueIdentificationAccount=#{uniqueIdentificationAccount} </if>",
"</script>"}) "</script>"})
Staff queryStaffQ(UserM user); Staff queryStaffQ(UserM user);

@ -14,8 +14,8 @@ import io.lettuce.core.dynamic.annotation.Param;
public interface StudentMapper { public interface StudentMapper {
//添加学生 //添加学生
@Insert("INSERT INTO student(studentName,studentNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId,isdel,uniqueIdentificationAccount)" @Insert("INSERT INTO student(studentName,workNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId,isdel,uniqueIdentificationAccount)"
+ "VALUES(#{studentName},#{studentNumber},#{phone},#{email},#{roleId},#{schoolId},#{professionalId},#{gradeId},#{classId},0,#{uniqueIdentificationAccount})") + "VALUES(#{studentName},#{workNumber},#{phone},#{email},#{roleId},#{schoolId},#{professionalId},#{gradeId},#{classId},0,#{uniqueIdentificationAccount})")
void addStudent(Student student); void addStudent(Student student);
//通过专业id查询所有学生信息 //通过专业id查询所有学生信息
@ -47,7 +47,7 @@ public interface StudentMapper {
//查询学生详情 //查询学生详情
@Select({ "<script>", @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> " }) "</script> " })
List<Student> queryStudentDetails(Integer studentId); List<Student> queryStudentDetails(Integer studentId);
@ -63,12 +63,12 @@ public interface StudentMapper {
//查询学生详情 //查询学生详情
@Select({ "<script>", @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> " }) "</script> " })
List<UserM> queryStudentDetailsU(Integer studentId); 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}") + ",schoolId = #{schoolId},professionalId = #{professionalId},gradeId = #{gradeId},classId = #{classId} where studentId = #{studentId}")
void updateStudent(Student student); void updateStudent(Student student);
@ -95,9 +95,9 @@ public interface StudentMapper {
@Insert({ "<script>", @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=','>", "<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>" }) "</foreach>", "</script>" })
void bacthAddStudent(@Param("students") List<Student> students); void bacthAddStudent(@Param("students") List<Student> students);
@ -111,9 +111,9 @@ public interface StudentMapper {
//========全承珠 //========全承珠
@Select({"<script>", @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='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>", "<if test='uniqueIdentificationAccount!=null'>and uniqueIdentificationAccount=#{uniqueIdentificationAccount} </if>",
"</script>"}) "</script>"})
Student queryStudentQ(UserM user); Student queryStudentQ(UserM user);

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

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

@ -50,108 +50,6 @@ public class UserInfoService {
@Autowired @Autowired
private OrganizationRelationshipMapper organizationRelationshipMapper; 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){ public HashMap<String, Object> login(String id, String password){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
User user = null; 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>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
user.setPassword("huoran123");//设置默认密码 user.setPassword("huoran123");//设置默认密码
userInfoMapper.addUser(user); userInfoMapper.addUser(user);
Integer userId = user.getUserId(); 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); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "添加用户失败!"); resp.put("retvalue", "添加用户失败!");
return resp; throw new RuntimeException();
} }
return resp; return resp;
} }
@ -246,6 +158,7 @@ public class UserInfoService {
return resp; return resp;
} }
//删除用户 //删除用户
@Transactional
public HashMap<String, Object> deleteUserInfo(List<Integer> userIdList){ public HashMap<String, Object> deleteUserInfo(List<Integer> userIdList){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
@ -253,13 +166,15 @@ public class UserInfoService {
for (int i=0;i<size;i++){ for (int i=0;i<size;i++){
Integer userId=userIdList.get(i); Integer userId=userIdList.get(i);
userInfoMapper.deleteUser(userId); userInfoMapper.deleteUser(userId);
userInfoMapper.deleteStaff(userId);
userInfoMapper.deleteStudent(userId);
} }
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "删除用户失败"); resp.put("retvalue", "删除用户失败");
return resp; throw new RuntimeException();
} }
return resp; return resp;
} }
@ -299,6 +214,22 @@ public class UserInfoService {
return resp; 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 @Transactional
public HashMap<String, Object> updateUserProfiles(List<UserProfiles> userProfilesList){ public HashMap<String, Object> updateUserProfiles(List<UserProfiles> userProfilesList){
@ -321,18 +252,53 @@ public class UserInfoService {
return resp; 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 @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>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
Integer size = OrganizationRelationshipList.size(); if (!staffList.isEmpty()){
Integer userId = OrganizationRelationshipList.get(0).getUserId(); int size = staffList.size();
Integer platformId = OrganizationRelationshipList.get(0).getPlatformId(); Integer userId = staffList.get(0).getUserId();
userInfoMapper.deleteOR(userId,platformId); Integer platformId = staffList.get(0).getPlatformId();
for (int i=0; i<size; i++){ userInfoMapper.deleteStaffOR(userId,platformId);
OrganizationRelationship organizationRelationship = OrganizationRelationshipList.get(i); for (int i=0; i<size; i++){
userInfoMapper.updateOrganizationRelationship(organizationRelationship); 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); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -407,7 +373,7 @@ public class UserInfoService {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> obj = new HashMap<String, Object>();
Integer userId = userInfo.getUserId(); Integer userId = userInfo.getUserId();
Integer roleId = userInfo.getRoleId(); String roleId = userInfo.getRoleId();
Integer schoolId = userInfo.getSchoolId(); Integer schoolId = userInfo.getSchoolId();
try { try {
UserInfo user=userInfoMapper.logins(userInfo); UserInfo user=userInfoMapper.logins(userInfo);
@ -465,10 +431,14 @@ public class UserInfoService {
if (userInfo!=null){ if (userInfo!=null){
List<UserProfiles> userProfiles = userInfoMapper.queryUserProfiles(userId); List<UserProfiles> userProfiles = userInfoMapper.queryUserProfiles(userId);
obj.put("userProfilesList",userProfiles); obj.put("userProfilesList",userProfiles);
List<Platform> platformList = userInfoMapper.queryUserPlatform(userId); List<Platform> staffPlatformList = userInfoMapper.queryUserPlatformStaff(userId);
obj.put("platformList",platformList); obj.put("staffPlatformList",staffPlatformList);
List<OrganizationRelationship> ORList = userInfoMapper.queryUserIdOR(userId); List<Platform> studentPlatformList= userInfoMapper.queryUserPlatformStudent(userId);
obj.put("ORList",ORList); 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("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
}else { }else {
@ -488,8 +458,12 @@ public class UserInfoService {
//查询用户组织架构详情 //查询用户组织架构详情
public HashMap<String, Object> queryUserOR(Integer userId,Integer platformId){ public HashMap<String, Object> queryUserOR(Integer userId,Integer platformId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try { 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); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -643,32 +617,26 @@ public class UserInfoService {
return resp; return resp;
} }
//添加学生和员工信息 //查询平台
@Transactional public HashMap<String, Object> queryPlatform(String platformId){
public HashMap<String, Object> addStuStaff(List<OrganizationRelationship> ORList,Integer userId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
int size = ORList.size(); resp.put("retvalue", userInfoMapper.queryPlatform(platformId));
for (int i=0;i<size;i++){
OrganizationRelationship organizationRelationship = ORList.get(i);
organizationRelationship.setUserId(userId);
userInfoMapper.addOrganizationRelationship(organizationRelationship);
}
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!"); resp.put("retvalue", "Inquiry Failed");
throw new RuntimeException("添加学生和员工信息失败!"); return resp;
} }
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>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", userInfoMapper.queryPlatform(platformId)); userInfoMapper.deletePlatform(platformId,userId);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -680,10 +648,13 @@ public class UserInfoService {
} }
//删除平台 //删除平台
public HashMap<String, Object> deletePlatform(Integer platformId,Integer userId){ public HashMap<String, Object> queryStuAndSta(Integer platformId,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try { 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); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());

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

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

Loading…
Cancel
Save