diff --git a/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java b/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java index d749b50..50fd3f8 100644 --- a/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java +++ b/src/main/java/com/yipin/liuwanr/controller/MakeuplistController.java @@ -26,7 +26,6 @@ public class MakeuplistController { /** * 上传Excel文件,读取数据到数据库 - * @param file * @return */ @PostMapping("/importMakeuplist") @@ -70,7 +69,7 @@ public class MakeuplistController { * @return */ @GetMapping("/queryGetByClassName") - Response queryGetByClassName(@RequestParam Integer staffId,@RequestParam String uploadTime,Integer uploadType) { + Response queryGetByClassName(@RequestParam Integer staffId,@RequestParam String uploadTime,@RequestParam Integer uploadType,@RequestParam Integer schoolId) { Response resp = new Response(); if(StringUtils.isEmpty(staffId)) { resp.setStatus(300); @@ -81,8 +80,11 @@ public class MakeuplistController { }else if(StringUtils.isEmpty(uploadType)){ resp.setStatus(300); resp.setMessage("文件上传选项为空"); + }else if(StringUtils.isEmpty(schoolId)){ + resp.setStatus(300); + resp.setMessage("学校信息为空"); }else { - HashMap ret = makeuplistService.queryAllMakeuplist(staffId,uploadTime,uploadType); + HashMap ret = makeuplistService.queryAllMakeuplist(staffId,uploadTime,uploadType,schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); @@ -120,19 +122,22 @@ public class MakeuplistController { } @GetMapping("/getStudent") - Response getStudent(Integer staffId,String uploadTime,Integer uploadType){ + Response getStudent(@RequestParam Integer staffId,@RequestParam String uploadTime,@RequestParam Integer uploadType,@RequestParam Integer schoolId){ Response resp = new Response(); if(StringUtils.isEmpty(staffId)) { resp.setStatus(300); - resp.setMessage("staffId cannot be empty "); + resp.setMessage(" 教师信息为空 "); } else if(StringUtils.isEmpty(uploadTime)){ resp.setStatus(300); resp.setMessage("文件上传时间为空"); }else if(StringUtils.isEmpty(uploadType)){ resp.setStatus(300); resp.setMessage("文件上传选项为空"); + }else if(StringUtils.isEmpty(schoolId)){ + resp.setStatus(300); + resp.setMessage("学校为空"); }else { - HashMap ret = makeuplistService.getStudent(staffId,uploadTime,uploadType); + HashMap ret = makeuplistService.getStudent(staffId,uploadTime,uploadType,schoolId); int status = (int) ret.get("retcode"); if (200 == status) { resp.setStatus(status); diff --git a/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java b/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java index fd12520..28814b8 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/MakeuplistMapper.java @@ -17,16 +17,16 @@ import org.apache.ibatis.annotations.Select; */ public interface MakeuplistMapper { - @Select("select professionalName,gradeName,className,m.studentNumber,studentName from makeuplist m,student s,class c,grade g,professional p" + - "where m.studentId=s.studentId and m.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and m.staffId=#{staffId} and m.uploadTime=#{uploadTime}") - List queryClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); + @Select("select professionalName,gradeName,className,m.studentNumber,studentName from makeuplist m,student s,class c,grade g,professional p " + + "where m.studentId=s.studentId and m.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and m.staffId=#{staffId} and m.uploadTime=#{uploadTime} and m.schoolId=#{schoolId}") + List queryClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime,@Param("schoolId") Integer schoolId); - @Select("select professionalName,gradeName,experimentalClassName,m.studentNumber,studentName from makeuplist m,student s,class c,experimental_class_ning ecn,grade g,professional p" + - "where m.studentId=s.studentId and s.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and m.experimentalClassId=ecn.experimentalClassId and m.staffId=#{staffId} and m.uploadTime=#{uploadTime}") - List queryExperimentalClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); + @Select("select professionalName,gradeName,experimentalClassName,m.studentNumber,studentName from makeuplist m,student s,class c,experimental_class_ning ecn,grade g,professional p " + + "where m.studentId=s.studentId and s.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and m.experimentalClassId=ecn .experimentalClassId and m.staffId=#{staffId} and m.uploadTime=#{uploadTime} and m.schoolId=#{schoolId}") + List queryExperimentalClassMakeuplist(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime,@Param("schoolId") Integer schoolId); - @Select("select experimentalClassId,studentId,classId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime}") - List getstudent(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); + @Select("select experimentalClassId,studentId,classId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime} and schoolId=#{schoolId}") + List getstudent(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime,@Param("schoolId") Integer schoolId); @Select("select classId,studentId from makeuplist where staffId=#{staffId} and uploadTime=#{uploadTime}") List getClass(@Param("staffId")Integer staffId, @Param("uploadTime")String uploadTime); diff --git a/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java b/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java index bbf281f..00b00d3 100644 --- a/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java +++ b/src/main/java/com/yipin/liuwanr/service/MakeuplistService.java @@ -36,14 +36,14 @@ public class MakeuplistService { * @param staffId * @return */ - public HashMap queryAllMakeuplist(Integer staffId,String uploadTime,Integer uploadType) { + public HashMap queryAllMakeuplist(Integer staffId,String uploadTime,Integer uploadType,Integer schoolId) { HashMap resp = new HashMap(); try { if(uploadType.equals(0)){ - List makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime); + List makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime,schoolId); resp.put("retvalue", makeuplists); }else if(uploadType.equals(1)){ - List makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime); + List makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime,schoolId); resp.put("retvalue", makeuplists); } resp.put("retcode", 200); @@ -56,10 +56,10 @@ public class MakeuplistService { return resp; } - public HashMap getStudent(Integer staffId,String uploadTime,Integer uploadType){ + public HashMap getStudent(Integer staffId,String uploadTime,Integer uploadType,Integer schoolId){ HashMap resp = new HashMap(); try{ - resp.put("retvalue",makeuplistMapper.getstudent(staffId,uploadTime)); + resp.put("retvalue",makeuplistMapper.getstudent(staffId,uploadTime,schoolId)); resp.put("retcode", 200); }catch (RuntimeException e){ logger.error(e.getMessage()); @@ -72,14 +72,14 @@ public class MakeuplistService { - public HashMap getByMakeuplist(Integer staffId,String uploadTime,Integer uploadType){ + public HashMap getByMakeuplist(Integer staffId,String uploadTime,Integer uploadType,Integer schoolId){ HashMap resp = new HashMap(); try{ if(uploadType.equals(0)){ - List makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime); + List makeuplists=makeuplistMapper.queryExperimentalClassMakeuplist(staffId,uploadTime,schoolId); resp.put("retvalue", makeuplists); }else if(uploadType.equals(1)){ - List makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime); + List makeuplists=makeuplistMapper.queryClassMakeuplist(staffId,uploadTime,schoolId); resp.put("retvalue", makeuplists); } resp.put("retcode", 200);