diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java index e8d3c10..37b08de 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java @@ -3,7 +3,9 @@ package com.hxhq.business.controller; import java.util.Arrays; import java.util.List; +import com.hxhq.business.dto.study.StudyListDto; import com.hxhq.business.enums.study.StudyStatusEnum; +import com.hxhq.business.form.study.StudySearchForm; import com.hxhq.common.security.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -32,11 +34,26 @@ public class StudyController extends BaseController */ @GetMapping("/list") @RequiresPermissions("business:study:list") - public TableDataInfo list(Study study) + public TableDataInfo list(StudySearchForm form) { startPage(); - List list = studyService.queryList(study); - return getDataTable(list); + List list = studyService.queryList(form); + TableDataInfo table = getDataTable(list); + table.setRows(initFormCount((List)table.getRows())); + return table; + } + + /** + * 设置表单数 + * @param list + * @return + */ + private List initFormCount(List list){ + for(StudyListDto l : list){ + l.setFormCount(0); + l.setFormFinishCount(0); + } + return list; } /** diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/study/StudyListDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/study/StudyListDto.java new file mode 100644 index 0000000..3406063 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/study/StudyListDto.java @@ -0,0 +1,45 @@ +package com.hxhq.business.dto.study; + +import com.hxhq.business.domain.Study; + +/** + * @author memory + */ +public class StudyListDto extends Study { + /** + * 试验表单数 + */ + private Integer formCount; + /** + * 试验完成表单数 + */ + private Integer formFinishCount; + /** + * 负责人姓名 + */ + private String leaderName; + + public Integer getFormCount() { + return formCount; + } + + public void setFormCount(Integer formCount) { + this.formCount = formCount; + } + + public Integer getFormFinishCount() { + return formFinishCount; + } + + public void setFormFinishCount(Integer formFinishCount) { + this.formFinishCount = formFinishCount; + } + + public String getLeaderName() { + return leaderName; + } + + public void setLeaderName(String leaderName) { + this.leaderName = leaderName; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java new file mode 100644 index 0000000..5aa9e89 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java @@ -0,0 +1,79 @@ +package com.hxhq.business.form.study; + +/** + * @author memory + */ +public class StudySearchForm { + /** + * 名称 + */ + private String name; + /** + * 编号 + */ + private String sn; + /** + * 开始日期 + */ + private String startDate; + /** + * 结束日期 + */ + private String endDate; + /** + * 状态 + */ + private Integer status; + /** + * 负责人 + */ + private String leaderName; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getLeaderName() { + return leaderName; + } + + public void setLeaderName(String leaderName) { + this.leaderName = leaderName; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java index bf4ade4..84b8dae 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java @@ -1,7 +1,13 @@ package com.hxhq.business.mapper; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.hxhq.business.domain.Study; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hxhq.business.dto.study.StudyListDto; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + /** * 试验Mapper接口 * @@ -10,5 +16,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface StudyMapper extends BaseMapper { - + /** + * 查询试验列表 + * @param queryWrapper + * @return + */ + List queryList(@Param("ew") Wrapper queryWrapper); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java index 4abad25..2f2f377 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java @@ -3,6 +3,8 @@ package com.hxhq.business.service; import java.util.List; import com.hxhq.business.domain.Study; import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.dto.study.StudyListDto; +import com.hxhq.business.form.study.StudySearchForm; /** * 试验Service接口 @@ -15,9 +17,9 @@ public interface IStudyService extends IService /** * 查询试验列表 * - * @param study 试验 + * @param form 试验 * @return 试验集合 */ - public List queryList(Study study); + public List queryList(StudySearchForm form); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java index 16dac8b..f2fbea4 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -3,6 +3,10 @@ package com.hxhq.business.service.impl; import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hxhq.business.dto.study.StudyListDto; +import com.hxhq.business.form.study.StudySearchForm; +import com.hxhq.common.core.utils.DateUtils; +import com.hxhq.common.core.utils.StringUtils; import org.springframework.stereotype.Service; import com.hxhq.business.mapper.StudyMapper; import com.hxhq.business.domain.Study; @@ -21,14 +25,33 @@ public class StudyServiceImpl extends ServiceImpl implements /** * 查询试验列表 * - * @param study 试验 + * @param form 试验 * @return 试验 */ @Override - public List queryList(Study study) + public List queryList(StudySearchForm form) { - QueryWrapper queryWrapper = Wrappers.query(); - return this.list(queryWrapper); + QueryWrapper queryWrapper = Wrappers.query(); + queryWrapper.eq("s.del_flag","0"); + if(StringUtils.isNoneBlank(form.getName())){ + queryWrapper.like("s.name",form.getName()); + } + if(StringUtils.isNoneBlank(form.getSn())){ + queryWrapper.like("s.sn",form.getSn()); + } + if(StringUtils.isNoneBlank(form.getLeaderName())){ + queryWrapper.like("u.nick_name",form.getLeaderName()); + } + if (StringUtils.isNoneBlank(form.getStartDate())) { + queryWrapper.ge("s.create_time", form.getStartDate()); + } + if (StringUtils.isNoneBlank(form.getEndDate())) { + queryWrapper.lt("s.create_time", DateUtils.dateTime(DateUtils.addDays(DateUtils.parseDate(form.getEndDate()),1))); + } + if(form.getStatus()!=null && form.getStatus().intValue()>0){ + queryWrapper.eq("s.status",form.getStatus()); + } + return baseMapper.queryList(queryWrapper); } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/TemplateServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/TemplateServiceImpl.java index b2fd3dc..646f9ff 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/TemplateServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/TemplateServiceImpl.java @@ -29,6 +29,7 @@ public class TemplateServiceImpl extends ServiceImpl i public List