修复用户城市bug

master
zhiyong.ning 4 years ago
parent fdc8a892a9
commit 44c35d8a31
  1. 81
      src/main/java/com/yipin/liuwanr/controller/CourseController.java
  2. 5
      src/main/java/com/yipin/liuwanr/controller/CustomerController.java
  3. 48
      src/main/java/com/yipin/liuwanr/controller/StaffController.java
  4. 44
      src/main/java/com/yipin/liuwanr/controller/StudentController.java
  5. 126
      src/main/java/com/yipin/liuwanr/controller/UserController.java
  6. 14
      src/main/java/com/yipin/liuwanr/entity/Course.java
  7. 20
      src/main/java/com/yipin/liuwanr/entity/CoursePermissions.java
  8. 4
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  9. 14
      src/main/java/com/yipin/liuwanr/mapper/CourseMapper.java
  10. 6
      src/main/java/com/yipin/liuwanr/mapper/StudentMapper.java
  11. 36
      src/main/java/com/yipin/liuwanr/mapper/UserMapper.java
  12. 30
      src/main/java/com/yipin/liuwanr/service/CourseService.java
  13. 67
      src/main/java/com/yipin/liuwanr/service/UserService.java
  14. 61
      src/main/java/com/yipin/liuwanr/vo/UserVO.java

