master
zhiyong.ning 4 years ago
parent a5f90b7b18
commit 78b995d15f
  1. 75
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 180
      src/main/java/com/yipin/liuwanr/controller/UserInfoController.java
  3. 164
      src/main/java/com/yipin/liuwanr/entity/OrganizationRelationship.java
  4. 94
      src/main/java/com/yipin/liuwanr/entity/PersonalFile.java
  5. 11
      src/main/java/com/yipin/liuwanr/entity/Staff.java
  6. 207
      src/main/java/com/yipin/liuwanr/entity/StuStaff.java
  7. 10
      src/main/java/com/yipin/liuwanr/entity/Student.java
  8. 138
      src/main/java/com/yipin/liuwanr/entity/UserProfiles.java
  9. 14
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  10. 3
      src/main/java/com/yipin/liuwanr/mapper/StaffMapper.java
  11. 3
      src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java
  12. 181
      src/main/java/com/yipin/liuwanr/mapper/UserInfoMapper.java
  13. 2
      src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
  14. 8
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java
  15. 2
      src/main/java/com/yipin/liuwanr/service/StudentService.java
  16. 454
      src/main/java/com/yipin/liuwanr/service/UserInfoService.java
  17. 61
      src/main/java/com/yipin/liuwanr/service/UserService.java
  18. 46
      src/main/java/com/yipin/liuwanr/vo/StuStaffVO.java
  19. 118
      src/main/java/com/yipin/liuwanr/vo/UserInfoVO.java
  20. 3
      src/test/java/com/yipin/liuwanr/ExperimentalClassServiceTest.java

