From e514449751029ed6b1c23ee6a83f2809fe34053c Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Fri, 25 Sep 2020 11:33:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExperimentalTeachingControllerApi.java | 9 ++++-- .../ExperimentalTeachingController.java | 29 +++++++++++++++---- .../service/ExperimentalTeachingService.java | 2 +- .../impl/ExperimentalTeachingServiceImpl.java | 5 ++-- .../resources/mapper/tms/ClassTeachingDao.xml | 2 +- .../mapper/tms/ExperimentalTeachingDao.xml | 28 +++++++++++------- 6 files changed, 52 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java index bd99e85..86297ea 100644 --- a/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java +++ b/src/main/java/com/msdw/tms/api/ExperimentalTeachingControllerApi.java @@ -14,7 +14,12 @@ public interface ExperimentalTeachingControllerApi { @ApiOperation(value = "实验教学列表",notes = "实验教学列表查询") R list(@ApiParam(name = "page", value = "页码", required = true) Integer page, @ApiParam(name = "size", value = "每页显示的数据条数", required = true) Integer size, - ExperimentalTeachingEntityVO request); + @ApiParam(name = "month", value = "月份", required = false) Integer month, + @ApiParam(name = "type", value = "类型", required = false) Integer type, + @ApiParam(name = "status", value = "状态", required = false) Integer status, + @ApiParam(name = "startTime", value = "开始时间", required = false) String startTime, + @ApiParam(name = "stopTime", value = "结束时间", required = false) String stopTime, + @ApiParam(name = "searchContent", value = "搜索内容", required = false) String searchContent); @ApiOperation(value = "添加实验教学",notes = "添加实验教学") R save(ExperimentalTeachingEntity experimentalTeachingEntity); @@ -23,5 +28,5 @@ public interface ExperimentalTeachingControllerApi { R update(ExperimentalTeachingEntity experimentalTeachingEntity); @ApiOperation(value = "删除用户个人档案",notes = "删除用户个人档案") - R delete(Long[] ids); + R delete(Integer[] ids); } diff --git a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java index ab0962c..04b3154 100644 --- a/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ExperimentalTeachingController.java @@ -41,8 +41,27 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr @GetMapping("/list") public R list(@RequestParam Integer page, @RequestParam Integer size, - ExperimentalTeachingEntityVO request){ - PageUtils list = experimentalTeachingService.queryExperimentalTeaching(page,size,request); + Integer month, Integer type, Integer status, String startTime, String stopTime, String searchContent){ + ExperimentalTeachingEntityVO vo = new ExperimentalTeachingEntityVO(); + if (month!=null){ + vo.setMonth(month); + } + if (type!=null){ + vo.setType(type); + } + if (status!=null){ + vo.setStatus(status); + } + if (startTime!=null&&startTime!=""){ + vo.setStartTime(startTime); + } + if (stopTime!=null&&startTime!=""){ + vo.setStopTime(stopTime); + } + if (searchContent!=null&&searchContent!=""){ + vo.setSearchContent(searchContent); + } + PageUtils list = experimentalTeachingService.queryExperimentalTeaching(page,size,vo); return R.ok().put("list",list); } /** @@ -57,7 +76,7 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 修改 */ - @PutMapping("/update") + @PostMapping("/update") public R update(@RequestBody ExperimentalTeachingEntity experimentalTeachingEntity){ experimentalTeachingService.updateById(experimentalTeachingEntity); @@ -67,8 +86,8 @@ public class ExperimentalTeachingController implements ExperimentalTeachingContr /** * 删除 */ - @DeleteMapping("/delete") - public R delete(@RequestBody Long[] ids){ + @PostMapping("/delete") + public R delete(@RequestBody Integer[] ids){ experimentalTeachingService.removeByIds(Arrays.asList(ids)); return R.ok(); diff --git a/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java b/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java index 6bff1aa..36295e7 100644 --- a/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java +++ b/src/main/java/com/msdw/tms/service/ExperimentalTeachingService.java @@ -13,7 +13,7 @@ import java.util.Map; public interface ExperimentalTeachingService extends IService { - PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO request); + PageUtils queryExperimentalTeaching(Integer page, Integer size, ExperimentalTeachingEntityVO vo); // PageUtils queryPage(Map params); diff --git a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java index b7b050d..7ec2f6b 100644 --- a/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ExperimentalTeachingServiceImpl.java @@ -37,11 +37,10 @@ public class ExperimentalTeachingServiceImpl extends ServiceImpl page1 = new Page<>(page, size); ExperimentalTeachingDao userDao = this.getBaseMapper(); -// PageUtils vo = userDao.queryExperimentalTeaching(page1,request); - IPage list = userDao.queryExperimentalTeaching(page1, request); + IPage list = userDao.queryExperimentalTeaching(page1, vo); PageUtils pageUtils = new PageUtils(list); return pageUtils; } diff --git a/src/main/resources/mapper/tms/ClassTeachingDao.xml b/src/main/resources/mapper/tms/ClassTeachingDao.xml index e0f2e1b..6b40139 100644 --- a/src/main/resources/mapper/tms/ClassTeachingDao.xml +++ b/src/main/resources/mapper/tms/ClassTeachingDao.xml @@ -24,7 +24,7 @@ and `status` = #{cla.status} and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') ) and stop_time between #{cla.endTime} and #{cla.startTime} - and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) <= date(stop_time) + and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) <= date(creation_time) diff --git a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml index 534e444..d696e84 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -24,23 +24,29 @@ tms_experimental_teaching WHERE is_del = 0 - - AND type=#{exp.type,jdbcType=INTEGER} + + AND `type`=#{exp.type,jdbcType=INTEGER} - - AND creation_time>DATE_SUB(CURDATE(), INTERVAL 1 MONTH) - - - AND creation_time>DATE_SUB(CURDATE(), INTERVAL 3 MONTH) - - - AND creation_time>DATE_SUB(CURDATE(), INTERVAL 6 MONTH) + + AND `status`=#{exp.status,jdbcType=INTEGER} + + + + + + + + + AND creation_time between #{exp.startTime} and #{exp.stopTime} - AND ( project_name like concat('%',#{exp.searchContent},'%') or experimental_class_name like concat('%',#{exp.searchContent},'%') ) + AND (project_name like concat('%',#{exp.searchContent},'%') or experimental_class_name like concat('%',#{exp.searchContent},'%') ) + + + AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) <= date(creation_time)