| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分页统计 |
| | | */ |
| | | @GetMapping("/pageCount") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入farmPlant") |
| | | public R<List<FarmPlantVO>> pageCount(FarmPlantVO farmPlant, Query query) { |
| | | IPage<FarmPlantVO> pages = farmplantService.selectFarmPlantPage(Condition.getPage(query), farmPlant); |
| | | List<FarmPlantVO> res = pages.getRecords(); |
| | | List<FarmPlantVO> count = new ArrayList<>(); |
| | | //按种类合并种植物 |
| | | for (int i = 0; i < res.size(); i++) { |
| | | if (i == 0){ |
| | | count.add(res.get(0)); |
| | | }else { |
| | | boolean type = false; |
| | | for (int j = 0; j < count.size(); j++) { |
| | | if (res.get(i).getStrainId().equals(count.get(j).getStrainId())){ |
| | | FarmPlantVO data = new FarmPlantVO(); |
| | | data.setStrainId(res.get(i).getStrainId()); |
| | | data.setArea((Double.parseDouble(res.get(i).getArea()) + Double.parseDouble(count.get(j).getArea()))+""); |
| | | data.setStrainName(res.get(i).getStrainName()); |
| | | count.set(j,data); |
| | | type = false; |
| | | break; |
| | | }else{ |
| | | type = true; |
| | | } |
| | | } |
| | | if (type){ |
| | | count.add(res.get(i)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.data(count); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |