|  |  | 
 |  |  | import com.dy.pipIrrGlobal.pojoIr.IrCrop; | 
 |  |  | import com.dy.pipIrrGlobal.pojoIr.IrProject; | 
 |  |  | import com.dy.pipIrrGlobal.voIr.VoCrop; | 
 |  |  | import com.dy.pipIrrGlobal.voIr.VoProject; | 
 |  |  | import com.dy.pipIrrGlobal.voIr.VoCropOne; | 
 |  |  | import com.dy.pipIrrGlobal.voSe.VoActiveCard; | 
 |  |  | import com.dy.pipIrrIrrigate.crop.QueryVo; | 
 |  |  | import com.dy.pipIrrIrrigate.result.IrrigateResultCode; | 
 |  |  | import io.swagger.v3.oas.annotations.Operation; | 
 |  |  | import io.swagger.v3.oas.annotations.media.Content; | 
 |  |  | 
 |  |  |         try { | 
 |  |  |             Integer rec = Optional.ofNullable(cropSv.addCrop(po)).orElse(0); | 
 |  |  |             if (rec == 0) { | 
 |  |  |                 return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_PROJECT_FAIL.getMessage()); | 
 |  |  |                 return BaseResponseUtils.buildFail(IrrigateResultCode.ADD_CROP_FAIL.getMessage()); | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("添加作物异常", e); | 
 |  |  | 
 |  |  |     @SsoAop() | 
 |  |  |     public BaseResponse<Boolean> delete(@RequestBody Map map) { | 
 |  |  |         if (map == null || map.size() <= 0) { | 
 |  |  |             BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_PROJECT_ID.getMessage()); | 
 |  |  |             BaseResponseUtils.buildFail(IrrigateResultCode.PLEASE_INPUT_CROP_ID.getMessage()); | 
 |  |  |         } | 
 |  |  |         Long cropId = Long.parseLong(map.get("id").toString()); | 
 |  |  |         try { | 
 |  |  |             Integer rows = cropSv.deleteCrop(cropId); | 
 |  |  |             if (rows == 0) { | 
 |  |  |                 return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_PROJECT_FAIL.getMessage()); | 
 |  |  |                 return BaseResponseUtils.buildFail(IrrigateResultCode.DELETE_CROP_FAIL.getMessage()); | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("删除作物异常", e); | 
 |  |  | 
 |  |  |         try { | 
 |  |  |             Integer rec = Optional.ofNullable(cropSv.updateCrop(po)).orElse(0); | 
 |  |  |             if (rec == 0) { | 
 |  |  |                 return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_PROJECT_FAIL.getMessage()); | 
 |  |  |                 return BaseResponseUtils.buildFail(IrrigateResultCode.UPDATE_CROP_FAIL.getMessage()); | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             log.error("修改作物异常", e); | 
 |  |  | 
 |  |  |             return BaseResponseUtils.buildException(e.getMessage()); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取一个作物数据 | 
 |  |  |      * | 
 |  |  |      * @return 获取一个作物数据 | 
 |  |  |      */ | 
 |  |  |     @Operation(summary = "获取一个作物数据", description = "获取一个作物数据") | 
 |  |  |     @ApiResponses(value = { | 
 |  |  |             @ApiResponse( | 
 |  |  |                     responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, | 
 |  |  |                     description = "获取一个作物数据(BaseResponse.content:{})", | 
 |  |  |                     content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | 
 |  |  |                             schema = @Schema(implementation = IrProject.class))} | 
 |  |  |             ) | 
 |  |  |     }) | 
 |  |  |     @GetMapping(path = "one") | 
 |  |  |     @SsoAop() | 
 |  |  |     public BaseResponse<VoCropOne> one(@RequestParam Long id) { | 
 |  |  |         VoCropOne irCrop = this.cropSv.selectById(id); | 
 |  |  |  | 
 |  |  |         return BaseResponseUtils.buildSuccess(irCrop); | 
 |  |  |  | 
 |  |  |     } | 
 |  |  | } |