pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoPr/PrIntake.java
@@ -78,7 +78,7 @@ */ @JSONField(serializeUsing = ObjectWriterImplToString.class) @Schema(description = "所在片区ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "所在片区不能为空") // @NotNull(message = "所在片区不能为空") private Long blockId; /** pipIrr-platform/pipIrr-global/src/main/resources/mapper/PrDivideMapper.xml
@@ -300,7 +300,7 @@ <!--根据分水房编号获取所属片区编号--> <select id="getBlockIdById" resultType="java.lang.Long"> SELECT blockId FROM pr_divide WHERE id = ${divideId}} SELECT blockId FROM pr_divide WHERE id = ${divideId} </select> </mapper> pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/java/com/dy/pipIrrDemo/demo/DemoCtrl.java
@@ -116,8 +116,8 @@ @GetMapping("test1") public BaseResponse<BaUser> test1(){ BaUser po = new BaUser() ; po.id = System.currentTimeMillis() ; po.name = "张三" ; po.userId = System.currentTimeMillis() ; po.userName = "张三" ; po.phone = "13912345678" ; return BaseResponseUtils.buildSuccess(po); pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeCtrl.java
@@ -140,7 +140,7 @@ @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) @Transactional(rollbackFor = Exception.class) @SsoAop() public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult) { public BaseResponse<Boolean> add(@RequestBody @Valid PrIntake po, @Parameter(hidden = true) BindingResult bindingResult) { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); @@ -148,6 +148,7 @@ Date operateTime = new Date(); po.setOperateDt(operateTime); po.setDeleted((byte)0); Integer rec = Optional.ofNullable(intakeSv.addIntake(po)).orElse(0); if (rec == 0) { return BaseResponseUtils.buildFail(ProjectResultCode.ADD_INTAKE_FAIL.getMessage()); pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intake/IntakeSv.java
@@ -1,6 +1,7 @@ package com.dy.pipIrrProject.intake; import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoPr.PrDivideMapper; import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; import com.dy.pipIrrGlobal.pojoPr.PrIntake; import com.dy.pipIrrGlobal.voPr.VoIntake; @@ -12,6 +13,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; /** * @author wuzeyu @@ -25,6 +27,8 @@ public class IntakeSv { @Autowired private PrIntakeMapper prIntakeMapper; @Autowired private PrDivideMapper prDivideMapper; /** * 添加取水口 @@ -34,18 +38,25 @@ */ @Transactional Integer addIntake(PrIntake po) { if (po.getTownId()==null||po.getTownId()==0) { Long villageId = Optional.ofNullable(po.getVillageId()).orElse(0L); if (villageId != 0){ if (po.getTownId() == null || po.getTownId() == 0) { Long townId=getSupperByVillageId(po.getVillageId()); po.setTownId(townId); } if (po.getCountyId()==null||po.getCountyId()==0) { if (po.getCountyId() == null || po.getCountyId() == 0) { Long countyId=getSupperByVillageId(getSupperByVillageId(po.getVillageId())); po.setCountyId(countyId); } } if (po.getBlockId() == null || po.getBlockId() == 0) { Long blockId = prDivideMapper.getBlockIdById(po.getDivideId()); po.setBlockId(blockId); } return prIntakeMapper.insertSelective(po); } public Long getSupperByVillageId(long vaId){ return prIntakeMapper.getSupperByVillageId(vaId); } @@ -53,18 +64,17 @@ /** * 保存修改实体 * * @param po 实体 * @return 数量 */ public int update(PrIntake po){ if (po.getTownId()==null||po.getTownId()==0) { if (po.getTownId() == null || po.getTownId() == 0) { Long townId=getSupperByVillageId(po.getVillageId()); po.setTownId(townId); } if (po.getCountyId()==null||po.getCountyId()==0) { if (po.getCountyId() == null || po.getCountyId() == 0) { Long countyId=getSupperByVillageId(getSupperByVillageId(po.getVillageId())); po.setCountyId(countyId); } @@ -110,6 +120,7 @@ /** * 得到所有取水口 * * @return 所有取水口集合 */ public QueryResultVo<List<PrIntake>> selectAll() { @@ -120,6 +131,7 @@ /** * 得到一个取水口 * * @param id 取水口ID * @return 取水口实体 */ @@ -129,6 +141,7 @@ /** * 逻辑删除实体 * * @param id 实体ID * @return 数量 */ @@ -139,6 +152,7 @@ /** * 根据取水口编号获取未删除的取水口数量 * * @param intakeId * @return */ @@ -148,6 +162,7 @@ /** * 根据村Id获取全部地址 * * @param villageId 村Id * @return address 全部五级地址 */ @@ -157,6 +172,7 @@ /** * 根据区域Id获取区域等级 * * @param regionId 区域Id * @return Level 区域等级 */