From 92657839506601813ceca5eb1ef09f3556eae471 Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Sun, 26 Jul 2020 19:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AssesmentController.java | 20 +++++++++---------- .../ExperimentalClassController.java | 4 ++-- .../com/yipin/liuwanr/entity/Customer.java | 8 ++++++++ .../yipin/liuwanr/mapper/AssesmentMapper.java | 10 +++++----- .../yipin/liuwanr/mapper/CustomerMapper.java | 8 ++++---- .../mapper/ExperimentalClassMapper.java | 2 +- .../com/yipin/liuwanr/mapper/UserMapper.java | 2 +- .../liuwanr/service/AssesmentService.java | 10 +++++----- .../service/ExperimentalClassService.java | 14 +++++++++++-- 9 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java index e3fa018..9ba46c6 100644 --- a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java +++ b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java @@ -246,17 +246,17 @@ public class AssesmentController { /** * 查询实验班级一级栏目 - * @param staffId + * @param schoolId * @return */ @GetMapping("/getExperimentalClass") - Response getExperimentalClass(@RequestParam Integer staffId) { + Response getExperimentalClass(@RequestParam Integer schoolId) { Response resp = new Response(); - if(StringUtils.isEmpty(staffId)){ + if(StringUtils.isEmpty(schoolId)){ resp.setStatus(300); - resp.setErrmessage("教师信息为空"); + resp.setErrmessage("学校为空!"); }else{ - HashMap ret = service.queryCretionTime(staffId); + HashMap ret = service.queryCretionTime(schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -271,21 +271,21 @@ public class AssesmentController { /** - * 查询实验班级名称,以及班级一下的学生 + * 二级查询实验班级名称,以及班级一下的学生 * @param creationTime * @return */ @GetMapping("/getCreationTime") - Response getCreationTime(@RequestParam String creationTime,@RequestParam Integer staffId) { + Response getCreationTime(@RequestParam String creationTime,@RequestParam Integer schoolId) { Response resp = new Response(); - if(StringUtils.isEmpty(staffId)){ + if(StringUtils.isEmpty(schoolId)){ resp.setStatus(300); - resp.setErrmessage("教师信息为空"); + resp.setErrmessage("学校为空!"); }else if(StringUtils.isEmpty(creationTime)){ resp.setStatus(300); resp.setErrmessage("实验班级创建时间信息为空"); }else { - HashMap ret = service.queryCretionTime(creationTime,staffId); + HashMap ret = service.queryCretionTime(creationTime,schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); diff --git a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java index 0935df0..350133c 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java @@ -114,7 +114,7 @@ public class ExperimentalClassController { Response resp = new Response(); if (studentList.isEmpty()) { resp.setStatus(300); - resp.setErrmessage("Parameter Invalid"); + resp.setErrmessage("参数为空!"); }else { HashMap ret = classService.experimentClassAddStudent(studentList); int status = (int) ret.get("retcode"); @@ -298,7 +298,7 @@ public class ExperimentalClassController { Integer experimentalClassId = experimentalClass.getExperimentalClassId(); int size = studentList.size(); for (int i = 0; i < size; i++) { - studentList.get(i).setIntExperimentalClassId(experimentalClassId); + studentList.get(i).setExperimentalClassId(experimentalClassId+""); } int status = (int) ret.get("retcode"); if (200 == status) { diff --git a/src/main/java/com/yipin/liuwanr/entity/Customer.java b/src/main/java/com/yipin/liuwanr/entity/Customer.java index f301b3d..e6b2aac 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Customer.java +++ b/src/main/java/com/yipin/liuwanr/entity/Customer.java @@ -24,6 +24,8 @@ public class Customer { private Integer customerType; //到期时间 private String stopTime; + //创建时间 + private String creationTime; //邮件 private String email; //绑定学校ID @@ -49,6 +51,12 @@ public class Customer { //学校层次 private Integer level; + public String getCreationTime() { + return creationTime; + } + public void setCreationTime(String creationTime) { + this.creationTime = creationTime; + } public String getIndustryClassName() { return industryClassName; } diff --git a/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java b/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java index 02fc962..6dd057b 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java @@ -172,11 +172,11 @@ public interface AssesmentMapper { /** * 查询实验班级一级标题:创建时间 - * @param staffId + * @param schoolId * @return */ - @Select("select creationTime from experimental_class_ning WHERE isdel=0 and founder=(select staffName from staff where staffId=#{staffId}) GROUP BY creationTime ORDER BY creationTime desc") - List queryCreationTime(Integer staffId); + @Select("select creationTime from experimental_class_ning WHERE isdel=0 and schoolId = #{schoolId} GROUP BY creationTime ORDER BY creationTime desc") + List queryCreationTime(Integer schoolId); /** @@ -184,13 +184,13 @@ public interface AssesmentMapper { * @param creationTime * @return */ - @Select("select experimentalClassId,experimentalClassName from experimental_class_ning where isdel=0 and creationTime=#{creationTime} and founder=(select staffName from staff where staffId=#{staffId})") + @Select("select experimentalClassId,experimentalClassName from experimental_class_ning where isdel=0 and creationTime=#{creationTime} and schoolId = #{schoolId})") @Results({ @Result(id = true,column = "experimentalClassId",property = "experimentalClassId"), @Result(column ="experimentalClassName",property = "experimentalClassName" ), @Result(column ="experimentalClassId",property = "students",many = @Many(select = "com.yipin.liuwanr.mapper.StudentMapper.queryStudent") ) }) - List queryExperimentalClass(@Param("creationTime") String creationTime,@Param("staffId") Integer staffId); + List queryExperimentalClass(@Param("creationTime") String creationTime,@Param("schoolId") Integer schoolId); diff --git a/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java b/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java index 0228765..cea7246 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/CustomerMapper.java @@ -20,8 +20,8 @@ import com.yipin.liuwanr.vo.CustomerVO; public interface CustomerMapper { - @Insert("INSERT INTO customer(countries,industry,provinceId,adminName,adminPhone,cityId,customerType,stopTime,email,isdel,schoolId,industryClassId,industryId,customerName)" - + "VALUES(#{countries},#{industry},#{provinceId},#{adminName},#{adminPhone},#{cityId},#{customerType},#{stopTime},#{email},0,#{schoolId},#{industryClassId},#{industryId},#{customerName})") + @Insert("INSERT INTO customer(countries,industry,provinceId,adminName,adminPhone,cityId,customerType,stopTime,email,isdel,schoolId,industryClassId,industryId,customerName,creationTime)" + + "VALUES(#{countries},#{industry},#{provinceId},#{adminName},#{adminPhone},#{cityId},#{customerType},#{stopTime},#{email},0,#{schoolId},#{industryClassId},#{industryId},#{customerName},now())") void addCustomer(Customer customer); @Insert("INSERT INTO user(countries,provinceId,cityId,accountRole,creationTime,phone,password,email,isdel" @@ -34,8 +34,8 @@ public interface CustomerMapper { " and c.countries = #{countries} ", " and c.provinceId = #{provinceId} ", " and c.cityId = #{cityId} ", - " and c.customerName like CONCAT('%',#{searchContent},'%') or c.adminName like CONCAT('%',#{searchContent},'%') or c.adminPhone like CONCAT('%',#{searchContent},'%')", - "GROUP BY c.customerId", + " AND CONCAT(c.customerName, c.adminName, c.adminPhone) LIKE CONCAT('%',#{searchContent},'%')", + "GROUP BY c.customerId order by c.creationTime desc", " "}) List queryCustomer(Customer customer); diff --git a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java index e8ff3f6..c54cc2f 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java @@ -17,7 +17,7 @@ import com.yipin.liuwanr.entity.Student; public interface ExperimentalClassMapper { @Insert("INSERT INTO experimental_class_student(studentId,experimentalClassId)" - + "VALUES(#{studentId},#{intExperimentalClassId})") + + "VALUES(#{studentId},#{experimentalClassId})") void experimentClassAddStudent(Student student); @Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{experimentalClassId}") diff --git a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java index d9ec9cb..38bdb39 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/UserMapper.java @@ -120,7 +120,7 @@ public interface UserMapper { " and u.schoolId = #{schoolId} ", " and u.cityId = #{cityId} ", " and u.accountRole = #{accountRole} ", - " and u.name like CONCAT('%',#{searchContent},'%') ", + " AND CONCAT(u.name, s.schoolName) LIKE CONCAT('%',#{searchContent},'%')", " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 3 MONTH)", " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 6 MONTH)", " and u.creationTime>DATE_SUB(CURDATE(), INTERVAL 9 MONTH)", diff --git a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java index f8ba085..68c9cb3 100644 --- a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java +++ b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java @@ -300,13 +300,13 @@ public class AssesmentService { /** * 查询实验班级一级栏目 * - * @param staffId:教师id + * @param schoolId:学校id * @return */ - public HashMap queryCretionTime(Integer staffId) { + public HashMap queryCretionTime(Integer schoolId) { HashMap resp = new HashMap(); try { - resp.put("retvalue", mapper.queryCreationTime(staffId)); + resp.put("retvalue", mapper.queryCreationTime(schoolId)); resp.put("retcode", 200); } catch (Exception e) { logger.error(e.getMessage()); @@ -324,10 +324,10 @@ public class AssesmentService { * @param cretionTime * @return */ - public HashMap queryCretionTime(String cretionTime, Integer staffId) { + public HashMap queryCretionTime(String cretionTime, Integer schoolId) { HashMap resp = new HashMap(); try { - resp.put("retvalue", mapper.queryExperimentalClass(cretionTime, staffId)); + resp.put("retvalue", mapper.queryExperimentalClass(cretionTime, schoolId)); resp.put("retcode", 200); } catch (Exception e) { logger.error(e.getMessage()); diff --git a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java index d01501b..d6d7b05 100644 --- a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java +++ b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java @@ -35,8 +35,18 @@ public class ExperimentalClassService { try { for (int i = 0; i < size; i++) { Student student = studentList.get(i); - experimentalClassMapper.experimentClassAddStudent(student); - resp.put("retcode", 200); + Integer studentId = student.getStudentId(); + String experimentalClassId = student.getExperimentalClassId(); + if (studentId == null){ + resp.put("retcode", 300); + resp.put("retvalue", "学生为空!"); + }else if (experimentalClassId==null||experimentalClassId==""){ + resp.put("retcode", 300); + resp.put("retvalue", "实验班级为空!"); + }else{ + experimentalClassMapper.experimentClassAddStudent(student); + resp.put("retcode", 200); + } } } catch (RuntimeException e) { logger.error(e.getMessage());