diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceOperationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceOperationController.java index 74d892a..5caf933 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceOperationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/resource/TResourceOperationController.java @@ -192,7 +192,16 @@ public class TResourceOperationController extends BaseController if(dept.getOrgCode().length() < 12){ return error("非村、组级行政区划,不允许添加地块!"); } - + TResourceLand land = tResourceLandService.selectTResourceLandByDkbm(tResourceOperation.getDkbm()); + if(land != null){ + tResourceOperation.setDkmc(land.getDkmc()); + tResourceOperation.setDkdz(land.getDkdz()); + tResourceOperation.setDkxz(land.getDkxz()); + tResourceOperation.setDknz(land.getDknz()); + tResourceOperation.setDkbz(land.getDkbz()); + }else{ + return error("地块代码无法查询到地块!"); + } tResourceOperation.setImportCode(dept.getImportCode()); return toAjax(tResourceOperationService.insertTResourceOperation(tResourceOperation)); } @@ -205,7 +214,16 @@ public class TResourceOperationController extends BaseController @PostMapping("/update") public AjaxResult edit(@RequestBody TResourceOperation tResourceOperation) { - + TResourceLand land = tResourceLandService.selectTResourceLandByDkbm(tResourceOperation.getDkbm()); + if(land != null){ + tResourceOperation.setDkmc(land.getDkmc()); + tResourceOperation.setDkdz(land.getDkdz()); + tResourceOperation.setDkxz(land.getDkxz()); + tResourceOperation.setDknz(land.getDknz()); + tResourceOperation.setDkbz(land.getDkbz()); + }else{ + return error("地块代码无法查询到地块!"); + } return toAjax(tResourceOperationService.updateTResourceOperation(tResourceOperation)); }