@ -41,33 +41,52 @@ public class CourseController {
Response resp = new Response();
Course course = vo.getCourse();
List<ServiceConfig> serviceConfigList = vo.getServiceConfigList();
if (course.getCourseName()==null||course.getCourseName().length()<=0) {
//课程名称
String courseName = course.getCourseName();
//课程类型
Integer courseType = course.getCourseType();
//学科类型id
Integer disciplineId = course.getDisciplineId();
//专业类id
Integer professionalClassId = course.getProfessionalClassId();
//专业id
Integer professionalId = course.getProfessionalId();
//市场价格
double marketPrice = course.getMarketPrice();
Double price =new Double(marketPrice);
//课程简介
String CourseIntroduction = course.getCourseIntroduction();
//教学目标
String TeachingGoal = course.getTeachingGoal();
//绑定系统id
String SystemId = course.getSystemId();
if (courseName==null||courseName=="") {
resp.setStatus(300);
resp.setErrmessage("Course Name Is Null!");
}else if(course.getCourseType()==null){
resp.setErrmessage("课程名称为空!");
}else if(courseType==null){
resp.setStatus(300);
resp.setErrmessage("Course Type Is Null!");
resp.setErrmessage("课程类型为空!");
}else if(course.getDisciplineId()==null){
resp.setStatus(300);
resp.setErrmessage("DisciplineId Type Is Null!");
}else if(course.getProfessionalClassId()==null){
resp.setErrmessage("学科类别为空!");
}else if(professionalClassId==null){
resp.setStatus(300);
resp.setErrmessage("ProfessionalId Class Is Null!");
}else if(course.getProfessionalId()==null){
resp.setErrmessage("专业类为空!");
}else if(professionalId==null){
resp.setStatus(300);
resp.setErrmessage("ProfessionalId Is Null!");
}else if(course.getMarketPrice()==null||course.getMarketPrice().length()<=0){
resp.setErrmessage("专业为空!");
}else if(price==null){
resp.setStatus(300);
resp.setErrmessage("Market Price Is Null!");
}else if(course.getCourseIntroduction()==null||course.getCourseIntroduction().length()<=0){
resp.setErrmessage("市场价格为空!");
}else if(CourseIntroduction==null||CourseIntroduction==""){
resp.setStatus(300);
resp.setErrmessage("Course Introduction Is Null!");
}else if(course.getTeachingGoal()==null||course.getTeachingGoal().length()<=0){
resp.setErrmessage("课程简介为空!");
}else if(TeachingGoal==null||TeachingGoal==""){
resp.setStatus(300);
resp.setErrmessage("Teaching Goal Is Null!");
}else if(course.getSystemId()==null||course.getSystemId()==""){
resp.setErrmessage("教学目标为空!");
}else if(SystemId==null||SystemId==""){
resp.setStatus(300);
resp.setErrmessage("SystemId Is Null!");
resp.setErrmessage("绑定系统id为空!");
}else {
HashMap<String, Object> ret = courseService.addCourse(course);
Integer courseId = (Integer) ret.get("retvalue");
@ -81,9 +100,35 @@ public class CourseController {
HashMap<String, Object> retPC = courseService.addCoursePC(serviceConfigList);
int statusPC = (int) retPC.get("retcode");
if (statusPC == 200) {
resp.setStatus(statusPC);
resp.setMessage(retPC.get("retvalue"));
}else{
resp.setStatus(statusPC);
resp.setErrmessage(retPC.get("retvalue").toString());
}
} else {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
/**
* 查询课程名称是否存在
*/
@GetMapping("/queryCourseNameIsExists")
Response queryCourseNameIsExists(@RequestParam String courseName) {
Response resp = new Response();
if (courseName==null||courseName=="") {
resp.setStatus(300);
resp.setErrmessage("课程名称为空!");
}else {
HashMap<String, Object> ret = courseService.queryCourseNameIsExists(courseName);
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());

@ -194,10 +194,6 @@ public class CustomerController {
resp.setErrmessage("学校不能为空!");
}else {
HashMap<String, Object> ret = customerService.queryCustomerIsExists(schoolId);
if (ret.isEmpty()) {
resp.setStatus(300);
resp.setErrmessage("该客户已存在!");
}else {
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
@ -207,7 +203,6 @@ public class CustomerController {
resp.setErrmessage(ret.get("retvalue").toString());
}
}
}
return resp;
}
/**

@ -3,7 +3,9 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
@ -58,36 +60,48 @@ public class StaffController {
/**
* 添加员工
*/
@Transactional
@PostMapping("/addStaff")
Response addCustomer(@RequestBody Staff staff) {
Response addCustomer(@RequestBody UserVO vo) {
Response resp = new Response();
UserM user = new UserM();
user.setPassword("huoran123");
user.setWorkNumber(staff.getStaffWorkNumber());
user.setUserAccount(staff.getStaffWorkNumber());
user.setAccountRole(3);
user.setName(staff.getStaffName());
user.setPhone(staff.getPhone());
user.setEmail(staff.getEmail());
user.setSchoolId(staff.getSchoolId());
Long startTs = System.currentTimeMillis(); // 当前时间戳
String uniqueIdentificationAccount = startTs+"";
user.setUniqueIdentificationAccount(uniqueIdentificationAccount);
staff.setUniqueIdentificationAccount(uniqueIdentificationAccount);
user.setUniqueIdentificationAccount(staff.getUniqueIdentificationAccount());
Staff staff = vo.getStaff();
UserM user = vo.getUser();
// user.setPassword("huoran123");
// user.setWorkNumber(staff.getStaffWorkNumber());
// user.setUserAccount(staff.getStaffWorkNumber());
// user.setAccountRole(3);
// user.setName(staff.getStaffName());
// user.setPhone(staff.getPhone());
// user.setEmail(staff.getEmail());
// user.setSchoolId(staff.getSchoolId());
// Long startTs = System.currentTimeMillis(); // 当前时间戳
// String uniqueIdentificationAccount = startTs+"";
// user.setUniqueIdentificationAccount(uniqueIdentificationAccount);
// staff.setUniqueIdentificationAccount(uniqueIdentificationAccount);
// user.setUniqueIdentificationAccount(staff.getUniqueIdentificationAccount());
if (staff.getPhone()==null) {
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
resp.setErrmessage("电话为空添加失败!");
} else {
HashMap<String, Object> ret = staffService.addStaff(staff);
HashMap<String, Object> ret1 = userService.addUser(user);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> ret1 = userService.addUser(user);
int status1 = (int) ret1.get("retcode");
if (status1 == 200){
resp.setStatus(status1);
resp.setMessage(ret1.get("retvalue"));
}else{
resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString());
throw new RuntimeException();
}
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
}
}
return resp;

@ -3,7 +3,9 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
@ -65,35 +67,47 @@ public class StudentController {
/**
* 添加学生
*/
@Transactional
@PostMapping("/addStudent")
Response addStudent(@RequestBody Student student) {
Response addStudent(@RequestBody UserVO vo) {
Response resp = new Response();
UserM user = new UserM();
user.setPassword("huoran123");
user.setPassword(student.getStudentPassword());
user.setUserAccount(student.getStudentNumber());
user.setAccountRole(4);
user.setName(student.getStudentName());
user.setPhone(student.getPhone());
user.setEmail(student.getEmail());
user.setWorkNumber(student.getStudentNumber());
Long startTs = System.currentTimeMillis(); // 当前时间戳
String uniqueIdentificationAccount = startTs+"";
user.setUniqueIdentificationAccount(uniqueIdentificationAccount);
student.setUniqueIdentificationAccount(uniqueIdentificationAccount);
Student student = vo.getStudent();
UserM user = vo.getUser();
// user.setPassword("huoran123");
// user.setPassword(student.getStudentPassword());
// user.setUserAccount(student.getStudentNumber());
// user.setAccountRole(4);
// user.setName(student.getStudentName());
// user.setPhone(student.getPhone());
// user.setEmail(student.getEmail());
// user.setWorkNumber(student.getStudentNumber());
// Long startTs = System.currentTimeMillis(); // 当前时间戳
// String uniqueIdentificationAccount = startTs+"";
// user.setUniqueIdentificationAccount(uniqueIdentificationAccount);
// student.setUniqueIdentificationAccount(uniqueIdentificationAccount);
if (student.getPhone()==null) {
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
} else {
HashMap<String, Object> ret = studentService.addStudent(student);
HashMap<String, Object> ret1 = userService.addUser(user);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
HashMap<String, Object> ret1 = userService.addUser(user);
int status1 = (int)ret.get("retcode");
if (status1 == 200){
resp.setStatus(status1);
resp.setMessage(ret1.get("retvalue"));
}else {
resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString());
throw new RuntimeException();
}
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
throw new RuntimeException();
}
}
return resp;

@ -1,27 +1,22 @@
package com.yipin.liuwanr.controller;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.entity.Response;
import com.yipin.liuwanr.entity.User;
import com.yipin.liuwanr.entity.UserM;
import com.yipin.liuwanr.helper.PushHelper;
import com.yipin.liuwanr.helper.RandomUtil;
import com.yipin.liuwanr.helper.RedisHelper;
import com.yipin.liuwanr.service.StaffService;
import com.yipin.liuwanr.service.StudentService;
import com.yipin.liuwanr.service.UserService;
import com.yipin.liuwanr.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
@RestController
@RequestMapping("/user")
@ -30,6 +25,12 @@ public class UserController {
@Autowired
private UserService userService;
@Autowired
private StudentService studentService;
@Autowired
private StaffService staffService;
@Autowired
RedisHelper redisHelper;
@ -96,12 +97,42 @@ public class UserController {
return resp;
}
/**
* 查询电话
*/
@GetMapping("/queryPhone")
Response queryPhone(@RequestParam String phone) {
Response resp = new Response();
if (phone==null||phone=="") {//前台传来的值是否为空
resp.setStatus(300);
resp.setErrmessage("手机号为空!查询失败!");
}else {
HashMap<String, Object> ret = userService.queryPhone(phone);
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;
}
/**
* 添加用户
*/
@Transactional
@PostMapping("/addUser")
Response addUser(@RequestBody UserM user) {
Response addUser(@RequestBody UserVO vo) {
Response resp = new Response();
//用户实体
UserM user = vo.getUser();
//学生实体
Student student = vo.getStudent();
//员工实体
Staff staff = vo.getStaff();
//用户手机号
String phone = user.getPhone();
//用户名称
@ -133,9 +164,30 @@ public class UserController {
resp.setStatus(300);
resp.setErrmessage("学校不能为空!");
}else {
HashMap<String, Object> ret1 = userService.queryPhone(phone);
int status1 = (int) ret1.get("retcode");
if (status1==200){
if (accountRole == 4){
HashMap<String, Object> stu = studentService.addStudent(student);
int status = (int) stu.get("retcode");
if (status == 200){
resp.setStatus(status);
resp.setMessage(stu.get("retvalue"));
}else {
resp.setStatus(status);
resp.setErrmessage(stu.get("retvalue").toString());
throw new RuntimeException();
}
}
if(accountRole == 3){
HashMap<String, Object> sta = staffService.addStaff(staff);
int status = (int) sta.get("retcode");
if (status == 200){
resp.setStatus(status);
resp.setMessage(sta.get("retvalue"));
}else {
resp.setStatus(status);
resp.setErrmessage(sta.get("retvalue").toString());
throw new RuntimeException();
}
}
HashMap<String, Object> ret = userService.addUser(user);
int status = (int) ret.get("retcode");
if (200 == status) {
@ -144,10 +196,7 @@ public class UserController {
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}else{
resp.setStatus(status1);
resp.setErrmessage(ret1.get("retvalue").toString());
throw new RuntimeException();
}
}
return resp;
@ -358,4 +407,31 @@ public class UserController {
}
return resp;
}
/**
* 用户模块查询客户
*/
@GetMapping("/queryCustomer")
Response queryCustomer(@RequestParam Integer cityId,Integer provinceId) {
Response resp = new Response();
if(provinceId == null){
resp.setStatus(300);
resp.setErrmessage("省份id为空!查询失败!");
}else if (cityId==null) {
resp.setStatus(300);
resp.setErrmessage("城市id为空!查询失败!");
}else {
HashMap<String, Object> ret = userService.queryCustomer(cityId,provinceId);
resp.setStatus(200);
resp.setErrmessage("查询成功!");
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;
}
}

@ -16,7 +16,7 @@ public class Course {
//预计课时
private Integer courseHours;
//市场价格
private String marketPrice;
private double marketPrice;
//课程简介
private String courseIntroduction;
//教学目标
@ -98,12 +98,6 @@ public class Course {
public void setCourseHours(Integer courseHours) {
this.courseHours = courseHours;
}
public String getMarketPrice() {
return marketPrice;
}
public void setMarketPrice(String marketPrice) {
this.marketPrice = marketPrice;
}
public String getCourseIntroduction() {
return courseIntroduction;
}
@ -122,4 +116,10 @@ public class Course {
public void setSearchContent(String searchContent) {
this.searchContent = searchContent;
}
public double getMarketPrice() {
return marketPrice;
}
public void setMarketPrice(double marketPrice) {
this.marketPrice = marketPrice;
}
}

@ -8,9 +8,9 @@ public class CoursePermissions {
//使用期限
private Integer usePeriod;
//市场价
private String marketPrice;
private double marketPrice;
//交易价格
private Integer transactionPrice;
private double transactionPrice;
//折扣率
private Integer discount;
//绑定端口地址id
@ -26,6 +26,12 @@ public class CoursePermissions {
//到期时间
private String expirationTime;
public double getTransactionPrice() {
return transactionPrice;
}
public void setTransactionPrice(double transactionPrice) {
this.transactionPrice = transactionPrice;
}
public String getExpirationTime() {
return expirationTime;
}
@ -50,18 +56,12 @@ public class CoursePermissions {
public void setUsePeriod(Integer usePeriod) {
this.usePeriod = usePeriod;
}
public String getMarketPrice() {
public double getMarketPrice() {
return marketPrice;
}
public void setMarketPrice(String marketPrice) {
public void setMarketPrice(double marketPrice) {
this.marketPrice = marketPrice;
}
public Integer getTransactionPrice() {
return transactionPrice;
}
public void setTransactionPrice(Integer transactionPrice) {
this.transactionPrice = transactionPrice;
}
public Integer getDiscount() {
return discount;
}

@ -93,7 +93,7 @@ public interface AssesmentMapper {
*
* @param assesment
*/
@Update("update assessment set assesmentName=#{assesmentName},releaseType=#{releaseType},creationTime=#{creationTime},endTime=#{endTime},timesum=#{timesum},assessmentSize=#{assessmentSize},assessmentNumber=#{assessmentNumber}"
@Update("update assessment set assesmentName=#{assesmentName},releaseType=#{releaseType},creationTime=#{creationTime},endTime=#{endTime},timesum=#{timesum},assessmentSize=#{assessmentSize},assessmentNumber=#{assessmentNumber},"
+ "experimentId=#{experimentId},assesmentState=#{assesmentState},classId=#{classId},experimentalClassId=#{experimentalClassId} where id=#{id}")
void updateAssesment(Assesment assesment);
@ -197,7 +197,7 @@ public interface AssesmentMapper {
* @param creationTime
* @return
*/
@Select("select experimentalClassId,experimentalClassName from experimental_class_ning where isdel=0 and creationTime like concat('%',#{creationTime},'%') and founder=(select staffName from staff where staffId=#{staffId}) and schoolId={schoolId} ")
@Select("select experimentalClassId,experimentalClassName from experimental_class_ning where isdel=0 and creationTime like concat('%',#{creationTime},'%') and founder=(select staffName from staff where staffId=#{staffId}) and schoolId=#{schoolId} ")
@Results({
@Result(id = true, column = "experimentalClassId", property = "experimentalClassId"),
@Result(column = "experimentalClassName", property = "experimentalClassName"),

@ -71,6 +71,11 @@ public interface CourseMapper {
})
List<CourseVO> queryCourseDetails(Integer courseId);
@Select({"<script>",
"SELECT courseId,courseName from course where isdel = 0 and courseName = #{courseName}",
"</script> "})
List<Course> queryCourseNameIsExists(String courseName);
@Select({"<script>",
"SELECT courseId,courseName,courseType,disciplineId,professionalClassId,professionalId,courseHours,marketPrice,courseIntroduction,teachingGoal,systemId,isShelves from course where isdel = 0 and courseId = #{courseId}",
"</script> "})
@ -86,6 +91,7 @@ public interface CourseMapper {
"</script> "})
Order queryOrderDetailsO(Integer orderId);
//删除课程
@Update({"<script>",
"UPDATE course SET isdel = 1 where courseId in "
+ "<foreach collection = 'list' item='c' open='(' separator=',' close=')'>"
@ -94,26 +100,32 @@ public interface CourseMapper {
"</script> "})
void deleteCourse(@Param("courseId")List<Integer> courseId);
//修改课程
@Update("UPDATE course SET courseName = #{courseName},courseType = #{courseType},disciplineId = #{disciplineId},professionalClassId = #{professionalClassId},professionalId = #{professionalId},"
+ "courseHours = #{courseHours},marketPrice = #{marketPrice},courseIntroduction = #{courseIntroduction},teachingGoal = #{teachingGoal},systemId = #{systemId} where courseId = #{courseId}")
void updateCourse(Course course);
//修改课程实训配置
@Update("UPDATE hr_course_tc SET systemId = #{systemId},projectId = #{projectId},isShow = #{isShow} where courseId = #{courseId} and systemId = #{systemId} and projectId = #{projectId}")
void updateCoursePC(ServiceConfig serviceConfig);
//删除课程实训配置
@Delete("Delete FROM hr_course_tc where courseId = #{courseId}")
void deleteCoursePC(Integer courseId);
//查询课程学科
@Select({"<script>",
"SELECT disciplineId,disciplineName,disciplineLevelId from discipline",
"</script> "})
List<Discipline> queryCourseDiscipline();
//查询课程专业类
@Select({"<script>",
"SELECT professionalClassId,professionalClassName,disciplineId from professional_class where disciplineId = #{disciplineId}",
"</script> "})
List<ProfessionalClass> queryCourseProfessionalClass(Integer disciplineId);
//查询课程专业
@Select({"<script>",
"SELECT professionalId,professionalName,professionalClassId from professional where professionalClassId = #{professionalClassId}",
"</script> "})
@ -174,7 +186,7 @@ public interface CourseMapper {
//查询配置
@Select({"<script>",
"SELECT sc.systemId,sc.systemName,pm.projectId,pm.projectName FROM service_config sc,hr_project_management pm WHERE pm.systemId = sc.systemId and FIND_IN_SET(sc.systemId,#{systemId})",
"SELECT sc.systemId,sc.systemName,pm.projectId,pm.projectName FROM service_config sc,hr_project_management pm WHERE pm.systemId = sc.systemId and FIND_IN_SET(sc.systemId,#{systemId}) and pm.projectPermissions = 0 and pm.isdel = 0",
"</script> "})
List<ServiceConfig> queryConfig(String systemId);

@ -13,10 +13,12 @@ import io.lettuce.core.dynamic.annotation.Param;
public interface StudentMapper {
//添加学生
@Insert("INSERT INTO student(studentName,studentNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId,isdel,uniqueIdentificationAccount)"
+ "VALUES(#{studentName},#{studentNumber},#{phone},#{email},#{roleId},#{schoolId},#{professionalId},#{gradeId},#{classId},0,#{uniqueIdentificationAccount})")
void addStudent(Student student);
//查询学生
@Select({ "<script>",
"SELECT cla.className,t.loginNumber,t.lastLoginTime,t.uniqueIdentificationAccount,t.studentId,t.studentName,t.studentNumber,t.phone,t.email,t.roleId,t.schoolId,t.professionalId,t.gradeId,t.classId,t.experimentalClassId,(SELECT GROUP_CONCAT(c.experimentalClassName) FROM experimental_class_ning c WHERE FIND_IN_SET(c.experimentalClassId,t.experimentalClassId)) AS experimentName FROM student t,class cla WHERE t.isdel =0 and t.classId = cla.classId",
" <if test='searchContent!=null'> and t.studentName like CONCAT('%',#{searchContent},'%') or t.studentNumber like CONCAT('%',#{searchContent},'%')</if>",
@ -28,17 +30,19 @@ public interface StudentMapper {
@Select("select s.studentId,studentName from experimental_class_student ecs left join student s on ecs.studentId=s.studentId where ecs.experimentalClassId=#{experimentalClassId} ")
List<Student> getByStudents(Integer experimentalClassId);
//删除学生
@Update({ "<script>", "UPDATE student SET isdel = 1 where studentId in "
+ "<foreach collection = 'list' item='c' open='(' separator=',' close=')'>" + " #{c}" + "</foreach>",
"</script> " })
void deleteStudent(@Param("studentId") List<Integer> studentId);
//查询学生详情
@Select({ "<script>",
"SELECT uniqueIdentificationAccount,studentName,studentNumber,phone,email,roleId,schoolId,professionalId,gradeId,classId from student where isdel = 0 and studentId = #{studentId}",
"</script> " })
List<Student> queryStudentDetails(Integer studentId);
//修改学生
@Update("UPDATE student SET studentName = #{studentName},studentWorkNumber = #{studentWorkNumber},phone = #{phone},email = #{email},roleId = #{roleId}"
+ ",schoolId = #{schoolId},professionalId = #{professionalId},gradeId = #{gradeId},classId = #{classId} where studentId = #{studentId}")
void updateStudent(Student student);

@ -1,21 +1,10 @@
package com.yipin.liuwanr.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.yipin.liuwanr.entity.*;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import com.yipin.liuwanr.entity.Config;
import com.yipin.liuwanr.entity.Demo;
import com.yipin.liuwanr.entity.User;
import com.yipin.liuwanr.entity.UserM;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface UserMapper {
@ -108,10 +97,20 @@ public interface UserMapper {
+ "#{settlement},#{open},#{high},#{low},#{volume},#{amount},#{ticktime},#{per},#{pb},#{mktcap},#{nmc},#{turnoverratio}) ")
void insertDemo(Demo demo);
@Insert("INSERT INTO user(name,password,sex,documentType,countries,educationDegree,IDNumber,accountRole,provinceId,subjectsTaught,cityId,phone,teachingProfessional,WeChatID,dateBirth,email,creationTime,isdel,schoolId,uniqueIdentificationAccount,disciplineId,professionalClassId,professionalId)"
+ " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId})")
@Insert("INSERT INTO user(name,password,sex,documentType,countries,educationDegree,IDNumber,accountRole,provinceId,subjectsTaught,cityId,phone,teachingProfessional,WeChatID,dateBirth,email,creationTime,isdel,schoolId,uniqueIdentificationAccount,disciplineId,professionalClassId,professionalId,userAccount,workNumber)"
+ " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId},#{userAccount},#{workNumber})")
void addUser(UserM user);
// //添加学生
// @Insert("INSERT INTO student(name,password,sex,documentType,countries,educationDegree,IDNumber,accountRole,provinceId,subjectsTaught,cityId,phone,teachingProfessional,WeChatID,dateBirth,email,creationTime,isdel,schoolId,uniqueIdentificationAccount,disciplineId,professionalClassId,professionalId)"
// + " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId})")
// void addStudent(Student student);
//
// //添加员工
// @Insert("INSERT INTO staff(name,password,sex,documentType,countries,educationDegree,IDNumber,accountRole,provinceId,subjectsTaught,cityId,phone,teachingProfessional,WeChatID,dateBirth,email,creationTime,isdel,schoolId,uniqueIdentificationAccount,disciplineId,professionalClassId,professionalId)"
// + " VALUES(#{name},#{password},#{sex},#{documentType},#{countries},#{educationDegree},#{IDNumber},#{accountRole},#{provinceId},#{subjectsTaught},#{cityId},#{phone},#{teachingProfessional},#{WeChatID},#{dateBirth},#{email},now(),0,#{schoolId},#{uniqueIdentificationAccount},#{disciplineId},#{professionalClassId},#{professionalId})")
// void addStaff(Staff staff);
// @Select("SELECT * from user where isdel = 1 and countries = #{countries} and provinces = #{provinces} and city = #{city}")
@Select({"<script>",
"SELECT u.*,s.schoolName,p.provinceName,c.cityName from user u,school s,province p,city c where u.isdel = 0 and p.provinceId = u.provinceId and p.provinceId = c.provinceId and u.cityId = c.cityId and u.schoolId = s.schoolId",
@ -155,6 +154,11 @@ public interface UserMapper {
"</script> "})
List<UserM> queryUserDetails(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

@ -114,7 +114,22 @@ public class CourseService {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "查询课程详情失败!");
return resp;
}
return resp;
}
//查询课程名称是否存在
public HashMap<String, Object> queryCourseNameIsExists(String courseName){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", courseMapper.queryCourseNameIsExists(courseName));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询课程名称失败!");
return resp;
}
return resp;
@ -145,12 +160,13 @@ public class CourseService {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "查询课程详情课程权限失败!");
return resp;
}
return resp;
}
//删除课程
public HashMap<String, Object> deleteCourse(List<Integer> courseId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -159,12 +175,12 @@ public class CourseService {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "删除课程失败!");
return resp;
}
return resp;
}
//更新课程
public HashMap<String, Object> updateCourse(Course course){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -173,12 +189,12 @@ public class CourseService {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "更新课程失败!");
return resp;
}
return resp;
}
//修改课程实训配置
public HashMap<String, Object> updateCoursePC(ServiceConfig serviceConfig){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -187,7 +203,7 @@ public class CourseService {
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "更新失败");
return resp;
}
return resp;

@ -9,6 +9,7 @@ import java.util.List;
import com.yipin.liuwanr.entity.*;
import com.yipin.liuwanr.mapper.StaffMapper;
import com.yipin.liuwanr.mapper.StudentMapper;
import com.yipin.liuwanr.entity.*;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -106,25 +107,22 @@ public class UserService {
return result;
}
//查询手机号
public HashMap<String, Object>queryPhone(String phone) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userMapper.queryPhone(phone));
if (resp.get("retvalue")==null) {
resp.put("retcode", 200);
}else {
resp.put("retcode", 300);
resp.put("retvalue", "新增失败,账号已存在!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "查询手机号失败!");
return resp;
}
return resp;
}
//添加用户
public HashMap<String, Object> addUser(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -142,6 +140,7 @@ public class UserService {
return resp;
}
//查询用户
public HashMap<String, Object> queryUser(UserM user,Integer pageNo,Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -172,6 +171,7 @@ public class UserService {
return resp;
}
//删除用户
public HashMap<String, Object> deleteUser(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -186,6 +186,7 @@ public class UserService {
return resp;
}
//更新用户
public HashMap<String, Object> updateUser(UserM user){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -200,36 +201,14 @@ public class UserService {
return resp;
}
// public HashMap<String, Object> logins(UserM user){
////
//// HashMap<String, Object> resp = new HashMap<String, Object>();
//// try {
//// resp.put("retvalue", userMapper.logins(user));
//// if (resp.get("retvalue")==null) {
//// resp.put("retcode", 300);
//// resp.put("retvalue", "登录失败,账号密码有误或不存在!");
//// }else {
//// 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> logins(UserM userM){
HashMap<String, Object> resp = new HashMap<String, Object>();
List<Object> obj=new ArrayList<>();
String param=userM.getPhone();
String password=userM.getPassword();
HashMap<String, Object> obj = new HashMap<String, Object>();
Student student;
Staff staff;
try {
UserM user=userMapper.loginsQ(param,password);
UserM user=userMapper.logins(userM);
if(user!=null) {
int loginNumber=user.getLogInNumber()+1;
Integer userId=user.getUserId();
@ -242,35 +221,35 @@ public class UserService {
if(student!=null) {
Integer studentId=student.getStudentId();
studentMapper.updateStudentQ(lastTime,loginNumber, studentId);
obj.add(student);
obj.put("student",student);
}
}else if(user.getAccountRole().equals(3)) {
staff =staffMapper.queryStaffQ(user);
if(staff!=null) {
Integer staffId=staff.getStaffId();
staffMapper.updateStaffQ(lastTime,loginNumber, staffId);
obj.add(staff);
obj.put("staff",staff);
}
}
user.setPassword(null);
obj.add(user);
obj.put("user",user);
userMapper.updateUserQ(lastTime,loginNumber, userId);
resp.put("retcode", 200);
resp.put("retvalue", obj);
}else {
resp.put("retcode", 300);
resp.put("retvalue", "Login failed");
resp.put("retvalue", "登录失败,账号密码有误或不存在!");
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "登录异常,请稍后再试!");
return resp;
}
return resp;
}
//查询用户详情
public HashMap<String, Object> queryUserDetails(Integer userId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -285,6 +264,20 @@ public class UserService {
return resp;
}
//查询客户
public HashMap<String, Object> queryCustomer(Integer cityId,Integer provinceId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", userMapper.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){

@ -0,0 +1,61 @@
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 UserVO {
//用户
private UserM user;
//学生
private Student student;
//员工
private Staff staff;
private List<UserM> userList;
private List<Student> studentList;
private List<Staff> staffList;
public UserM getUser() {
return user;
}
public void setUser(UserM user) {
this.user = user;
}
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<UserM> getUserList() {
return userList;
}
public void setUserList(List<UserM> userList) {
this.userList = userList;
}
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;
}
}
Loading…
Cancel
Save