增加工程及水系的闸阀基本信息的增删改查
parent
f539744c50
commit
1f1d97ebbd
|
|
@ -2,20 +2,11 @@ package com.gunshi.project.xyt.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.dto.StDamDto;
|
||||
import com.gunshi.project.xyt.entity.dto.StEqptDto;
|
||||
import com.gunshi.project.xyt.entity.dto.StResDto;
|
||||
import com.gunshi.project.xyt.entity.dto.StRvDto;
|
||||
import com.gunshi.project.xyt.entity.dto.*;
|
||||
import com.gunshi.project.xyt.entity.vo.StResVo;
|
||||
import com.gunshi.project.xyt.model.StDamB;
|
||||
import com.gunshi.project.xyt.model.StEqptB;
|
||||
import com.gunshi.project.xyt.model.StResB;
|
||||
import com.gunshi.project.xyt.model.StRvB;
|
||||
import com.gunshi.project.xyt.model.*;
|
||||
import com.gunshi.project.xyt.service.EngineeringDrainageService;
|
||||
import com.gunshi.project.xyt.so.StDamPageSo;
|
||||
import com.gunshi.project.xyt.so.StEqptPageSo;
|
||||
import com.gunshi.project.xyt.so.StResPageSo;
|
||||
import com.gunshi.project.xyt.so.StRvPageSo;
|
||||
import com.gunshi.project.xyt.so.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
|
@ -124,6 +115,34 @@ public class EngineeringDrainageController {
|
|||
return R.ok(engineeringDrainageService.pageStDam(stDamPageSo));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增闸阀基础信息")
|
||||
@PostMapping("/insertStGate")
|
||||
public R<String> insertStGate(@RequestBody @Validated StGateDto stGateDto){
|
||||
engineeringDrainageService.insertStGate(stGateDto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "更新闸阀基础信息")
|
||||
@PostMapping("/updateStGate")
|
||||
public R<String> updateStGate(@RequestBody @Validated StGateB stGateB){
|
||||
engineeringDrainageService.updateStGate(stGateB);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "根据闸阀ID删除闸阀基础信息")
|
||||
@GetMapping("/deleteStGate")
|
||||
public R<String> deleteStGate(@Parameter(description = "闸阀ID") @RequestParam("gateId") String gateId){
|
||||
engineeringDrainageService.deleteStGate(gateId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询闸阀基础信息")
|
||||
@PostMapping("/updateStGate")
|
||||
public R<Page<StGateB>> pageStGate(@RequestBody @Validated StGatePageSo stGatePageSo){
|
||||
return R.ok(engineeringDrainageService.pageStGate(stGatePageSo));
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "新增量水堰基础信息")
|
||||
@PostMapping("/insertStEqpt")
|
||||
public R<String> insertStEqpt(@RequestBody @Validated StEqptDto stEqptDto){
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.project.xyt.entity.dto.*;
|
||||
import com.gunshi.project.xyt.entity.vo.StResVo;
|
||||
import com.gunshi.project.xyt.model.*;
|
||||
import com.gunshi.project.xyt.model.StDamBAutoDao;
|
||||
import com.gunshi.project.xyt.model.StEqptBAutoDao;
|
||||
|
|
@ -16,10 +15,7 @@ import com.gunshi.project.xyt.model.StGateBAutoDao;
|
|||
import com.gunshi.project.xyt.model.StResBAutoDao;
|
||||
import com.gunshi.project.xyt.model.StResStcdRefAutoDao;
|
||||
import com.gunshi.project.xyt.model.StRvBAutoDao;
|
||||
import com.gunshi.project.xyt.so.StDamPageSo;
|
||||
import com.gunshi.project.xyt.so.StEqptPageSo;
|
||||
import com.gunshi.project.xyt.so.StResPageSo;
|
||||
import com.gunshi.project.xyt.so.StRvPageSo;
|
||||
import com.gunshi.project.xyt.so.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -344,8 +340,15 @@ public class EngineeringDrainageService {
|
|||
* @param stGateDto 闸阀基础信息DTO
|
||||
*/
|
||||
public void insertStGate(StGateDto stGateDto){
|
||||
|
||||
|
||||
if (queryByGateCode(stGateDto.getGateCd()) != null){
|
||||
throw new IllegalArgumentException("闸阀编码必须唯一");
|
||||
}
|
||||
StGateB stGateB = new StGateB();
|
||||
BeanUtil.copyProperties(stGateDto,stGateB);
|
||||
long gateId = IdWorker.getId();
|
||||
stGateB.setGateId(gateId);
|
||||
stGateB.setTm(new Date());
|
||||
stGateBAutoDao.save(stGateB);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -353,7 +356,13 @@ public class EngineeringDrainageService {
|
|||
* @param stGateB 闸阀基础信息
|
||||
*/
|
||||
public void updateStGate(StGateB stGateB){
|
||||
|
||||
Long gateId = stGateB.getGateId();
|
||||
StGateB byId = stGateBAutoDao.getById(gateId);
|
||||
if (byId == null){
|
||||
throw new IllegalArgumentException("闸阀ID : " + gateId + "不存在");
|
||||
}
|
||||
stGateB.setTm(new Date());
|
||||
stGateBAutoDao.updateById(stGateB);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -374,6 +383,45 @@ public class EngineeringDrainageService {
|
|||
stGateBAutoDao.update(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据闸阀编码查询闸阀基础信息
|
||||
* @param gateCd 闸阀编码
|
||||
* @return 闸阀基础信息
|
||||
*/
|
||||
public StGateB queryByGateCode(String gateCd){
|
||||
QueryWrapper<StGateB> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StGateB.COL_GATE_CD,gateCd)
|
||||
.eq(StGateB.COL_STATUS,1);
|
||||
return stGateBAutoDao.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询闸阀基础信息
|
||||
* @param stGatePageSo 闸阀基本信息查询参数
|
||||
* @return
|
||||
*/
|
||||
public Page<StGateB> pageStGate(StGatePageSo stGatePageSo){
|
||||
if (StringUtils.isNotEmpty(stGatePageSo.getGateId())){
|
||||
StGateB stGateB = stGateBAutoDao.getById(stGatePageSo.getGateId());
|
||||
if (stGateB == null){
|
||||
return null;
|
||||
}
|
||||
List<StGateB> gateBList = List.of(stGateB);
|
||||
return new Page<StGateB>(1,1,1).setRecords(gateBList);
|
||||
}
|
||||
LambdaQueryWrapper<StGateB> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(stGatePageSo.getGateNm())){
|
||||
lambdaQueryWrapper.like(StringUtils.isNotEmpty(stGatePageSo.getGateNm()),StGateB::getGateNm,stGatePageSo.getGateNm());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(stGatePageSo.getGateCd())){
|
||||
lambdaQueryWrapper.like(StringUtils.isNotEmpty(stGatePageSo.getGateCd()),StGateB::getGateCd,stGatePageSo.getGateCd());
|
||||
}
|
||||
if (stGatePageSo.getStatus() != null){
|
||||
lambdaQueryWrapper.eq(StGateB::getStatus,stGatePageSo.getStatus());
|
||||
}
|
||||
return stGateBAutoDao.page(stGatePageSo.getPageSo().toPage(),lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增量水堰基础信息
|
||||
* @param stEqptDto 量水堰基础信息DTO
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
package com.gunshi.project.xyt.so;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.db.dto.PageSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @ClassName StGatePageSo
|
||||
* @Author Huang Qianxiang
|
||||
* @Date 2024/1/26 17:06
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "闸阀基本信息查询参数")
|
||||
public class StGatePageSo {
|
||||
|
||||
@NotNull(message = "分页参数不能为空")
|
||||
private PageSo pageSo;
|
||||
|
||||
@Schema(description="闸阀ID")
|
||||
private String gateId;
|
||||
|
||||
@Schema(description="闸阀编码")
|
||||
private String gateCd;
|
||||
|
||||
@Schema(description="闸阀名称")
|
||||
private String gateNm;
|
||||
|
||||
@Schema(description="状态 1:启用 0:禁用")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue