Browse Source

农场任务事件搜索

zyh
小久哥 3 years ago
parent
commit
211afafeaf
  1. 9
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/EventController.java
  2. 45
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventSearchPageReqVO.java
  3. 2
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/event/EventMapper.java
  4. 8
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/event/EventService.java
  5. 12
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/event/EventServiceImpl.java
  6. 23
      zsw-farm/zsw-farm-impl/src/main/resources/mapper/event/EventMapper.xml

9
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/EventController.java

@ -9,8 +9,10 @@ import io.swagger.annotations.*;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.*; import javax.validation.*;
import javax.servlet.http.*; import javax.servlet.http.*;
import java.awt.*;
import java.util.*; import java.util.*;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -85,6 +87,13 @@ public class EventController {
return success(EventConvert.INSTANCE.convertPage(pageResult)); return success(EventConvert.INSTANCE.convertPage(pageResult));
} }
@GetMapping("/pageSearch")
@ApiOperation("搜索获得农场任务事件分页")
public CommonResult<PageResult<EventRespVO>> getEventPage(@Valid EventSearchPageReqVO pageVO) {
PageResult<EventDO> pageResult = eventService.getEventSearchPage(pageVO);
return success(EventConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ApiOperation("导出农场任务事件 Excel") @ApiOperation("导出农场任务事件 Excel")
@PreAuthorize("@ss.hasPermission('farm:event:export')") @PreAuthorize("@ss.hasPermission('farm:event:export')")

45
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/event/vo/EventSearchPageReqVO.java

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.farm.controller.admin.event.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 农场任务事件分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EventSearchPageReqVO extends PageParam {
@ApiModelProperty(value = "")
private String projectId;
@ApiModelProperty(value = "")
private String taskId;
@ApiModelProperty(value = "")
private String name;
@ApiModelProperty(value = "")
private String content;
@ApiModelProperty(value = "")
private String images;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始")
private LocalDateTime beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束")
private LocalDateTime endCreateTime;
}

2
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/dal/mysql/event/EventMapper.java

@ -39,4 +39,6 @@ public interface EventMapper extends BaseMapperX<EventDO> {
.orderByDesc(EventDO::getId)); .orderByDesc(EventDO::getId));
} }
List<EventDO> getEventSearchPage(EventSearchPageReqVO reqVO);
} }

8
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/event/EventService.java

@ -59,6 +59,14 @@ public interface EventService {
*/ */
PageResult<EventDO> getEventPage(EventPageReqVO pageReqVO); PageResult<EventDO> getEventPage(EventPageReqVO pageReqVO);
/**
* 搜索条件获得农场任务事件分页
*
* @param pageVO 分页查询
* @return 农场任务事件分页
*/
PageResult<EventDO> getEventSearchPage(EventSearchPageReqVO pageVO);
/** /**
* 获得农场任务事件列表, 用于 Excel 导出 * 获得农场任务事件列表, 用于 Excel 导出
* *

12
zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/event/EventServiceImpl.java

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.farm.service.event; package cn.iocoder.yudao.module.farm.service.event;
import cn.iocoder.yudao.module.farm.controller.admin.task.vo.TaskPageSearchReqVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.task.TaskDO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -74,6 +76,16 @@ public class EventServiceImpl implements EventService {
return eventMapper.selectPage(pageReqVO); return eventMapper.selectPage(pageReqVO);
} }
@Override
public PageResult<EventDO> getEventSearchPage(EventSearchPageReqVO pageVO){
pageVO.setPageNo(pageVO.getPageNo() - 1);
List<EventDO> list = eventMapper.getEventSearchPage(pageVO);
PageResult<EventDO> result = new PageResult<>();
result.setList(list);
result.setTotal(Long.valueOf(list.size()));
return result;
}
@Override @Override
public List<EventDO> getEventList(EventExportReqVO exportReqVO) { public List<EventDO> getEventList(EventExportReqVO exportReqVO) {
return eventMapper.selectList(exportReqVO); return eventMapper.selectList(exportReqVO);

23
zsw-farm/zsw-farm-impl/src/main/resources/mapper/event/EventMapper.xml

@ -9,4 +9,27 @@
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
--> -->
<select id = "getEventSearchPage" resultType="cn.iocoder.yudao.module.farm.dal.dataobject.event.EventDO">
SELECT * FROM farm_event e
WHERE 1 = 1
<if test="projectId != null">
AND e.project_id IN (
SELECT p.id FROM farm_project p WHERE p.name like concat('%', #{projectId}, '%')
)
</if>
<if test="taskId != null">
AND e.task_id IN (
SELECT t.id FROM farm_task t WHERE t.name like concat('%', #{taskId}, '%')
)
</if>
<if test="name != null">
AND e.name LIKE concat('%', #{name}, '%')
</if>
<if test="beginCreateTime != null">
AND e.create_time <![CDATA[ >= ]]> #{beginCreateTime}
AND e.create_time <![CDATA[ <= ]]> #{endCreateTime}
</if>
LIMIT #{pageNo},#{pageSize}
</select>
</mapper> </mapper>

Loading…
Cancel
Save