@ -52,13 +52,20 @@ public class ExperimentalClassController {
* @return * @return
*/ */
@GetMapping("/queryExperimentalClass") @GetMapping("/queryExperimentalClass")
Response queryExperimentalClass(@RequestParam Integer schoolId,@RequestParam Integer courseId) { Response queryExperimentalClass(@RequestParam Integer schoolId,@RequestParam Integer courseId,@RequestParam Integer userId) {
Response resp = new Response(); Response resp = new Response();
if(StringUtils.isEmpty(schoolId)){ if(StringUtils.isEmpty(schoolId)){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("学校信息为空"); resp.setErrmessage("学校信息为空");
}else{ }else if(StringUtils.isEmpty(courseId)){
HashMap<String, Object> ret=classService.queryExperimentalClass(schoolId,courseId); resp.setStatus(300);
resp.setErrmessage("课程信息为空");
}else if (StringUtils.isEmpty(userId)){
resp.setStatus(300);
resp.setErrmessage("用户信息为空");
}
else{
HashMap<String, Object> ret=classService.queryExperimentalClass(schoolId,courseId,userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -190,20 +197,20 @@ public class ExperimentalClassController {
* @param experimentalClassId * @param experimentalClassId
* @return * @return
*/ */
@GetMapping("/queryExperimentalClassSP") // @GetMapping("/queryExperimentalClassSP")
Response queryExperimentalClassSP(@RequestParam Integer experimentalClassId) { // Response queryExperimentalClassSP(@RequestParam Integer experimentalClassId) {
Response resp = new Response(); // Response resp = new Response();
HashMap<String, Object> ret=classService.queryExperimentalClassSP(experimentalClassId); // HashMap<String, Object> ret=classService.queryExperimentalClassSP(experimentalClassId);
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"));
} else { // } else {
resp.setStatus(status); // resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); // resp.setErrmessage(ret.get("retvalue").toString());
} // }
return resp; // return resp;
} // }
/** /**
* 专业下拉框 * 专业下拉框
@ -248,10 +255,10 @@ public class ExperimentalClassController {
//新增学生显示数据 //新增学生显示数据
@GetMapping("/queryexperimentalClass") @GetMapping("/queryExperimentalClass")
Response queryexperimentalClass(@RequestParam Integer experimentalClassId) { Response queryExperimentalClass(@RequestParam Integer experimentalClassId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret=classService.queryexperimentalClass(experimentalClassId); HashMap<String, Object> ret=classService.queryExperimentalClass(experimentalClassId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -269,20 +276,20 @@ public class ExperimentalClassController {
* @param experimentalClassId * @param experimentalClassId
* @return * @return
*/ */
@GetMapping("/queryStudentClass") // @GetMapping("/queryStudentClass")
Response queryStudentClass(@RequestParam Integer experimentalClassId) { //// Response queryStudentClass(@RequestParam Integer experimentalClassId) {
Response resp = new Response(); //// Response resp = new Response();
HashMap<String, Object> ret=classService.queryStudentClass(experimentalClassId); //// HashMap<String, Object> ret=classService.queryStudentClass(experimentalClassId);
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"));
} else { //// } else {
resp.setStatus(status); //// resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); //// resp.setErrmessage(ret.get("retvalue").toString());
} //// }
return resp; //// return resp;
} //// }
/** /**
* 添加实验班级 * 添加实验班级

@ -1,13 +1,11 @@
package com.yipin.liuwanr.controller; package com.yipin.liuwanr.controller;
import com.yipin.liuwanr.entity.Staff; import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.entity.UserInfo;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.helper.RedisHelper; 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.UserService; import com.yipin.liuwanr.service.UserInfoService;
import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO; import com.yipin.liuwanr.vo.UserVO;
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;
@ -23,15 +21,15 @@ import java.util.List;
@RequestMapping("/userInfo") @RequestMapping("/userInfo")
public class UserInfoController { public class UserInfoController {
@Autowired
private UserService userService;
@Autowired @Autowired
private StudentService studentService; private StudentService studentService;
@Autowired @Autowired
private StaffService staffService; private StaffService staffService;
@Autowired
private UserInfoService userInfoService;
@Autowired @Autowired
RedisHelper redisHelper; RedisHelper redisHelper;
@ -40,36 +38,33 @@ public class UserInfoController {
*/ */
@Transactional @Transactional
@PostMapping("/addUser") @PostMapping("/addUser")
Response addUser(@RequestBody UserVO vo) { public Response addUser(@RequestBody UserInfoVO vo) {
Response resp = new Response(); Response resp = new Response();
//个人档案实体
List<UserProfiles> userProfilesList = vo.getUserProfilesList();
//学生员工实体list
List<StuStaff> stuStaffList = vo.getStuStaffList();
//用户实体 //用户实体
UserM user = vo.getUser(); UserInfo user = vo.getUserInfo();
//学生实体
Student student = vo.getStudent();
//员工实体
Staff staff = vo.getStaff();
//用户手机号 //用户手机号
String phone = user.getPhone(); String phone = user.getPhone();
//用户名称 //用户名称
String name = user.getName(); String name = user.getUserName();
//省份id //省份id
Integer provinceId = user.getProvinceId(); Integer provinceId = user.getProvinceId();
//用户角色id //用户角色id
Integer accountRole = user.getAccountRole(); Integer roleId = user.getRoleId();
//城市id //城市id
Integer cityId = user.getCityId(); Integer cityId = user.getCityId();
//学校id //学校id
Integer schoolId = user.getSchoolId(); Integer schoolId = user.getSchoolId();
if (phone==null||phone=="") { if(name==null||name==""){
resp.setStatus(300);
resp.setErrmessage("电话不能为空!");
}else if(name==null||name==""){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("姓名不能为空!"); resp.setErrmessage("姓名不能为空!");
}else if(provinceId==null){ }else if(provinceId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("省份不能为空!"); resp.setErrmessage("省份不能为空!");
}else if(accountRole==null){ }else if(roleId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户角色不能为空!"); resp.setErrmessage("用户角色不能为空!");
}else if(cityId==null){ }else if(cityId==null){
@ -79,13 +74,13 @@ public class UserInfoController {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("学校不能为空!"); resp.setErrmessage("学校不能为空!");
}else { }else {
HashMap<String, Object> ret = userService.addUser(user); HashMap<String, Object> ret = userInfoService.addUser(user);
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"));
if (accountRole == 4){ HashMap<String, Object> stu = userInfoService.addPersonalFile(userProfilesList,userId);
HashMap<String, Object> stu = studentService.addStudent(student);
int stuStatus = (int) stu.get("retcode"); int stuStatus = (int) stu.get("retcode");
if (stuStatus == 200){ if (stuStatus == 200){
resp.setStatus(stuStatus); resp.setStatus(stuStatus);
@ -95,9 +90,7 @@ public class UserInfoController {
resp.setErrmessage(stu.get("retvalue").toString()); resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
} HashMap<String, Object> sta = userInfoService.addStuStaff(stuStaffList,userId);
if(accountRole == 3||accountRole==2){
HashMap<String, Object> sta = staffService.addStaff(staff);
int staStatus = (int) sta.get("retcode"); int staStatus = (int) sta.get("retcode");
if (staStatus == 200){ if (staStatus == 200){
resp.setStatus(staStatus); resp.setStatus(staStatus);
@ -107,7 +100,6 @@ public class UserInfoController {
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());
@ -160,7 +152,7 @@ public class UserInfoController {
if (endTime!=null&&endTime!="") { if (endTime!=null&&endTime!="") {
userInfo.setEndTime(endTime); userInfo.setEndTime(endTime);
} }
HashMap<String, Object> ret = userService.queryUserInfo(userInfo,pageNo,pageSize); HashMap<String, Object> ret = userInfoService.queryUserInfo(userInfo,pageNo,pageSize);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -177,43 +169,32 @@ public class UserInfoController {
*/ */
@Transactional @Transactional
@PostMapping("/deleteUserInfo") @PostMapping("/deleteUserInfo")
Response deleteUser(@RequestBody List<UserM> userList) { public Response deleteUserInfo(@RequestBody List<UserInfo> userList) {
Response resp = new Response(); Response resp = new Response();
int size = userList.size(); int size = userList.size();
for(int i=0;i<size;i++){ for(int i=0;i<size;i++){
UserM user = userList.get(i); UserInfo user = userList.get(i);
Integer userId = user.getUserId(); Integer userId = user.getUserId();
Integer roleId = user.getAccountRole(); //修改成账号
String phone = user.getPhone(); String account = user.getAccount();
if (userId==null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空,删除用户失败!"); resp.setErrmessage("用户id为空,删除用户失败!");
}else if (phone==null||phone==""){ }else if (account==null||account==""){
resp.setStatus(300);
resp.setErrmessage("用户电话为空,删除用户失败!");
}else if (roleId==null){
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户角色为空,删除用户失败!"); resp.setErrmessage("用户账号为空,删除用户失败!");
} else { } else {
HashMap<String, Object> ret = userService.deleteUser(userId); HashMap<String, Object> ret = userInfoService.deleteUserInfo(userId);
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"));
if (roleId==3||roleId==2){ HashMap<String, Object> sta = userInfoService.deleteStaff(user);
HashMap<String, Object> sta = userService.deleteStaff(user); int staStatus = (int) sta.get("retcode");
int staStatus = (int) ret.get("retcode");
if (200 == staStatus) { if (200 == staStatus) {
resp.setStatus(staStatus); resp.setStatus(staStatus);
resp.setMessage(sta.get("retvalue")); resp.setMessage(sta.get("retvalue"));
}else{ HashMap<String, Object> stu = userInfoService.deleteStudent(user);
resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}
if (roleId==4){
HashMap<String, Object> stu = userService.deleteStudent(user);
int stuStatus = (int) stu.get("retcode"); int stuStatus = (int) stu.get("retcode");
if (200 == stuStatus) { if (200 == stuStatus) {
resp.setStatus(stuStatus); resp.setStatus(stuStatus);
@ -223,6 +204,10 @@ public class UserInfoController {
resp.setErrmessage(stu.get("retvalue").toString()); resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException(); throw new RuntimeException();
} }
}else{
resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
} }
}else { }else {
resp.setStatus(status); resp.setStatus(status);
@ -239,40 +224,27 @@ public class UserInfoController {
*/ */
@Transactional @Transactional
@PostMapping("/updateUser") @PostMapping("/updateUser")
Response updateUser(@RequestBody UserVO vo) { public Response updateUser(@RequestBody UserInfoVO vo) {
Response resp = new Response(); Response resp = new Response();
UserM user = vo.getUser(); UserInfo user = vo.getUserInfo();
Staff staff = vo.getStaff(); Staff staff = vo.getStaff();
Student student = vo.getStudent(); Student student = vo.getStudent();
Integer userId = user.getUserId(); Integer userId = user.getUserId();
Integer roleId = user.getAccountRole();
if (userId==null) { if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户ID为空,修改用户失败!"); resp.setErrmessage("用户ID为空,修改用户失败!");
}else if (roleId==null){ } else {
resp.setStatus(300); HashMap<String, Object> ret = userInfoService.updateUser(user);
resp.setErrmessage("角色ID为空,修改用户失败!");
}
else {
HashMap<String, Object> ret = userService.updateUser(user);
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"));
if (roleId ==3||roleId==2){ HashMap<String, Object> sta = userInfoService.updateStaff(staff);
HashMap<String, Object> sta = userService.updateStaff(staff);
int staStatus = (int) sta.get("retcode"); int staStatus = (int) sta.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(staStatus); resp.setStatus(staStatus);
resp.setMessage(sta.get("retvalue")); resp.setMessage(sta.get("retvalue"));
}else{ HashMap<String, Object> stu = userInfoService.updateStudent(student);
resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException("修改员工失败!");
}
}
if (roleId ==4){
HashMap<String, Object> stu = userService.updateStudent(student);
int stuStatus = (int) stu.get("retcode"); int stuStatus = (int) stu.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(stuStatus); resp.setStatus(stuStatus);
@ -282,6 +254,10 @@ public class UserInfoController {
resp.setErrmessage(stu.get("retvalue").toString()); resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException("修改学生失败!"); throw new RuntimeException("修改学生失败!");
} }
}else{
resp.setStatus(staStatus);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException("修改员工失败!");
} }
} else { } else {
resp.setStatus(status); resp.setStatus(status);
@ -297,16 +273,19 @@ public class UserInfoController {
* 登陆(前台传来的key必须是phonepassword) * 登陆(前台传来的key必须是phonepassword)
*/ */
@GetMapping("/logins") @GetMapping("/logins")
Response logins(@RequestParam("phone") String phone, @RequestParam("password") String password, Response logins(@RequestParam("account") String account, @RequestParam("password") String password, HttpServletRequest req, HttpServletResponse res) {
HttpServletRequest req, HttpServletResponse res) {
Response resp = new Response(); Response resp = new Response();
UserM user = new UserM(); UserInfo user = new UserInfo();
if (phone != null) { if (account == null || account=="") {
user.setPhone(phone); resp.setStatus(300);
}if(password!=null) { resp.setErrmessage("用户账号为空,登录失败!");
}else if(password ==null || password=="") {
resp.setStatus(300);
resp.setErrmessage("用户密码为空,登录失败!");
}else{
user.setAccount(account);
user.setPassword(password); user.setPassword(password);
} HashMap<String, Object> ret = userInfoService.logins(user);
HashMap<String, Object> ret = userService.logins(user);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -315,6 +294,7 @@ public class UserInfoController {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
}
return resp; return resp;
} }
@ -322,17 +302,37 @@ public class UserInfoController {
/** /**
* 查询用户详情(ID) * 查询用户详情(ID)
*/ */
@GetMapping("/queryUserDetails") @GetMapping("/queryUserInfoDetails")
Response queryUserDetails(@RequestParam Integer userId, Integer roleId) { Response queryUserInfoDetails(@RequestParam Integer userId) {
Response resp = new Response(); Response resp = new Response();
if (roleId == null){ if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户角色id为空!查询失败!"); resp.setErrmessage("用户id为空!查询失败!");
}else if (userId==null) { }else {
HashMap<String, Object> ret = userInfoService.queryUserInfoDetails(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;
}
/**
* 查询用户详情(ID)
*/
@GetMapping("/queryUserProfiles")
Response queryUserProfiles(@RequestParam Integer userId) {
Response resp = new Response();
if (userId==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户id为空!查询失败!"); resp.setErrmessage("用户id为空!查询失败!");
}else { }else {
HashMap<String, Object> ret = userService.queryUserDetails(userId,roleId); HashMap<String, Object> ret = userInfoService.queryUserProfiles(userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -352,7 +352,7 @@ public class UserInfoController {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("Parameter Invalid"); resp.setErrmessage("Parameter Invalid");
}else { }else {
HashMap<String, Object> ret = userService.uploadUserAvatars(file,userId); HashMap<String, Object> ret = userInfoService.uploadUserAvatars(file,userId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
@ -385,7 +385,7 @@ public class UserInfoController {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("用户角色不能为空!"); resp.setErrmessage("用户角色不能为空!");
} else { } else {
HashMap<String, Object> ret = userService.updateLogInNumber(user); HashMap<String, Object> ret = userInfoService.updateLogInNumber(user);
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 +410,7 @@ public class UserInfoController {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("城市id为空!查询失败!"); resp.setErrmessage("城市id为空!查询失败!");
}else { }else {
HashMap<String, Object> ret = userService.queryCustomer(cityId,provinceId); HashMap<String, Object> ret = userInfoService.queryCustomer(cityId,provinceId);
resp.setStatus(200); resp.setStatus(200);
resp.setErrmessage("查询成功!"); resp.setErrmessage("查询成功!");
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
@ -429,13 +429,13 @@ public class UserInfoController {
* 查询账号是否存在 * 查询账号是否存在
*/ */
@GetMapping("/queryAccountIsExist") @GetMapping("/queryAccountIsExist")
Response queryAccountIsExist(@RequestParam String userAccount) { Response queryAccountIsExist(@RequestParam String account) {
Response resp = new Response(); Response resp = new Response();
if (userAccount==null) { if (account==null) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("账号为空!"); resp.setErrmessage("账号为空!");
}else { }else {
HashMap<String, Object> ret = userService.queryAccountIsExist(userAccount); HashMap<String, Object> ret = userInfoService.queryAccountIsExist(account);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);
@ -458,7 +458,7 @@ public class UserInfoController {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("账号为空!"); resp.setErrmessage("账号为空!");
}else { }else {
HashMap<String, Object> ret = userService.queryWorkNumberIsExist(workNumber); HashMap<String, Object> ret = userInfoService.queryWorkNumberIsExist(workNumber);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (200 == status) { if (200 == status) {
resp.setStatus(status); resp.setStatus(status);

@ -0,0 +1,164 @@
package com.yipin.liuwanr.entity;
public class OrganizationRelationship {
//用户id
private Integer userId;
//平台ID
private Integer platformId;
//学校id
private Integer schoolId;
//学校名称
private String schoolName;
//角色ID
private Integer roleId;
//工号学号
private String workNumber;
//一级部门ID
private Integer oneDepartmentId;
//二级部门ID
private Integer twoDepartmentId;
//一级部门名称
private String oneDepartmentName;
//二级部门名称
private String twoDepartmentName;
//绑定专业ID
private Integer professionalId;
//绑定专业名称
private String professionalName;
//年级ID
private Integer gradeId;
//年级名称
private String gradeName;
//班级ID
private Integer classId;
//班级名称
private String className;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getWorkNumber() {
return workNumber;
}
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public Integer getOneDepartmentId() {
return oneDepartmentId;
}
public void setOneDepartmentId(Integer oneDepartmentId) {
this.oneDepartmentId = oneDepartmentId;
}
public Integer getTwoDepartmentId() {
return twoDepartmentId;
}
public void setTwoDepartmentId(Integer twoDepartmentId) {
this.twoDepartmentId = twoDepartmentId;
}
public String getOneDepartmentName() {
return oneDepartmentName;
}
public void setOneDepartmentName(String oneDepartmentName) {
this.oneDepartmentName = oneDepartmentName;
}
public String getTwoDepartmentName() {
return twoDepartmentName;
}
public void setTwoDepartmentName(String twoDepartmentName) {
this.twoDepartmentName = twoDepartmentName;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public String getGradeName() {
return gradeName;
}
public void setGradeName(String gradeName) {
this.gradeName = gradeName;
}
public Integer getClassId() {
return classId;
}
public void setClassId(Integer classId) {
this.classId = classId;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
}

@ -0,0 +1,94 @@
package com.yipin.liuwanr.entity;
import java.util.List;
/**
* 用户信息实体
*
* @author Ning
*/
public class PersonalFile {
//个人档案id
private Integer personalFileId;
//个人职业id(1、学生 2、老师)
private Integer personalCareerId;
//绑定学校id
private Integer schoolId;
//绑定学科id
private Integer disciplineId;
//绑定专业类id
private Integer professionalClassId;
//绑定专业id
private Integer professionalId;
//用户id
private Integer userId;
public Integer getPersonalFileId() {
return personalFileId;
}
public void setPersonalFileId(Integer personalFileId) {
this.personalFileId = personalFileId;
}
public Integer getPersonalCareerId() {
return personalCareerId;
}
public void setPersonalCareerId(Integer personalCareerId) {
this.personalCareerId = personalCareerId;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public Integer getDisciplineId() {
return disciplineId;
}
public void setDisciplineId(Integer disciplineId) {
this.disciplineId = disciplineId;
}
public Integer getProfessionalClassId() {
return professionalClassId;
}
public void setProfessionalClassId(Integer professionalClassId) {
this.professionalClassId = professionalClassId;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
@Override
public String toString() {
return "PersonalFile{" +
"personalFileId=" + personalFileId +
", personalCareerId=" + personalCareerId +
", schoolId=" + schoolId +
", disciplineId=" + disciplineId +
", professionalClassId=" + professionalClassId +
", professionalId=" + professionalId +
", userId=" + userId +
'}';
}
}

@ -1,7 +1,8 @@
package com.yipin.liuwanr.entity; package com.yipin.liuwanr.entity;
public class Staff { public class Staff {
//账号
private String account;
//员工主键ID //员工主键ID
private Integer staffId; private Integer staffId;
//员工名称 //员工名称
@ -37,6 +38,14 @@ public class Staff {
//绑定学校id //绑定学校id
private Integer schoolId; private Integer schoolId;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public Integer getSchoolId() { public Integer getSchoolId() {
return schoolId; return schoolId;
} }

@ -0,0 +1,207 @@
package com.yipin.liuwanr.entity;
import java.util.List;
//学生和老师管理员组织关系信息实体
public class StuStaff {
//主键ID
private Integer id;
//账号
private String account;
//用户id
private Integer userId;
//名字
private String name;
//角色Id
private Integer roleId;
//工号
private String workNumber;
//电话
private String phone;
//邮件
private String email;
//绑定员工年级架构ID
private Integer staffGradeId;
//绑定专业ID
private Integer staffProfessionalArchitectureId;
//绑定专业名称
private String staffProfessionalArchitectureName;
//绑定员工年级名称
private String staffGradeName;
//唯一标示性账号
private String uniqueIdentificationAccount;
//绑定学校id
private Integer schoolId;
//绑定专业ID
private Integer professionalId;
//绑定年级ID
private Integer gradeId;
//绑定班级ID
private Integer classId;
//专业名称
private String professionalName;
//年级名称
private String gradeName;
//绑定班级名称
private String className;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWorkNumber() {
return workNumber;
}
public void setWorkNumber(String workNumber) {
this.workNumber = workNumber;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getStaffGradeId() {
return staffGradeId;
}
public void setStaffGradeId(Integer staffGradeId) {
this.staffGradeId = staffGradeId;
}
public Integer getStaffProfessionalArchitectureId() {
return staffProfessionalArchitectureId;
}
public void setStaffProfessionalArchitectureId(Integer staffProfessionalArchitectureId) {
this.staffProfessionalArchitectureId = staffProfessionalArchitectureId;
}
public String getStaffProfessionalArchitectureName() {
return staffProfessionalArchitectureName;
}
public void setStaffProfessionalArchitectureName(String staffProfessionalArchitectureName) {
this.staffProfessionalArchitectureName = staffProfessionalArchitectureName;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getStaffGradeName() {
return staffGradeName;
}
public void setStaffGradeName(String staffGradeName) {
this.staffGradeName = staffGradeName;
}
public String getUniqueIdentificationAccount() {
return uniqueIdentificationAccount;
}
public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) {
this.uniqueIdentificationAccount = uniqueIdentificationAccount;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public Integer getGradeId() {
return gradeId;
}
public void setGradeId(Integer gradeId) {
this.gradeId = gradeId;
}
public Integer getClassId() {
return classId;
}
public void setClassId(Integer classId) {
this.classId = classId;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public String getGradeName() {
return gradeName;
}
public void setGradeName(String gradeName) {
this.gradeName = gradeName;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
}

@ -2,6 +2,8 @@ package com.yipin.liuwanr.entity;
public class Student { public class Student {
//账号
private String account;
//学生主键ID //学生主键ID
private Integer studentId; private Integer studentId;
//学生名称 //学生名称
@ -57,6 +59,14 @@ public class Student {
//学生专业组织架构名称 //学生专业组织架构名称
private String stuProfessionalArchitectureName; private String stuProfessionalArchitectureName;
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getStuProfessionalArchitectureName() { public String getStuProfessionalArchitectureName() {
return stuProfessionalArchitectureName; return stuProfessionalArchitectureName;
} }

@ -0,0 +1,138 @@
package com.yipin.liuwanr.entity;
import java.util.List;
/**
* 用户档案实体
*
* @author Ning
*/
public class UserProfiles {
//个人档案id
private Integer personalFileId;
//个人职业id
private Integer personalCareerId;
//绑定学校id
private Integer schoolId;
//学校名称
private String schoolName;
//绑定学科id
private Integer disciplineId;
//学科名称
private String disciplineName;
//绑定专业类id
private Integer professionalClassId;
//专业类名称
private String professionalClassName;
//绑定专业id
private Integer professionalId;
//专业名称
private String professionalName;
//绑定用户id
private Integer userId;
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public String getDisciplineName() {
return disciplineName;
}
public void setDisciplineName(String disciplineName) {
this.disciplineName = disciplineName;
}
public String getProfessionalClassName() {
return professionalClassName;
}
public void setProfessionalClassName(String professionalClassName) {
this.professionalClassName = professionalClassName;
}
public String getProfessionalName() {
return professionalName;
}
public void setProfessionalName(String professionalName) {
this.professionalName = professionalName;
}
public Integer getPersonalFileId() {
return personalFileId;
}
public void setPersonalFileId(Integer personalFileId) {
this.personalFileId = personalFileId;
}
public Integer getPersonalCareerId() {
return personalCareerId;
}
public void setPersonalCareerId(Integer personalCareerId) {
this.personalCareerId = personalCareerId;
}
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public Integer getDisciplineId() {
return disciplineId;
}
public void setDisciplineId(Integer disciplineId) {
this.disciplineId = disciplineId;
}
public Integer getProfessionalClassId() {
return professionalClassId;
}
public void setProfessionalClassId(Integer professionalClassId) {
this.professionalClassId = professionalClassId;
}
public Integer getProfessionalId() {
return professionalId;
}
public void setProfessionalId(Integer professionalId) {
this.professionalId = professionalId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
@Override
public String toString() {
return "UserProfiles{" +
"personalFileId=" + personalFileId +
", personalCareerId=" + personalCareerId +
", schoolId=" + schoolId +
", schoolName='" + schoolName + '\'' +
", disciplineId=" + disciplineId +
", disciplineName='" + disciplineName + '\'' +
", professionalClassId=" + professionalClassId +
", professionalClassName='" + professionalClassName + '\'' +
", professionalId=" + professionalId +
", professionalName='" + professionalName + '\'' +
", userId=" + userId +
'}';
}
}

@ -16,10 +16,12 @@ import com.yipin.liuwanr.entity.Student;
public interface ExperimentalClassMapper { public interface ExperimentalClassMapper {
//实验班级添加学生
@Insert("INSERT INTO experimental_class_student(studentId,experimentalClassId)" @Insert("INSERT INTO experimental_class_student(studentId,experimentalClassId)"
+ "VALUES(#{studentId},#{experimentalClassId})") + "VALUES(#{studentId},#{experimentalClassId})")
void experimentClassAddStudent(Student student); void experimentClassAddStudent(Student student);
//实验班级删除学生
@Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{experimentalClassId}") @Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{experimentalClassId}")
void experimentClassDeleteStudent(Student student); void experimentClassDeleteStudent(Student student);
@ -29,11 +31,12 @@ public interface ExperimentalClassMapper {
@Options(useGeneratedKeys=true, keyProperty="experimentalClassId", keyColumn="experimentalClassId") @Options(useGeneratedKeys=true, keyProperty="experimentalClassId", keyColumn="experimentalClassId")
void addExperimentalClass(ExperimentalClass experimentalClass); void addExperimentalClass(ExperimentalClass experimentalClass);
//查询实验班级
@Select({"<script>", @Select({"<script>",
"SELECT experimentalClassId,experimentalClassName,classSize,creationTime,founder,courseId,userId,schoolId " "SELECT experimentalClassId,experimentalClassName,classSize,creationTime,founder,courseId,userId,schoolId "
+ "from experimental_class_ning where isdel = 0 and schoolId = #{schoolId} and courseId=#{courseId}", + "from experimental_class_ning where isdel = 0 and schoolId = #{schoolId} and courseId=#{courseId} and userId = #{userId}",
"</script> "}) "</script> "})
List<ExperimentalClass> queryExperimentalClass(Integer schoolId,Integer courseId); List<ExperimentalClass> queryExperimentalClass(Integer schoolId,Integer courseId,Integer userId);
//查询实验班级学生专业 //查询实验班级学生专业
@Select({"<script>", @Select({"<script>",
@ -47,6 +50,7 @@ public interface ExperimentalClassMapper {
"</script> "}) "</script> "})
List<Student> queryStudentClass(Integer experimentalClassId); List<Student> queryStudentClass(Integer experimentalClassId);
//查询实验班级详情
@Select({"<script>", @Select({"<script>",
"SELECT stu.*,pro.professionalName,gra.gradeName from student stu,experimental_class_ning exp,grade gra,professional pro WHERE stu.experimentalClassId = exp.experimentalClassId and stu.gradeId = gra.gradeId and FIND_IN_SET(exp.experimentalClassId,#{experimentalClassId}) ", "SELECT stu.*,pro.professionalName,gra.gradeName from student stu,experimental_class_ning exp,grade gra,professional pro WHERE stu.experimentalClassId = exp.experimentalClassId and stu.gradeId = gra.gradeId and FIND_IN_SET(exp.experimentalClassId,#{experimentalClassId}) ",
" <if test='professionalId!=null'>and stu.professionalId = #{professionalId} </if>", " <if test='professionalId!=null'>and stu.professionalId = #{professionalId} </if>",
@ -56,17 +60,21 @@ public interface ExperimentalClassMapper {
"</script> "}) "</script> "})
List<Student> queryExperimentalClassDetails(Student student); List<Student> queryExperimentalClassDetails(Student student);
//查询实验班级详情1
@Select({"<script>", @Select({"<script>",
"SELECT n.* from experimental_class_ning n where n.experimentalClassId = #{experimentalClassId}", "SELECT n.* from experimental_class_ning n where n.experimentalClassId = #{experimentalClassId}",
"</script> "}) "</script> "})
List<ExperimentalClass> queryExperimentalClassDetails1(Integer experimentalClassId); List<ExperimentalClass> queryExperimentalClassDetails1(Integer experimentalClassId);
//删除实验班级
@Update("UPDATE experimental_class_ning SET isdel = 1 where experimentalClassId = #{experimentalClassId}") @Update("UPDATE experimental_class_ning SET isdel = 1 where experimentalClassId = #{experimentalClassId}")
void deleteExperimentalClass(Integer experimentalClassId); void deleteExperimentalClass(Integer experimentalClassId);
//删除实验班级学生
@Delete("Delete from experimental_class_student where experimentalClassId = #{experimentalClassId}") @Delete("Delete from experimental_class_student where experimentalClassId = #{experimentalClassId}")
void deleteExperimentalClassStu(Integer experimentalClassId); void deleteExperimentalClassStu(Integer experimentalClassId);
//修改实验班级
@Update("UPDATE experimental_class_ning SET experimentalClassName = #{experimentalClassName},classSize = #{classSize},practiceNumber = #{practiceNumber},inspectionNumber = #{inspectionNumber},courseSchedule = #{courseSchedule},founder = #{founder},courseId = #{courseId} where experimentalClassId = #{experimentalClassId}") @Update("UPDATE experimental_class_ning SET experimentalClassName = #{experimentalClassName},classSize = #{classSize},practiceNumber = #{practiceNumber},inspectionNumber = #{inspectionNumber},courseSchedule = #{courseSchedule},founder = #{founder},courseId = #{courseId} where experimentalClassId = #{experimentalClassId}")
void updateExperimentalClass(ExperimentalClass experimentalClass); void updateExperimentalClass(ExperimentalClass experimentalClass);
@ -99,7 +107,7 @@ public interface ExperimentalClassMapper {
@Select("select s.studentId,studentName from student s left join experimental_class_student exs on s.studentId=exs.studentId " + @Select("select s.studentId,studentName from student s left join experimental_class_student exs on s.studentId=exs.studentId " +
" where exs.experimentalClassId=#{experimentalClassId} GROUP BY s.studentId") " where exs.experimentalClassId=#{experimentalClassId} GROUP BY s.studentId")
List<Student> querystudent(Integer experimentalClassId); List<Student> queryStudent(Integer experimentalClassId);
/** /**

@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.entity.UserInfo;
import com.yipin.liuwanr.entity.UserM; import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.vo.UserVO; import com.yipin.liuwanr.vo.UserVO;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -109,7 +110,7 @@ public interface StaffMapper {
"<if test='workNumber!=null'>and staffWorkNumber=#{workNumber} </if>", "<if test='workNumber!=null'>and staffWorkNumber=#{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(UserInfo user);
@Update("update staff set lastTimeOfLanding=#{lastTime},logNumber=#{logNumber} where staffId=#{staffId}") @Update("update staff set lastTimeOfLanding=#{lastTime},logNumber=#{logNumber} where staffId=#{staffId}")

@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.entity.UserInfo;
import com.yipin.liuwanr.entity.UserM; import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.vo.UserVO; import com.yipin.liuwanr.vo.UserVO;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -112,7 +113,7 @@ public interface StudentMapper {
"<if test='workNumber!=null'>and studentNumber=#{workNumber} </if>", "<if test='workNumber!=null'>and studentNumber=#{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(UserInfo user);
@Update("update student set lastLoginTime=#{lastTime},loginNumber=#{loginNumber} where studentId=#{studentId}") @Update("update student set lastLoginTime=#{lastTime},loginNumber=#{loginNumber} where studentId=#{studentId}")

@ -0,0 +1,181 @@
package com.yipin.liuwanr.mapper;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.vo.UserInfoVO;
import com.yipin.liuwanr.vo.UserVO;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import java.util.List;
public interface UserInfoMapper {
@Update({ "<script>",
"UPDATE lw_user SET",
"<when test='mobile!=null'>", "mobile=#{mobile},", "</when>",
"<when test='email!=null'>", "email=#{email},", "</when>",
"<when test='nickname!=null'>", "nickname=#{nickname},", "</when>",
"<when test='sex!=-1'>", "sex=#{sex},", "</when>",
"<when test='sign!=null'>", "sign=#{sign},", "</when>",
"<when test='birthday!=null'>", "birthday=#{birthday},", "</when>",
"<when test='avatar!=null'>", "avatar=#{avatar},", "</when>",
"<when test='country!=null'>", "country=#{country},", "</when>",
"<when test='province!=null'>", "province=#{province},", "</when>",
"<when test='city!=null'>", "city=#{city},", "</when>",
"updatetime=now() WHERE uuid =#{uuid}",
"</script>"})
void update(User user);
@Insert("INSERT INTO hr_user_info(userName,uniqueIdentificationAccount,documentType,IDNumber,provinceId,cityId,countries,dateBirth,educationDegree,schoolId,phone,weChatID,email,account,password,creationTime,logInNumber,sex,userAvatars,isdel)"
+ " VALUES(#{userName},#{uniqueIdentificationAccount},#{documentType},#{IDNumber},#{provinceId},#{cityId},#{countries},#{dateBirth},#{educationDegree},#{schoolId},#{phone},#{weChatID},#{email},#{account},#{password},now(),#{logInNumber},#{sex},#{userAvatars},0)")
@Options(useGeneratedKeys=true, keyProperty="userId", keyColumn="userId")
void addUser(UserInfo user);
@Select({"<script>",
"SELECT s.schoolName,s.provinceId,s.cityId,s.provinceName,s.cityName,u.userId,u.userName,u.countries,u.creationTime,u.account,u.logInNumber,hor.schoolId,hor.platformId,hor.roleId FROM hr_user_info u,hr_organization_relationship hor,school s WHERE u.userId = hor.userId and hor.schoolId = s.schoolId and s.isdel = 0",
" <if test='countries!=null and countries !=\"\" '>and u.countries = #{countries} </if>",
" <if test='provinceId!=null and provinceId !=\"\" '>and u.provinceId = #{provinceId} </if>",
" <if test='schoolId!=null and schoolId !=\"\"'>and u.schoolId = #{schoolId} </if>",
" <if test='cityId!=null and cityId !=\"\" '>and u.cityId = #{cityId} </if>",
" <if test='roleId!=null and roleId !=\"\" '>and u.roleId = #{roleId} </if>",
// " <if test='searchContent!=null and searchContent !=\"\" '> AND CONCAT(u.name, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')</if>",
" <if test='month==3'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)</if>",
" <if test='month==6'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)</if>",
" <if test='month==9'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)</if>",
" <if test='month==12'>and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 12 MONTH)</if>",
" <if test='creationTime!=null and endTime!=null and endTime!=\"\" and creationTime!=\"\" '> and u.creationTime between #{creationTime} and #{endTime}</if>",
"GROUP BY u.userId order by u.creationTime desc",
"</script> "})
List<UserInfo> queryUserInfo(UserInfo userInfo);
@Update("UPDATE hr_user_info SET isdel = 1 where userId = #{userId}")
void deleteUser(Integer userId);
//批量删除员工
@Update({ "<script>",
"UPDATE staff SET isdel = 1 where account = #{account} ",
"</script>" })
void deleteStaff(UserInfo user);
//批量删除学生
@Update({ "<script>",
"UPDATE student SET isdel = 1 where account = #{account} ",
"</script>" })
void deleteStudent(UserInfo user);
//修改用户
@Update("UPDATE user SET name = #{name},sex = #{sex},documentType = #{documentType},countries = #{countries},educationDegree = #{educationDegree},"
+ "IDNumber = #{IDNumber},accountRole = #{accountRole},provinceId = #{provinceId},subjectsTaught = #{subjectsTaught},cityId = #{cityId},"
+ "phone = #{phone},teachingProfessional = #{teachingProfessional},WeChatID = #{WeChatID},dateBirth = #{dateBirth},email = #{email},schoolId = #{schoolId},disciplineId = #{disciplineId},professionalId = #{professionalId},professionalClassId = #{professionalClassId} where userId = #{userId}")
void updateUser(UserInfo user);
//修改员工
@Update("UPDATE staff SET staffName = #{staffName},staffWorkNumber = #{staffWorkNumber},phone = #{phone},email = #{email},staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},"
+ "staffProfessionalArchitectureId = #{staffProfessionalArchitectureId},staffGradeId = #{staffGradeId},roleId = #{roleId} where phone = #{phone}")
void updateStaff(Staff staff);
//修改学生
@Update("UPDATE student SET studentName = #{studentName},studentNumber = #{studentNumber},phone = #{phone},email = #{email},roleId = #{roleId}"
+ ",schoolId = #{schoolId},professionalId = #{professionalId},gradeId = #{gradeId},classId = #{classId} where phone = #{phone}")
void updateStudent(Student student);
//登陆
@Select("SELECT * from hr_user_info where isdel=0 and account = #{account} and password = #{password}")
UserInfo logins(UserInfo userInfo);
//查询用户roleId
@Select("SELECT schoolId,roleId from hr_organization_relationship where userId = #{userId}")
OrganizationRelationship queryOrganizationRelationship(Integer userId);
//查询用户手机
@Select("SELECT u.* from user u where isdel=0 and phone = #{phone}")
List<UserM> queryPhone(String phone);
//查询用户详情
@Select({"<script>",
"SELECT * from hr_user_info where isdel = 0 and userId = #{userId}",
"</script> "})
List<UserInfoVO> queryUserInfoDetails(Integer userId);
//查询用户详情
@Select({"<script>",
"SELECT * from hr_personal_file where userId = #{userId}",
"</script> "})
List<UserProfiles> queryUserProfiles(Integer userId);
@Select({"<script>",
"SELECT customerId,customerName,schoolId FROM customer where isdel = 0 and provinceId = #{provinceId} and cityId = #{cityId}",
"</script> "})
List<Customer> queryCustomer(Integer cityId, Integer provinceId);
/**
* 批量插入用户
* @param user
*/
@Insert({
"<script>",
"insert into user(name, password,accountRole,workNumber,phone,uniqueIdentificationAccount,creationTime,isdel) values ",
"<foreach collection='users' item='user' index='index' separator=','>",
"(#{user.name}, #{user.password}, #{user.accountRole}, #{user.workNumber} ,#{user.phone},#{user.uniqueIdentificationAccount},now(),0)",
"</foreach>",
"</script>"
})
void addUserM(@Param("users") List<UserM> users);
//修改用户头像
@Update("update user set userAvatars=#{userAvatars} where userId=#{userId}")
void updateUserAvatars(@Param("userAvatars") String userAvatars, @Param("userId") Integer userId);
//更新用户登录次数和最后一次登录时间
@Update({ "UPDATE user SET logInNumber=logInNumber+1, lastTimeOfLanding=now() WHERE userId=#{userId}"})
void updateLogInNumber(UserM user);
//更新用户登录次数和最后一次登录时间
@Update({ "UPDATE student SET logInNumber=logInNumber+1, lastLoginTime=now() WHERE phone=#{phone}"})
void updateStudentLogInNumber(UserM user);
//更新用户登录次数和最后一次登录时间
@Update({ "UPDATE staff SET logNumber=logNumber+1, lastTimeOfLanding=now() WHERE phone=#{phone}"})
void updateStaffLogInNumber(UserM user);
//查询账号是否存在
@Select("SELECT userId,account from user where isdel = 0 and account = #{account}")
List<UserInfo> queryAccountIsExist(String account);
//查询学号、工号是否存在
@Select("SELECT userId,workNumber from user where isdel = 0 and workNumber = #{workNumber}")
List<UserM> queryWorkNumberIsExist(String workNumber);
//========全承珠
@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) values ",
"<foreach collection='list' item='list' index='index' separator=','>",
"(#{list.personalCareerId}, #{list.schoolId}, #{list.disciplineId}, #{list.professionalClassId} ,#{list.professionalId},#{list.userId})",
"</foreach>",
"</script>"
})
void addPersonalFile(List<UserProfiles> list);
//添加学生
@Insert("INSERT INTO student(account,userId,studentName,roleId,studentNumber,phone,email,professionalId,gradeId,classId,professionalName,gradeName,className,uniqueIdentificationAccount,schoolId,isdel)"
+ " VALUES(#{account},#{userId},#{name},#{roleId},#{workNumber},#{phone},#{email},#{professionalId},#{gradeId},#{classId},#{professionalName},#{gradeName},#{className},#{uniqueIdentificationAccount},#{schoolId},0)")
void addStudent(StuStaff stuStaff);
//添加员工
@Insert("INSERT INTO staff(account,userId,staffName,roleId,staffWorkNumber,phone,email,staffGradeId,staffProfessionalArchitectureId,staffProfessionalArchitectureName,staffGradeName,uniqueIdentificationAccount,schoolId,isdel)"
+ " VALUES(#{account},#{userId},#{name},#{roleId},#{workNumber},#{phone},#{email},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffProfessionalArchitectureName},#{staffGradeName},#{uniqueIdentificationAccount},#{schoolId},0)")
void addStaff(StuStaff stuStaff);
}

@ -147,7 +147,7 @@ public interface UserMapper {
"</script> "}) "</script> "})
List<UserInfo> queryUserInfo(UserInfo userInfo); List<UserInfo> queryUserInfo(UserInfo userInfo);
@Update("UPDATE user SET isdel = 1 where userId = #{userId}") @Update("UPDATE hr_userInfo SET isdel = 1 where userId = #{userId}")
void deleteUser(Integer userId); void deleteUser(Integer userId);
//批量删除员工 //批量删除员工

@ -98,11 +98,11 @@ public class ExperimentalClassService {
return resp; return resp;
} }
public HashMap<String, Object> queryExperimentalClass(Integer schoolId,Integer courseId) { public HashMap<String, Object> queryExperimentalClass(Integer schoolId,Integer courseId,Integer userId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if(!StringUtils.isEmpty(courseId)){ if(!StringUtils.isEmpty(courseId)){
resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId,courseId)); resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId,courseId,userId));
resp.put("retcode", 200); resp.put("retcode", 200);
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -179,12 +179,12 @@ public class ExperimentalClassService {
//新增学生显示数据 //新增学生显示数据
public HashMap<String, Object> queryexperimentalClass(Integer experimentalClassId) { public HashMap<String, Object> queryExperimentalClass(Integer experimentalClassId) {
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>();
try { try {
List<ExperimentalClass> classes = experimentalClassMapper.queryExperimentalClassDetails1(experimentalClassId); List<ExperimentalClass> classes = experimentalClassMapper.queryExperimentalClassDetails1(experimentalClassId);
List<Student> students = experimentalClassMapper.querystudent(experimentalClassId); List<Student> students = experimentalClassMapper.queryStudent(experimentalClassId);
obj.put("experimentalClass", classes); obj.put("experimentalClass", classes);
obj.put("students", students); obj.put("students", students);

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.entity.PersonalFile;
import com.yipin.liuwanr.vo.UserVO; import com.yipin.liuwanr.vo.UserVO;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -37,6 +38,7 @@ public class StudentService {
@Autowired @Autowired
private UserMapper userMapper; private UserMapper userMapper;
//添加学生
public HashMap<String, Object> addStudent(Student student) { public HashMap<String, Object> addStudent(Student student) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {

@ -0,0 +1,454 @@
package com.yipin.liuwanr.service;
import com.aliyun.oss.OSSClient;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yipin.liuwanr.AliyunOssConfig;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.helper.OssConfigUtil;
import com.yipin.liuwanr.helper.RandomUtil;
import com.yipin.liuwanr.mapper.StaffMapper;
import com.yipin.liuwanr.mapper.StudentMapper;
import com.yipin.liuwanr.mapper.UserInfoMapper;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import redis.clients.jedis.JedisCluster;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Service
public class UserInfoService {
private static Logger logger = Logger.getLogger(UserInfoService.class);
@Autowired
private StaffMapper staffMapper;
@Autowired
private StudentMapper studentMapper;
@Autowired
private UserInfoMapper userInfoMapper;
@Autowired
private JedisCluster jedis;
@Autowired
private AliyunOssConfig config;
@Autowired
private BeanFactory beanFactory;
public HashMap<String, Object> login(String id, String password){
HashMap<String, Object> resp = new HashMap<String, Object>();
User user = null;
if(null == password || password.isEmpty()){
// user = userInfoMapper.getSelfBy3rdId(id);
}else{
String storedPassword = RandomUtil.parsePassword(password);
// user = userInfoMapper.getSelfByAccount(id);
if( null != user){
logger.info(user.toString());
logger.info(user.getPassword());
logger.info(storedPassword);
if(0 == user.getPassword().compareToIgnoreCase(storedPassword)){
user.setPassword(null);
resp.put("retcode", 200);
resp.put("retvalue", user);
}
else{
resp.put("retcode",500);
resp.put("retvalue","User/Password Invalid");
}
}
}
if(null == user){
resp.put("retcode",400);
resp.put("retvalue","Account Invalid");
}
return resp;
}
//查询手机号
public HashMap<String, Object>queryPhone(String phone) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryPhone(phone));
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> addUser(UserInfo user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
user.setPassword("huoran123");//设置默认密码
userInfoMapper.addUser(user);
Integer userId = user.getUserId();
resp.put("userId",userId);
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> queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(pageNo!=null&&pageSize!=null) {
PageHelper.startPage(pageNo, pageSize);
List<UserInfo> list = userInfoMapper.queryUserInfo(userInfo);
PageInfo<UserInfo> info=new PageInfo<UserInfo>(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<UserInfo> list = userInfoMapper.queryUserInfo(userInfo);
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> deleteUserInfo(Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.deleteUser(userId);
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> deleteStaff(UserInfo user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.deleteStaff(user);
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> deleteStudent(UserInfo user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.deleteStudent(user);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "删除学生失败");
return resp;
}
return resp;
}
//更新用户
@Transactional
public HashMap<String, Object> updateUser(UserInfo user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.updateUser(user);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "更新用户失败!");
throw new RuntimeException();
}
return resp;
}
//更新学生
@Transactional
public HashMap<String, Object> updateStudent(Student student){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.updateStudent(student);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "更新学生失败!");
throw new RuntimeException();
}
return resp;
}
//更新员工
@Transactional
public HashMap<String, Object> updateStaff(Staff staff){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
userInfoMapper.updateStaff(staff);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "更新员工失败!");
throw new RuntimeException();
}
return resp;
}
//登陆
public HashMap<String, Object> logins(UserInfo userInfo){
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
Student student;
Staff staff;
try {
UserInfo user=userInfoMapper.logins(userInfo);
if(user!=null) {
Integer userId = user.getUserId();
OrganizationRelationship organizationRelationship = userInfoMapper.queryOrganizationRelationship(userId);
// user.setRoleId(roleId);
// int loginNumber=user.getLogInNumber()+1;
// long time=System.currentTimeMillis();
// Date date = new Date(time);
// SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String lastTime=sd.format(date);
// if(roleId.equals(4)) {
// student=studentMapper.queryStudentQ(user);
// if(student!=null) {
// Integer studentId=student.getStudentId();
// studentMapper.updateStudentQ(lastTime,loginNumber, studentId);
// obj.put("student",student);
// }
// }else if(roleId.equals(3)) {
// staff =staffMapper.queryStaffQ(user);
// if(staff!=null) {
// Integer staffId=staff.getStaffId();
// staffMapper.updateStaffQ(lastTime,loginNumber, staffId);
// obj.put("staff",staff);
// }
// }
// user.setPassword(null);
// obj.put("user",user);
// userInfoMapper.updateUserQ(lastTime,loginNumber, userId);
resp.put("retcode", 200);
resp.put("retvalue", obj);
}else {
resp.put("retcode", 300);
resp.put("retvalue", "登录失败,账号密码有误或不存在!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "登录异常,请稍后再试!");
return resp;
}
return resp;
}
//查询用户详情
public HashMap<String, Object> queryUserInfoDetails(Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryUserInfoDetails(userId));
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> queryUserProfiles(Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryUserProfiles(userId));
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> queryCustomer(Integer cityId,Integer provinceId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryCustomer(cityId,provinceId));
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> uploadUserAvatars(MultipartFile file,Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
OSSClient client=beanFactory.getBean(OSSClient.class);
FilesResult result=OssConfigUtil.uploadUserAvatars(file, client, config);
//用户图片路径
String userAvatars=result.getFileUrl();
userInfoMapper.updateUserAvatars(userAvatars,userId);
resp.put("retcode", 200);
resp.put("retvalue", userAvatars);
} catch (Exception e) {
logger.info(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "修改头像失败!");
return resp;
}
return resp;
}
//更新登录次数和时间
public HashMap<String, Object> updateLogInNumber(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer accountRole = user.getAccountRole();
userInfoMapper.updateLogInNumber(user);
if (accountRole==3){
//更新员工登录次数和时间
userInfoMapper.updateStaffLogInNumber(user);
}
if (accountRole==4){
//更新学生登录次数和时间
userInfoMapper.updateStudentLogInNumber(user);
}
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> queryAccountIsExist(String account){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryAccountIsExist(account));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
//查询学号、工号是否存在
public HashMap<String, Object> queryWorkNumberIsExist(String workNumber){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userInfoMapper.queryWorkNumberIsExist(workNumber));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
return resp;
}
return resp;
}
//添加个人档案
public HashMap<String, Object> addPersonalFile(List<UserProfiles> userProfilesList,Integer userId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer size = userProfilesList.size();
for (int i = 0; i < size; i++){
UserProfiles userProfiles = userProfilesList.get(i);
userProfiles.setUserId(userId);
}
userInfoMapper.addPersonalFile(userProfilesList);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加个人档案失败");
return resp;
}
return resp;
}
//添加学生和员工信息
@Transactional
public HashMap<String, Object> addStuStaff(List<StuStaff> stuStaffList,Integer userId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
int size = stuStaffList.size();
for (int i=0;i<size;i++){
StuStaff stuStaff = stuStaffList.get(i);
stuStaff.setUserId(userId);
Integer roleId = stuStaff.getRoleId();
if (roleId == 2 || roleId == 3){
//添加老师和管理员sql
userInfoMapper.addStaff(stuStaff);
resp.put("retcode", 200);
}else if (roleId == 4){
//添加学生sql
userInfoMapper.addStudent(stuStaff);
resp.put("retcode", 200);
}else{
resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!,角色id有误!");
throw new RuntimeException("添加学生和员工信息失败!,角色id有误!");
}
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加学生和员工信息失败!");
throw new RuntimeException("添加学生和员工信息失败!");
// return resp;
}
return resp;
}
}

@ -170,37 +170,6 @@ public class UserService {
return resp; return resp;
} }
//查询用户信息
public HashMap<String, Object> queryUserInfo(UserInfo userInfo,Integer pageNo,Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(pageNo!=null&&pageSize!=null) {
PageHelper.startPage(pageNo, pageSize);
List<UserInfo> list = userMapper.queryUserInfo(userInfo);
PageInfo<UserInfo> info=new PageInfo<UserInfo>(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<UserInfo> list = userMapper.queryUserInfo(userInfo);
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> deleteUser(Integer userId){ public HashMap<String, Object> deleteUser(Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
@ -309,21 +278,21 @@ public class UserService {
Date date = new Date(time); Date date = new Date(time);
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String lastTime=sd.format(date); String lastTime=sd.format(date);
if(user.getAccountRole().equals(4)) { // if(user.getAccountRole().equals(4)) {
student=studentMapper.queryStudentQ(user); // student=studentMapper.queryStudentQ(user);
if(student!=null) { // if(student!=null) {
Integer studentId=student.getStudentId(); // Integer studentId=student.getStudentId();
studentMapper.updateStudentQ(lastTime,loginNumber, studentId); // studentMapper.updateStudentQ(lastTime,loginNumber, studentId);
obj.put("student",student); // obj.put("student",student);
} // }
}else if(user.getAccountRole().equals(3)) { // }else if(user.getAccountRole().equals(3)) {
staff =staffMapper.queryStaffQ(user); // staff =staffMapper.queryStaffQ(user);
if(staff!=null) { // if(staff!=null) {
Integer staffId=staff.getStaffId(); // Integer staffId=staff.getStaffId();
staffMapper.updateStaffQ(lastTime,loginNumber, staffId); // staffMapper.updateStaffQ(lastTime,loginNumber, staffId);
obj.put("staff",staff); // obj.put("staff",staff);
} // }
} // }
user.setPassword(null); user.setPassword(null);
obj.put("user",user); obj.put("user",user);
userMapper.updateUserQ(lastTime,loginNumber, userId); userMapper.updateUserQ(lastTime,loginNumber, userId);

@ -0,0 +1,46 @@
package com.yipin.liuwanr.vo;
import com.yipin.liuwanr.entity.Staff;
import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.entity.UserM;
import java.util.List;
/**
* 用户信息实体
* @author Ning
*
*/
public class StuStaffVO {
//学生
private Student student;
//员工
private Staff staff;
private List<Student> studentList;
private List<Staff> staffList;
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public Staff getStaff() {
return staff;
}
public void setStaff(Staff staff) {
this.staff = staff;
}
public List<Student> getStudentList() {
return studentList;
}
public void setStudentList(List<Student> studentList) {
this.studentList = studentList;
}
public List<Staff> getStaffList() {
return staffList;
}
public void setStaffList(List<Staff> staffList) {
this.staffList = staffList;
}
}

@ -0,0 +1,118 @@
package com.yipin.liuwanr.vo;
import com.yipin.liuwanr.entity.*;
import java.util.List;
/**
* 用户信息实体
* @author Ning
*
*/
public class UserInfoVO {
//用户
private UserInfo userInfo;
//学生
private Student student;
//员工
private Staff staff;
//个人档案
private UserProfiles userProfiles;
//组织架构关系
private OrganizationRelationship organizationRelationship;
private List<OrganizationRelationship> organizationRelationshipList;
private List<UserInfo> userInfoList;
private List<Student> studentList;
private List<Staff> staffList;
private List<UserProfiles> userProfilesList;
private List<StuStaff> stuStaffList;
public OrganizationRelationship getOrganizationRelationship() {
return organizationRelationship;
}
public void setOrganizationRelationship(OrganizationRelationship organizationRelationship) {
this.organizationRelationship = organizationRelationship;
}
public List<OrganizationRelationship> getOrganizationRelationshipList() {
return organizationRelationshipList;
}
public void setOrganizationRelationshipList(List<OrganizationRelationship> organizationRelationshipList) {
this.organizationRelationshipList = organizationRelationshipList;
}
public List<StuStaff> getStuStaffList() {
return stuStaffList;
}
public void setStuStaffList(List<StuStaff> stuStaffList) {
this.stuStaffList = stuStaffList;
}
public UserProfiles getUserProfiles() {
return userProfiles;
}
public void setUserProfiles(UserProfiles userProfiles) {
this.userProfiles = userProfiles;
}
public List<UserProfiles> getUserProfilesList() {
return userProfilesList;
}
public void setUserProfilesList(List<UserProfiles> userProfilesList) {
this.userProfilesList = userProfilesList;
}
public UserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public Staff getStaff() {
return staff;
}
public void setStaff(Staff staff) {
this.staff = staff;
}
public List<UserInfo> getUserInfoList() {
return userInfoList;
}
public void setUserInfoList(List<UserInfo> userInfoList) {
this.userInfoList = userInfoList;
}
public List<Student> getStudentList() {
return studentList;
}
public void setStudentList(List<Student> studentList) {
this.studentList = studentList;
}
public List<Staff> getStaffList() {
return staffList;
}
public void setStaffList(List<Staff> staffList) {
this.staffList = staffList;
}
}

@ -65,7 +65,8 @@ public class ExperimentalClassServiceTest {
public void queryExperimentalClass() { public void queryExperimentalClass() {
Integer schoolId = 1; Integer schoolId = 1;
Integer courseId = 2; Integer courseId = 2;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClass(schoolId, courseId); Integer userId = 1;
HashMap<String, Object> map = experimentalClassService.queryExperimentalClass(schoolId, courseId,userId);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString())); map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
} }

Loading…
Cancel
Save