增加工程及水系的水库、河流、大坝基本信息的增删改查
parent
d69d806da8
commit
dadb7f9378
|
|
@ -0,0 +1,191 @@
|
||||||
|
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.StResDto;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StRvDto;
|
||||||
|
import com.gunshi.project.xyt.entity.vo.StResVo;
|
||||||
|
import com.gunshi.project.xyt.model.StDamB;
|
||||||
|
import com.gunshi.project.xyt.model.StResB;
|
||||||
|
import com.gunshi.project.xyt.model.StRvB;
|
||||||
|
import com.gunshi.project.xyt.service.EngineeringDrainageService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @ClassName EngineeringDrainageController
|
||||||
|
* @Author Huang Qianxiang
|
||||||
|
* @Date 2024/1/25 11:50
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "工程及水系接口", description = "水库、河流、大坝、闸阀、量水堰基础信息")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/EngineeringDrainage")
|
||||||
|
public class EngineeringDrainageController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EngineeringDrainageService engineeringDrainageService;
|
||||||
|
|
||||||
|
@Operation(summary = "新增水库基础信息")
|
||||||
|
@PostMapping("/insertStRes")
|
||||||
|
public R<String> insertRes(@RequestBody @Validated StResDto stResDto){
|
||||||
|
engineeringDrainageService.insertStRes(stResDto);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新水库的基础信息")
|
||||||
|
@PostMapping("/updateStRes")
|
||||||
|
public R<String> updateStRes(@RequestBody StResDto stResDto){
|
||||||
|
engineeringDrainageService.updateStRes(stResDto);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据水库ID删除水库基本信息")
|
||||||
|
@GetMapping("/deleteStRes")
|
||||||
|
public R<String> deleteStRes(@Parameter(description = "水库ID") @RequestParam("resId") String resId){
|
||||||
|
engineeringDrainageService.deleteStRes(resId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查询水库的基础信息")
|
||||||
|
@GetMapping("/queryStRes")
|
||||||
|
public R<List<StResVo>> queryStRes(){
|
||||||
|
return R.ok(engineeringDrainageService.queryStRes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据水库代码查询水库的基础信息")
|
||||||
|
@GetMapping("/queryByResCode")
|
||||||
|
public R<StResB> queryByResCode(@Parameter(description = "水库代码") @RequestParam("resCode") String resCode){
|
||||||
|
return R.ok(engineeringDrainageService.queryByResCode(resCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据水库ID查询水库的基础信息")
|
||||||
|
@GetMapping("/queryByResId")
|
||||||
|
public R<StResVo> queryByResId(@Parameter(description = "水库ID") @RequestParam("resId") String resId){
|
||||||
|
return R.ok(engineeringDrainageService.queryByResId(resId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据水库名称模糊查询水库的基础信息")
|
||||||
|
@GetMapping("/queryLikeResName")
|
||||||
|
public R<List<StResVo>> queryLikeResName(@Parameter(description = "水库名称") @RequestParam("resName") String resName){
|
||||||
|
return R.ok(engineeringDrainageService.queryLikeResName(resName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据水库规模查询水库的基础信息")
|
||||||
|
@GetMapping("/queryByEngScal")
|
||||||
|
public R<List<StResVo>> queryByEngScal(@Parameter(description = "水库规模") @RequestParam("engScal") String engScal){
|
||||||
|
return R.ok(engineeringDrainageService.queryByEngScal(engScal));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新增河流基础信息")
|
||||||
|
@PostMapping("/insertStRv")
|
||||||
|
public R<String> insertStRv(@RequestBody @Validated StRvDto stRvDto){
|
||||||
|
engineeringDrainageService.insertStRv(stRvDto);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新河流的基础信息")
|
||||||
|
@PostMapping("/updateStRv")
|
||||||
|
public R<String> updateStRv(@RequestBody StRvB stRvB){
|
||||||
|
engineeringDrainageService.updateStRv(stRvB);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据河流ID删除河流信息")
|
||||||
|
@GetMapping("/deleteStRv")
|
||||||
|
public R<String> deleteStRv(@Parameter(description = "河流ID") @RequestParam("rvId") String rvId){
|
||||||
|
engineeringDrainageService.deleteStRv(rvId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据河流代码查询河流的基础信息")
|
||||||
|
@GetMapping("/queryByRvCode")
|
||||||
|
public R<StRvB> queryByRvCode(@Parameter(description = "河流代码") @RequestParam("rvCode") String rvCode){
|
||||||
|
return R.ok(engineeringDrainageService.queryByRvCode(rvCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据河流ID查询河流的基础信息")
|
||||||
|
@GetMapping("/queryByRvId")
|
||||||
|
public R<StRvB> queryByRvId(@Parameter(description = "河流ID") @RequestParam("rvId") String rvId){
|
||||||
|
return R.ok(engineeringDrainageService.queryByRvId(rvId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "分页查询河流的基础信息")
|
||||||
|
@GetMapping("/pageStRv")
|
||||||
|
public R<Page<StRvB>> pageStRv(
|
||||||
|
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
|
||||||
|
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
|
||||||
|
return R.ok(engineeringDrainageService.pageStRv(pageNum,pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据河流名称模糊查询河流信息")
|
||||||
|
@GetMapping("/queryLikeRvName")
|
||||||
|
public R<Page<StRvB>> queryLikeRvName(
|
||||||
|
@Parameter(description = "河流名称") @RequestParam("rvName")String rvName,
|
||||||
|
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
|
||||||
|
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
|
||||||
|
return R.ok(engineeringDrainageService.queryLikeRvName(rvName, pageNum, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新增大坝基础信息")
|
||||||
|
@PostMapping("/insertStDam")
|
||||||
|
public R<String> insertStDam(@RequestBody @Validated StDamDto stDamDto){
|
||||||
|
engineeringDrainageService.insertStDam(stDamDto);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新大坝基础信息")
|
||||||
|
@PostMapping("/updateStDam")
|
||||||
|
public R<String> updateStDam(@RequestBody StDamB stDamB){
|
||||||
|
engineeringDrainageService.updateStDam(stDamB);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除大坝基础信息")
|
||||||
|
@GetMapping("/deleteStDam")
|
||||||
|
public R<String> deleteStDam(@Parameter(description = "大坝ID") @RequestParam("damId") String damId){
|
||||||
|
engineeringDrainageService.deleteStDam(damId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据大坝ID查询大坝信息")
|
||||||
|
@GetMapping("/queryByDamId")
|
||||||
|
public R<StDamB> queryByDamId(@Parameter(description = "大坝ID") @RequestParam("damId") String damId){
|
||||||
|
return R.ok(engineeringDrainageService.queryByDamId(damId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据大坝代码查询大坝信息")
|
||||||
|
@GetMapping("/queryByDamCode")
|
||||||
|
public R<StDamB> queryByDamCode(@Parameter(description = "大坝代码") @RequestParam("damCode") String damCode){
|
||||||
|
return R.ok(engineeringDrainageService.queryByDamCode(damCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "分页查询大坝基础信息")
|
||||||
|
@GetMapping("/pageStDam")
|
||||||
|
public R<Page<StDamB>> pageStDam(
|
||||||
|
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
|
||||||
|
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
|
||||||
|
return R.ok(engineeringDrainageService.pageStDam(pageNum,pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据大坝名称模糊查询大坝基础信息")
|
||||||
|
@GetMapping("/queryLikeDamName")
|
||||||
|
public R<Page<StDamB>> queryLikeDamName(
|
||||||
|
@Parameter(description = "大坝名称") @RequestParam("damName")String damName,
|
||||||
|
@Parameter(description = "当前页") @RequestParam("pageNum") Integer pageNum,
|
||||||
|
@Parameter(description = "每页显示的条数") @RequestParam("pageSize")Integer pageSize){
|
||||||
|
return R.ok(engineeringDrainageService.queryLikeDamName(damName,pageNum,pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.gunshi.project.xyt.entity.dto;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StDamB;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @ClassName StDamDto
|
||||||
|
* @Author Huang Qianxiang
|
||||||
|
* @Date 2024/1/25 11:08
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Schema(description="大坝基础信息DTO")
|
||||||
|
@Data
|
||||||
|
public class StDamDto extends StDamB {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大坝代码
|
||||||
|
*/
|
||||||
|
@Schema(description="大坝代码")
|
||||||
|
@NotNull(message = "大坝代码不能为空")
|
||||||
|
private String damCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大坝名称
|
||||||
|
*/
|
||||||
|
@Schema(description="大坝名称")
|
||||||
|
@NotNull(message = "大坝名称不能为空")
|
||||||
|
private String damName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.gunshi.project.xyt.entity.dto;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StResB;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @ClassName ResDto
|
||||||
|
* @Author Huang Qianxiang
|
||||||
|
* @Date 2024/1/24 14:43
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Schema(description="水库的基础信息DTO")
|
||||||
|
@Data
|
||||||
|
public class StResDto extends StResB {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水库名称
|
||||||
|
*/
|
||||||
|
@Schema(description="水库名称")
|
||||||
|
@NotNull(message = "水库名称不能为空")
|
||||||
|
private String resName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水库代码
|
||||||
|
*/
|
||||||
|
@Schema(description="水库代码")
|
||||||
|
@NotNull(message = "水库代码不能为空")
|
||||||
|
private String resCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行政区划编码
|
||||||
|
*/
|
||||||
|
@Schema(description="行政区划编码")
|
||||||
|
@NotNull(message = "行政区化编码不能为空")
|
||||||
|
private String addvcd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
@Schema(description="经度")
|
||||||
|
@NotNull(message = "经度不能为空")
|
||||||
|
private BigDecimal lgtd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
@Schema(description="纬度")
|
||||||
|
@NotNull(message = "维度不能为空")
|
||||||
|
private BigDecimal lttd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设计洪水位
|
||||||
|
*/
|
||||||
|
@Schema(description="设计洪水位")
|
||||||
|
@NotNull(message = "设计洪水位不能为空")
|
||||||
|
private BigDecimal dsfllv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校核洪水位
|
||||||
|
*/
|
||||||
|
@Schema(description="校核洪水位")
|
||||||
|
@NotNull(message = "校核洪水位不能为空")
|
||||||
|
private BigDecimal chfllv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正常蓄水位
|
||||||
|
*/
|
||||||
|
@Schema(description="正常蓄水位")
|
||||||
|
@NotNull(message = "正常蓄水位不能为空")
|
||||||
|
private BigDecimal normWatLev;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 死水位
|
||||||
|
*/
|
||||||
|
@Schema(description="死水位")
|
||||||
|
@NotNull(message = "死水位不能为空")
|
||||||
|
private BigDecimal deadLev;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总库容
|
||||||
|
*/
|
||||||
|
@Schema(description="总库容")
|
||||||
|
@NotNull(message = "总库容不能为空")
|
||||||
|
private BigDecimal totCap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汛限水位
|
||||||
|
*/
|
||||||
|
@Schema(description="汛限水位")
|
||||||
|
@NotNull(message = "汛限水位不能为空")
|
||||||
|
private BigDecimal flLowLimLev;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 集雨面积
|
||||||
|
*/
|
||||||
|
@Schema(description="集雨面积")
|
||||||
|
@NotNull(message = "集雨面积不能为空")
|
||||||
|
private BigDecimal watShedArea;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水库规模 dict_id
|
||||||
|
*/
|
||||||
|
@Schema(description="水库规模 dict_id")
|
||||||
|
@NotNull(message = "水库规模不能为空")
|
||||||
|
private Long engScal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测站编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "测站编码")
|
||||||
|
@NotNull(message = "测站编码不能为空")
|
||||||
|
private String STCD;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.gunshi.project.xyt.entity.dto;
|
||||||
|
|
||||||
|
import com.gunshi.project.xyt.model.StRvB;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @ClassName StRvDto
|
||||||
|
* @Author Huang Qianxiang
|
||||||
|
* @Date 2024/1/25 9:28
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Schema(description="河流的基础信息DTO")
|
||||||
|
@Data
|
||||||
|
public class StRvDto extends StRvB {
|
||||||
|
/**
|
||||||
|
* 河流代码
|
||||||
|
*/
|
||||||
|
@Schema(description="河流代码")
|
||||||
|
@NotNull(message = "河流代码不能为空")
|
||||||
|
private String rvCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 河流名称
|
||||||
|
*/
|
||||||
|
@Schema(description="河流名称")
|
||||||
|
@NotNull(message = "河流名称不能为空")
|
||||||
|
private String rvName;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.gunshi.project.xyt.entity.vo;
|
||||||
|
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import com.gunshi.project.xyt.model.StResB;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @ClassName StResPageSo
|
||||||
|
* @Author Huang Qianxiang
|
||||||
|
* @Date 2024/1/24 16:25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class StResVo extends StResB {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测站编码
|
||||||
|
*/
|
||||||
|
@Schema(description = "测站编码")
|
||||||
|
private String STCD;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,420 @@
|
||||||
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StDamDto;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StResDto;
|
||||||
|
import com.gunshi.project.xyt.entity.dto.StRvDto;
|
||||||
|
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.StResBAutoDao;
|
||||||
|
import com.gunshi.project.xyt.model.StResStcdRefAutoDao;
|
||||||
|
import com.gunshi.project.xyt.model.StRvBAutoDao;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*
|
||||||
|
* @ClassName EngineeringDrainageServiceImpl
|
||||||
|
* @Author Huang Qianxiang
|
||||||
|
* @Date 2024/1/24 14:38
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public class EngineeringDrainageService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StResBAutoDao stResBAutoDao;
|
||||||
|
@Resource
|
||||||
|
private StResStcdRefAutoDao stResStcdRefAutoDao;
|
||||||
|
@Resource
|
||||||
|
private StRvBAutoDao stRvBAutoDao;
|
||||||
|
@Resource
|
||||||
|
private StDamBAutoDao stDamBAutoDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增水库基础信息
|
||||||
|
* @param stResDto 水库的基础信息
|
||||||
|
*/
|
||||||
|
public void insertStRes(StResDto stResDto) {
|
||||||
|
StResB stResB = new StResB();
|
||||||
|
BeanUtil.copyProperties(stResDto,stResB);
|
||||||
|
Long resId = IdWorker.getId();
|
||||||
|
stResB.setResId(resId);
|
||||||
|
stResB.setStatus(1);
|
||||||
|
Date date = new Date();
|
||||||
|
stResB.setTm(date);
|
||||||
|
|
||||||
|
//判断水库代码是否唯一
|
||||||
|
if (queryByResCode(stResDto.getResCode()) != null){
|
||||||
|
throw new IllegalArgumentException("水库代码必须唯一");
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存水库基本信息
|
||||||
|
stResBAutoDao.save(stResB);
|
||||||
|
|
||||||
|
StResStcdRef stResStcdRef = new StResStcdRef();
|
||||||
|
stResStcdRef.setResId(resId);
|
||||||
|
stResStcdRef.setStcd(stResDto.getSTCD());
|
||||||
|
stResStcdRef.setTm(date);
|
||||||
|
|
||||||
|
//保存测站关系
|
||||||
|
stResStcdRefAutoDao.save(stResStcdRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新水库的基础信息
|
||||||
|
* @param stResDto 水库的基础信息
|
||||||
|
*/
|
||||||
|
public void updateStRes(StResDto stResDto) {
|
||||||
|
Long resId = stResDto.getResId();
|
||||||
|
StResB byId = stResBAutoDao.getById(resId);
|
||||||
|
if (byId == null) {
|
||||||
|
throw new IllegalArgumentException("resId:" + resId + "不存在");
|
||||||
|
}
|
||||||
|
//判断水库代码是否唯一
|
||||||
|
if (queryByResCode(stResDto.getResCode()) != null){
|
||||||
|
throw new IllegalArgumentException("水库代码必须唯一");
|
||||||
|
}
|
||||||
|
|
||||||
|
StResB stResB = new StResB();
|
||||||
|
BeanUtil.copyProperties(stResDto,stResB);
|
||||||
|
Date date = new Date();
|
||||||
|
stResB.setTm(date);
|
||||||
|
//更新水库基本信息
|
||||||
|
stResBAutoDao.updateById(stResB);
|
||||||
|
|
||||||
|
if (stResDto.getSTCD() != null){
|
||||||
|
StResStcdRef stResStcdRef = new StResStcdRef();
|
||||||
|
stResStcdRef.setResId(resId);
|
||||||
|
stResStcdRef.setStcd(stResDto.getSTCD());
|
||||||
|
stResStcdRef.setTm(date);
|
||||||
|
//更新水库测站关系
|
||||||
|
StResStcdRef byId1 = stResStcdRefAutoDao.getById(resId);
|
||||||
|
if (byId1 != null) {
|
||||||
|
//先删除之前存在的关系
|
||||||
|
stResStcdRefAutoDao.removeById(resId);
|
||||||
|
}
|
||||||
|
//更新当前水库测站关系
|
||||||
|
stResStcdRefAutoDao.save(stResStcdRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据水库ID删除水库基本信息
|
||||||
|
* @param resId 水库ID
|
||||||
|
*/
|
||||||
|
public void deleteStRes(String resId) {
|
||||||
|
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StResB.COL_RES_ID,resId)
|
||||||
|
.eq(StResB.COL_STATUS,1);
|
||||||
|
StResB byId = stResBAutoDao.getOne(queryWrapper);
|
||||||
|
if (byId == null) {
|
||||||
|
throw new IllegalArgumentException("resId:" + resId + "不存在");
|
||||||
|
}
|
||||||
|
UpdateWrapper<StResB> updateWrapper = new UpdateWrapper<>();
|
||||||
|
//水库状态更新为禁用
|
||||||
|
updateWrapper.eq(StResB.COL_RES_ID,resId)
|
||||||
|
.set(StResB.COL_STATUS,0);
|
||||||
|
stResBAutoDao.update(updateWrapper);
|
||||||
|
//删除水库测站关系
|
||||||
|
stResStcdRefAutoDao.removeById(resId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据水库代码查询水库的基础信息
|
||||||
|
* @param resCode 水库代码
|
||||||
|
* @return 水库的基础信息
|
||||||
|
*/
|
||||||
|
public StResB queryByResCode(String resCode) {
|
||||||
|
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StResB.COL_RES_CODE,resCode);
|
||||||
|
return stResBAutoDao.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据水库ID查询水库的基础信息
|
||||||
|
* @param resId 水库ID
|
||||||
|
* @return 水库的基础信息
|
||||||
|
*/
|
||||||
|
public StResVo queryByResId(String resId) {
|
||||||
|
StResB stResB = stResBAutoDao.getById(resId);
|
||||||
|
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(resId);
|
||||||
|
if (stResB == null) {
|
||||||
|
throw new IllegalArgumentException("resId:" + resId + "不存在");
|
||||||
|
}
|
||||||
|
StResVo stResVo = new StResVo();
|
||||||
|
BeanUtil.copyProperties(stResB,stResVo);
|
||||||
|
stResVo.setSTCD(stResStcdRef.getStcd());
|
||||||
|
return stResVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询水库的基础信息
|
||||||
|
* @return 水库的基础信息
|
||||||
|
*/
|
||||||
|
public List<StResVo> queryStRes() {
|
||||||
|
List<StResB> stResBList = stResBAutoDao
|
||||||
|
.list(new QueryWrapper<StResB>().eq(StResB.COL_STATUS,1));
|
||||||
|
List<StResVo> stResVoList = new ArrayList<>();
|
||||||
|
stResBList.stream().forEach(stResB -> {
|
||||||
|
StResVo stResVo = new StResVo();
|
||||||
|
BeanUtil.copyProperties(stResB,stResVo);
|
||||||
|
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(stResB.getResId());
|
||||||
|
stResVo.setSTCD(stResStcdRef.getStcd());
|
||||||
|
stResVoList.add(stResVo);
|
||||||
|
});
|
||||||
|
return stResVoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据水库名称模糊查询水库的基础信息
|
||||||
|
* @param resName 水库名称
|
||||||
|
* @return 水库基础信息
|
||||||
|
*/
|
||||||
|
public List<StResVo> queryLikeResName(String resName) {
|
||||||
|
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.like(StResB.COL_RES_NAME,resName)
|
||||||
|
.eq(StResB.COL_STATUS,1);
|
||||||
|
List<StResB> stResBList = stResBAutoDao.list(queryWrapper);
|
||||||
|
List<StResVo> stResVoList = new ArrayList<>();
|
||||||
|
stResBList.stream().forEach(stResB -> {
|
||||||
|
StResVo stResVo = new StResVo();
|
||||||
|
BeanUtil.copyProperties(stResB,stResVo);
|
||||||
|
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(stResB.getResId());
|
||||||
|
stResVo.setSTCD(stResStcdRef.getStcd());
|
||||||
|
stResVoList.add(stResVo);
|
||||||
|
});
|
||||||
|
return stResVoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据水库规模查询水库的基础信息
|
||||||
|
* @param engScal 水库规模
|
||||||
|
* @return 水库的基础信息
|
||||||
|
*/
|
||||||
|
public List<StResVo> queryByEngScal(String engScal) {
|
||||||
|
QueryWrapper<StResB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StResB.COL_ENG_SCAL,engScal)
|
||||||
|
.eq(StResB.COL_STATUS,1);
|
||||||
|
List<StResB> stResBList = stResBAutoDao.list(queryWrapper);
|
||||||
|
List<StResVo> stResVoList = new ArrayList<>();
|
||||||
|
stResBList.stream().forEach(stResB -> {
|
||||||
|
StResVo stResVo = new StResVo();
|
||||||
|
BeanUtil.copyProperties(stResB,stResVo);
|
||||||
|
StResStcdRef stResStcdRef = stResStcdRefAutoDao.getById(stResB.getResId());
|
||||||
|
stResVo.setSTCD(stResStcdRef.getStcd());
|
||||||
|
stResVoList.add(stResVo);
|
||||||
|
});
|
||||||
|
return stResVoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增河流基础信息
|
||||||
|
* @param stRvDto 河流的基础信息DTO
|
||||||
|
*/
|
||||||
|
public void insertStRv(StRvDto stRvDto) {
|
||||||
|
if (queryByResCode(stRvDto.getRvCode()) != null){
|
||||||
|
throw new IllegalArgumentException("河流代码必须唯一");
|
||||||
|
}
|
||||||
|
StRvB stRvB = new StRvB();
|
||||||
|
BeanUtil.copyProperties(stRvDto,stRvB);
|
||||||
|
Long rvId = IdWorker.getId();
|
||||||
|
stRvB.setRvId(rvId);
|
||||||
|
stRvB.setStatus(1);
|
||||||
|
stRvB.setTm(new Date());
|
||||||
|
stRvBAutoDao.save(stRvB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新河流的基础信息
|
||||||
|
* @param stRvB 河流的基础信息
|
||||||
|
*/
|
||||||
|
public void updateStRv(StRvB stRvB) {
|
||||||
|
Long rvId = stRvB.getRvId();
|
||||||
|
StRvB byId = stRvBAutoDao.getById(rvId);
|
||||||
|
if (byId == null){
|
||||||
|
throw new IllegalArgumentException("河流ID: " + rvId + "不存在");
|
||||||
|
}
|
||||||
|
stRvB.setTm(new Date());
|
||||||
|
stRvBAutoDao.updateById(stRvB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据河流ID删除河流信息
|
||||||
|
* @param rvId 河流ID
|
||||||
|
*/
|
||||||
|
public void deleteStRv(String rvId) {
|
||||||
|
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StRvB.COL_RV_ID,rvId)
|
||||||
|
.eq(StRvB.COL_STATUS,1);
|
||||||
|
StRvB byId = stRvBAutoDao.getOne(queryWrapper);
|
||||||
|
if (byId == null){
|
||||||
|
throw new IllegalArgumentException("河流ID: " + rvId + "不存在, 或河流ID: " + rvId + "已被禁用");
|
||||||
|
}
|
||||||
|
UpdateWrapper<StRvB> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq(StRvB.COL_RV_ID,rvId)
|
||||||
|
.set(StRvB.COL_STATUS,0);
|
||||||
|
stRvBAutoDao.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据河流代码查询河流的基础信息
|
||||||
|
* @param rvCode 河流代码
|
||||||
|
* @return 河流的基础信息
|
||||||
|
*/
|
||||||
|
public StRvB queryByRvCode(String rvCode) {
|
||||||
|
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StRvB.COL_RV_CODE,rvCode)
|
||||||
|
.eq(StRvB.COL_STATUS,1);
|
||||||
|
return stRvBAutoDao.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据河流ID查询河流的基础信息
|
||||||
|
* @param rvId 河流ID
|
||||||
|
* @return 河流的基础信息
|
||||||
|
*/
|
||||||
|
public StRvB queryByRvId(String rvId) {
|
||||||
|
StRvB stRvB = stRvBAutoDao.getById(rvId);
|
||||||
|
if (stRvB == null){
|
||||||
|
throw new IllegalArgumentException("河流ID: "+ rvId +"不存在");
|
||||||
|
}
|
||||||
|
return stRvB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询河流的基础信息
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页显示条数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Page<StRvB> pageStRv(int pageNum,int pageSize) {
|
||||||
|
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StRvB.COL_STATUS,1);
|
||||||
|
return stRvBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据河流名称模糊查询河流信息
|
||||||
|
* @param rvName 河流名称
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页显示条数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Page<StRvB> queryLikeRvName(String rvName,int pageNum,int pageSize) {
|
||||||
|
QueryWrapper<StRvB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.like(StRvB.COL_RV_NAME,rvName)
|
||||||
|
.eq(StRvB.COL_STATUS,1);
|
||||||
|
return stRvBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大坝基础信息
|
||||||
|
* @param stDamDto 大坝基础信息DTO
|
||||||
|
*/
|
||||||
|
public void insertStDam(StDamDto stDamDto) {
|
||||||
|
if (queryByDamCode(stDamDto.getDamCode()) != null){
|
||||||
|
throw new IllegalArgumentException("大坝代码必须唯一");
|
||||||
|
}
|
||||||
|
StDamB stDamB = new StDamB();
|
||||||
|
BeanUtil.copyProperties(stDamDto,stDamB);
|
||||||
|
Long damId = IdWorker.getId();
|
||||||
|
stDamB.setDamId(damId);
|
||||||
|
stDamB.setStatus(1);
|
||||||
|
stDamB.setTm(new Date());
|
||||||
|
stDamBAutoDao.save(stDamB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新大坝基础信息
|
||||||
|
* @param stDamB 大坝基础信息
|
||||||
|
*/
|
||||||
|
public void updateStDam(StDamB stDamB) {
|
||||||
|
Long damId = stDamB.getDamId();
|
||||||
|
StDamB byId = stDamBAutoDao.getById(damId);
|
||||||
|
if (byId == null){
|
||||||
|
throw new IllegalArgumentException("大坝ID: " + damId + "不存在");
|
||||||
|
}
|
||||||
|
stDamB.setTm(new Date());
|
||||||
|
stDamBAutoDao.updateById(stDamB);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除大坝基础信息
|
||||||
|
* @param damId 大坝ID
|
||||||
|
*/
|
||||||
|
public void deleteStDam(String damId) {
|
||||||
|
StDamB byId = stDamBAutoDao.getById(damId);
|
||||||
|
if (byId == null){
|
||||||
|
throw new IllegalArgumentException("大坝ID: " + damId + "不存在");
|
||||||
|
}
|
||||||
|
UpdateWrapper<StDamB> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq(StDamB.COL_DAM_ID,damId)
|
||||||
|
.set(StDamB.COL_STATUS,0);
|
||||||
|
stDamBAutoDao.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据大坝ID查询大坝信息
|
||||||
|
* @param damId 大坝ID
|
||||||
|
* @return 大坝基础信息
|
||||||
|
*/
|
||||||
|
public StDamB queryByDamId(String damId) {
|
||||||
|
StDamB stDamB = stDamBAutoDao.getById(damId);
|
||||||
|
if (stDamB == null){
|
||||||
|
throw new IllegalArgumentException("大坝ID: " + damId+ "不存在");
|
||||||
|
}
|
||||||
|
return stDamB;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据大坝代码查询大坝信息
|
||||||
|
* @param damCode 大坝代码
|
||||||
|
* @return 大坝基础信息
|
||||||
|
*/
|
||||||
|
public StDamB queryByDamCode(String damCode) {
|
||||||
|
QueryWrapper<StDamB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StDamB.COL_DAM_CODE,damCode)
|
||||||
|
.eq(StDamB.COL_STATUS,1);
|
||||||
|
return stDamBAutoDao.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询大坝基础信息
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页显示条数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Page<StDamB> pageStDam(int pageNum, int pageSize) {
|
||||||
|
QueryWrapper<StDamB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StDamB.COL_STATUS,1);
|
||||||
|
return stDamBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据大坝名称模糊查询大坝基础信息
|
||||||
|
* @param damName 大坝名称
|
||||||
|
* @param pageNum 当前页
|
||||||
|
* @param pageSize 每页显示条数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Page<StDamB> queryLikeDamName(String damName, int pageNum, int pageSize) {
|
||||||
|
QueryWrapper<StDamB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.like(StDamB.COL_DAM_NAME,damName)
|
||||||
|
.eq(StDamB.COL_STATUS,1);
|
||||||
|
return stDamBAutoDao.page(new Page<>(pageNum,pageSize),queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue