| | |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入farmPlant") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R update(@Valid @RequestBody FarmPlant farmPlant) { |
| | | boolean status = false; |
| | | //如果是结束 |
| | |
| | | //更新 |
| | | status = farmplantService.updateById(farmPlant); |
| | | //判断该地块是否还有种植的农产品 |
| | | FarmPlant farmPlant2 = farmplantService.getById(farmPlant.getId()); |
| | | FarmPlant farmPlant1 = new FarmPlant(); |
| | | farmPlant1.setLandId(farmPlant.getLandId()); |
| | | farmPlant1.setLandId(farmPlant2.getLandId()); |
| | | farmPlant1.setStatus("1"); |
| | | List<FarmPlant> list = farmplantService.list(new QueryWrapper<>(farmPlant1)); |
| | | if (list.size()<1){ |
| | | //更新该地块的耕种状态 |
| | | Land land = new Land(); |
| | | land.setType(1); |
| | | land.setId(Long.parseLong(farmPlant.getLandId())); |
| | | land.setId(Long.parseLong(farmPlant2.getLandId())); |
| | | landService.updateById(land); |
| | | } |
| | | }else { |
| | |
| | | return R.status(farmplantService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 农产品种养统计 |
| | | * @param farmPlantVO 农产品种植对象 |
| | | * @param query 分页查询对象 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmPlantStatistics") |
| | | public R<IPage<FarmPlantVO>> getFarmPlantStatistics(FarmPlantVO farmPlantVO, Query query) { |
| | | return R.data(farmplantService.getFarmPlantStatistics(Condition.getPage(query),farmPlantVO)); |
| | | } |
| | | |
| | | } |