diff --git a/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java b/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java index 6ad21abe..7ac6a55f 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java +++ b/shuili-system/src/main/java/com/kms/yxgh/sz/controller/SzPlanController.java @@ -2,25 +2,20 @@ package com.kms.yxgh.sz.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.kms.yxgh.base.Response; +import com.kms.yxgh.sz.domain.SzPlan; import com.kms.yxgh.sz.dto.SzPlanDetailDto; +import com.kms.yxgh.sz.dto.SzPlanSimpleDto; import com.kms.yxgh.sz.dto.SzPointDto; -import com.kms.yxgh.sz.domain.SzPlan; import com.kms.yxgh.sz.service.SzPlanService; import com.shuili.common.annotation.Log; import com.shuili.common.core.domain.SearchParam; import com.shuili.common.enums.BusinessType; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import java.util.List; import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** @@ -35,70 +30,70 @@ import org.springframework.web.bind.annotation.RestController; @Api(tags = "水闸巡视检查计划") public class SzPlanController { - private final SzPlanService szPlanService; + private final SzPlanService szPlanService; - /** - * 查询水闸巡视检查计划列表 - */ - @PostMapping("/list") - @ApiOperation("水闸巡视检查计划列表") - public IPage list(@RequestBody SearchParam sp) { - return szPlanService.selectPage(sp); - } + /** + * 查询水闸巡视检查计划列表 + */ + @PostMapping("/list") + @ApiOperation("水闸巡视检查计划列表") + public IPage list(@RequestBody SearchParam sp) { + return szPlanService.search(sp); + } - /** - * 获取水闸巡视检查计划详细信息 - */ - @ApiOperation(" 水闸巡视检查计划详情") - @GetMapping(value = "/{id}") - public Response getInfo(@PathVariable("id") String id) { - return Response.ok(szPlanService.getDetailById(id)); - } + /** + * 获取水闸巡视检查计划详细信息 + */ + @ApiOperation(" 水闸巡视检查计划详情") + @GetMapping(value = "/{id}") + public Response getInfo(@PathVariable("id") String id) { + return Response.ok(szPlanService.getDetailById(id)); + } - /** - * 新增水闸巡视检查计划 - */ - @Log(title = "水闸巡视检查计划新增", businessType = BusinessType.INSERT) - @PostMapping - @ApiOperation("水闸巡视检查计划新增") - public Response add(@RequestBody SzPlanDetailDto SzPlan) { - return Response.ok(szPlanService.add(SzPlan)); - } + /** + * 新增水闸巡视检查计划 + */ + @Log(title = "水闸巡视检查计划新增", businessType = BusinessType.INSERT) + @PostMapping + @ApiOperation("水闸巡视检查计划新增") + public Response add(@RequestBody SzPlanDetailDto SzPlan) { + return Response.ok(szPlanService.add(SzPlan)); + } - /** - * 修改水闸巡视检查计划 - */ - @ApiOperation("水闸巡视检查计划修改") - @Log(title = "水闸巡视检查计划修改", businessType = BusinessType.UPDATE) - @PutMapping - public Response edit(@RequestBody SzPlanDetailDto SzPlan) { - return Response.ok(szPlanService.update(SzPlan)); - } + /** + * 修改水闸巡视检查计划 + */ + @ApiOperation("水闸巡视检查计划修改") + @Log(title = "水闸巡视检查计划修改", businessType = BusinessType.UPDATE) + @PutMapping + public Response edit(@RequestBody SzPlanDetailDto SzPlan) { + return Response.ok(szPlanService.update(SzPlan)); + } - /** - * 删除水闸巡视检查计划 - */ - @ApiOperation("水闸巡视检查计划删除") - @Log(title = "水闸巡视检查计划删除", businessType = BusinessType.DELETE) - @DeleteMapping("/{id}") - public Response remove(@PathVariable String id) { - return Response.ok(szPlanService.deleteById(id)); - } + /** + * 删除水闸巡视检查计划 + */ + @ApiOperation("水闸巡视检查计划删除") + @Log(title = "水闸巡视检查计划删除", businessType = BusinessType.DELETE) + @DeleteMapping("/{id}") + public Response remove(@PathVariable String id) { + return Response.ok(szPlanService.deleteById(id)); + } - @ApiOperation("水闸巡视检查计划巡查点设置") - @Log(title = "水闸巡视检查计划巡查点设置", businessType = BusinessType.UPDATE) - @PostMapping("/points/{id}") - public Response addPoints(@PathVariable("id") String id, - @RequestBody List points) { - return Response.ok(szPlanService.addPoints(id, points)); - } + @ApiOperation("水闸巡视检查计划巡查点设置") + @Log(title = "水闸巡视检查计划巡查点设置", businessType = BusinessType.UPDATE) + @PostMapping("/points/{id}") + public Response addPoints(@PathVariable("id") String id, + @RequestBody List points) { + return Response.ok(szPlanService.addPoints(id, points)); + } - @ApiOperation("水闸巡视检查计划巡查点位数据") - @Log(title = "水闸巡视检查计划巡查点位数据", businessType = BusinessType.SEARCH) - @GetMapping("/points/{id}") - public Response> addPoints(@PathVariable("id") String id) { - return Response.ok(szPlanService.getPoints(id)); - } + @ApiOperation("水闸巡视检查计划巡查点位数据") + @Log(title = "水闸巡视检查计划巡查点位数据", businessType = BusinessType.SEARCH) + @GetMapping("/points/{id}") + public Response> addPoints(@PathVariable("id") String id) { + return Response.ok(szPlanService.getPoints(id)); + } } diff --git a/shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzPlanMapper.java b/shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzPlanMapper.java index a273c04c..eafa46c0 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzPlanMapper.java +++ b/shuili-system/src/main/java/com/kms/yxgh/sz/mapper/SzPlanMapper.java @@ -30,7 +30,9 @@ public interface SzPlanMapper extends BaseMapper { SELECT("p.id, p.name, p.xc_id as xcId, p.type, p.update_time as updateTime, p.create_time as createTime, (SELECT MAX(r.create_time) FROM bs_sgc_sz_xsjhjl r WHERE p.id = r.plan_id AND r.waga_code = #{wagaCode}) as lastTime"); FROM("bs_sgc_sz_xsjh p"); - WHERE("p.waga_code = #{wagaCode}"); + if (param.get("wagaCode") != null && StringUtils.isNotBlank(param.get("wagaCode").toString())) { + WHERE("p.waga_code = #{wagaCode}"); + } if(param.get("planName") != null && StringUtils.isNotBlank(param.get("planName").toString())) { WHERE("p.name LIKE CONCAT('%', #{planName}, '%')"); diff --git a/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java b/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java index f711d2e4..7b7200ea 100644 --- a/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java +++ b/shuili-system/src/main/java/com/kms/yxgh/sz/service/SzPlanService.java @@ -3,19 +3,23 @@ package com.kms.yxgh.sz.service; import cn.hutool.core.collection.CollectionUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.kms.yxgh.base.SzException; import com.kms.yxgh.sz.domain.SzPlan; import com.kms.yxgh.sz.domain.SzPlanOperator; import com.kms.yxgh.sz.domain.SzPoint; import com.kms.yxgh.sz.dto.SzPlanDetailDto; import com.kms.yxgh.sz.dto.SzPlanDetailDto.OperatorDto; +import com.kms.yxgh.sz.dto.SzPlanSimpleDto; import com.kms.yxgh.sz.dto.SzPointDto; import com.kms.yxgh.sz.mapper.SzPlanMapper; import com.kms.yxgh.sz.mapper.SzPlanOperatorMapper; import com.kms.yxgh.sz.mapper.SzPointMapper; import com.kms.yxgh.util.BeanCopyUtils; import com.kms.yxgh.util.StreamUtils; +import com.shuili.common.core.domain.SearchParam; import com.shuili.common.core.service.BaseService; import com.shuili.common.utils.StringUtils; import lombok.AllArgsConstructor; @@ -38,6 +42,19 @@ public class SzPlanService extends BaseService { private final SzPlanOperatorMapper SzPlanOperatorMapper; private final SzPointMapper SzPointMapper; + + public IPage search(SearchParam sp) { + Page page = new Page<>(sp.getPageNum(), sp.getPageSize()); + String wagaCode = null; + String name = null; + SzPlan szPlan = sp.getData(); + if (szPlan != null) { + wagaCode = szPlan.getWagaCode(); + name = szPlan.getName(); + } + return this.baseMapper.selectByWagaCode(page, wagaCode, name); + } + public SzPlanDetailDto getDetailById(String id) { SzPlan SzPlan = this.getById(id); SzPlanDetailDto dto = BeanCopyUtils.copy(SzPlan, SzPlanDetailDto.class);