From 72ddb4a59bd87dd1dfb9b76db9c9d7a886981896 Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Thu, 4 Mar 2021 11:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9E=E9=AA=8C=E6=95=99?= =?UTF-8?q?=E5=AD=A6=E5=88=97=E8=A1=A8=E6=97=B6=E9=97=B4=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=92=8C=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tms/controller/ClassTeachingController.java | 13 ++++++++++--- .../service/impl/ClassTeachingServiceImpl.java | 16 +++++++++++++++- .../mapper/tms/ExperimentalTeachingDao.xml | 2 +- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java index d6fe70b..9117b41 100644 --- a/src/main/java/com/msdw/tms/controller/ClassTeachingController.java +++ b/src/main/java/com/msdw/tms/controller/ClassTeachingController.java @@ -54,9 +54,16 @@ public class ClassTeachingController implements ClassTeachingApi { if (!StringUtils.isEmpty(condition)) { recordVo.setCondition(condition); } - if (!StringUtils.isEmpty(month)) { + // 设置固定时间(当自定义时间为空时) + if (!StringUtils.isEmpty(month) && StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) { recordVo.setMonth(month); - } else { + } + // 设置自定义时间 + if (!StringUtils.isEmpty(startTime) || !StringUtils.isEmpty(endTime)) { + recordVo.setStartTime(startTime); + recordVo.setEndTime(endTime); + } + /*else { recordVo.setMonth(null); if (!StringUtils.isEmpty(startTime)) { recordVo.setStartTime(startTime); @@ -64,7 +71,7 @@ public class ClassTeachingController implements ClassTeachingApi { if (!StringUtils.isEmpty(endTime)) { recordVo.setEndTime(endTime); } - } + }*/ recordVo.setSchoolId(schoolId); PageUtils page1 = classTeachingService.queryClassRecord(page, size, recordVo); return R.ok().put("page", page1); diff --git a/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java index fbf1d69..096dc12 100644 --- a/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java @@ -19,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.concurrent.locks.Lock; + @Service public class ClassTeachingServiceImpl extends ServiceImpl implements ClassTeachingService { @@ -55,7 +57,19 @@ public class ClassTeachingServiceImpl extends ServiceImpl schoolRecord = this.classMapper.getByClassRecord(page1, recordVo); // PageUtils pageUtils = new PageUtils(schoolRecord); ExperimentalTeachingVO vo = new ExperimentalTeachingVO(); - BeanUtils.copyProperties(recordVo,vo); + // 状态 + vo.setStatus(recordVo.getStatus()); + // 月份 + vo.setMonth(recordVo.getMonth()); + // 学校 + vo.setSchoolId(recordVo.getSchoolId()); + // 开始时间 + vo.setStartTime(recordVo.getStartTime()); + // 结束时间 + vo.setStopTime(recordVo.getEndTime()); + // 查询条件 + vo.setSearchContent(recordVo.getCondition()); + // BeanUtils.copyProperties(recordVo,vo); ExperimentalTeachingDao userDao = this.getBaseMapper(); IPage list = userDao.queryExperimentalTeaching(page1, vo); for (int i = 0; i < list.getRecords().size(); i++) { diff --git a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml index 05c0745..84d123d 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -39,7 +39,7 @@ 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 (experimental_name like concat('%',#{exp.searchContent},'%') or experimental_class_name like concat('%',#{exp.searchContent},'%') ) AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) <= date(creation_time)