修复实验教学列表时间筛选和搜索

hehai
river 4 years ago
parent 0710ea54a6
commit 72ddb4a59b
  1. 13
      src/main/java/com/msdw/tms/controller/ClassTeachingController.java
  2. 16
      src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java
  3. 2
      src/main/resources/mapper/tms/ExperimentalTeachingDao.xml

@ -54,9 +54,16 @@ public class ClassTeachingController implements ClassTeachingApi {
if (!StringUtils.isEmpty(condition)) { if (!StringUtils.isEmpty(condition)) {
recordVo.setCondition(condition); recordVo.setCondition(condition);
} }
if (!StringUtils.isEmpty(month)) { // 设置固定时间(当自定义时间为空时)
if (!StringUtils.isEmpty(month) && StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime)) {
recordVo.setMonth(month); recordVo.setMonth(month);
} else { }
// 设置自定义时间
if (!StringUtils.isEmpty(startTime) || !StringUtils.isEmpty(endTime)) {
recordVo.setStartTime(startTime);
recordVo.setEndTime(endTime);
}
/*else {
recordVo.setMonth(null); recordVo.setMonth(null);
if (!StringUtils.isEmpty(startTime)) { if (!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime); recordVo.setStartTime(startTime);
@ -64,7 +71,7 @@ public class ClassTeachingController implements ClassTeachingApi {
if (!StringUtils.isEmpty(endTime)) { if (!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime); recordVo.setEndTime(endTime);
} }
} }*/
recordVo.setSchoolId(schoolId); recordVo.setSchoolId(schoolId);
PageUtils page1 = classTeachingService.queryClassRecord(page, size, recordVo); PageUtils page1 = classTeachingService.queryClassRecord(page, size, recordVo);
return R.ok().put("page", page1); return R.ok().put("page", page1);

@ -19,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.concurrent.locks.Lock;
@Service @Service
public class ClassTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ClassTeachingService { public class ClassTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDao, ExperimentalTeachingEntity> implements ClassTeachingService {
@ -55,7 +57,19 @@ public class ClassTeachingServiceImpl extends ServiceImpl<ExperimentalTeachingDa
// IPage<ProjectRecordVo> schoolRecord = this.classMapper.getByClassRecord(page1, recordVo); // IPage<ProjectRecordVo> schoolRecord = this.classMapper.getByClassRecord(page1, recordVo);
// PageUtils pageUtils = new PageUtils(schoolRecord); // PageUtils pageUtils = new PageUtils(schoolRecord);
ExperimentalTeachingVO vo = new ExperimentalTeachingVO(); 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(); ExperimentalTeachingDao userDao = this.getBaseMapper();
IPage<ExperimentalTeachingEntity> list = userDao.queryExperimentalTeaching(page1, vo); IPage<ExperimentalTeachingEntity> list = userDao.queryExperimentalTeaching(page1, vo);
for (int i = 0; i < list.getRecords().size(); i++) { for (int i = 0; i < list.getRecords().size(); i++) {

@ -39,7 +39,7 @@
AND creation_time between #{exp.startTime} and #{exp.stopTime} AND creation_time between #{exp.startTime} and #{exp.stopTime}
</if> </if>
<if test="exp.searchContent!=null"> <if test="exp.searchContent!=null">
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},'%') )
</if> </if>
<if test="exp.month!=null"> <if test="exp.month!=null">
AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) &lt;= date(creation_time) AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) &lt;= date(creation_time)

Loading…
Cancel
Save