| | |
| | | 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)); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 农场养殖记录表Mapper 接口 |
| | | * 农产品种植记录表Mapper 接口 |
| | | * @since 2022-05-12 |
| | | * @author zhongrj |
| | | */ |
| | |
| | | * @param farm |
| | | * @return |
| | | */ |
| | | List<FarmPlantVO> selectFarmPlantPage(@Param("page") IPage page, @Param("farmPlant") FarmPlantVO farm); |
| | | List<FarmPlantVO> selectFarmPlantPage(@Param("page") IPage page,@Param("farmPlant") FarmPlantVO farm); |
| | | |
| | | /** |
| | | * |
| | | * @param page |
| | | * @param farm |
| | | * @return |
| | | */ |
| | | List<FarmPlantVO> getFarmPlantStatistics(@Param("page") IPage<FarmPlantVO> page,@Param("farmPlant") FarmPlantVO farm); |
| | | } |
| | |
| | | <if test="farmPlant.varieties!=null and farmPlant.varieties!=''"> |
| | | and sfp.varieties like concat('%',#{farmPlant.varieties},'%') |
| | | </if> |
| | | <if test="farmPlant.startTime!=null and farmPlant.startTime!=''"> |
| | | and sfp.transplan_time >= #{farmPlant.startTime} |
| | | </if> |
| | | <if test="farmPlant.endTime!=null and farmPlant.endTime!=''"> |
| | | and sfp.transplan_time <= #{farmPlant.endTime} |
| | | </if> |
| | | order by sfp.id desc |
| | | </select> |
| | | |
| | | <!--自定义查询农场养殖记录分页数据--> |
| | | <select id="getFarmPlantStatistics" resultType="org.springblade.modules.farmplant.vo.FarmPlantVO"> |
| | | select sfp.strain_id,ss.strain_name strainName,sum(sl.land_area) areas,land_unit landUnit from sys_farm_plant sfp |
| | | left join sys_strain ss on ss.id = sfp.strain_id |
| | | left join sys_land sl on sl.id = sfp.land_id |
| | | where 1=1 |
| | | <if test="farmPlant.startTime!=null and farmPlant.startTime!=''"> |
| | | and sfp.transplan_time >= #{farmPlant.startTime} |
| | | </if> |
| | | <if test="farmPlant.endTime!=null and farmPlant.endTime!=''"> |
| | | and sfp.transplan_time <= #{farmPlant.endTime} |
| | | </if> |
| | | group by sfp.strain_id,strain_name,land_unit |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <!--自定义查询农产品库存分页数据--> |
| | | <select id="selectFarmProductStockPage" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO"> |
| | | select sfps.*,ss.url,ss.strain_name strainName from sys_farm_product_stock sfps |
| | | select sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from sys_farm_product_stock sfps |
| | | left join sys_strain ss on ss.id = sfps.strain_id |
| | | where 1=1 |
| | | <if test="farmProductStock.strainId!=null and farmProductStock.strainId!=''"> |
| | |
| | | <if test="farmProductStock.leaves!=null and farmProductStock.leaves!=''"> |
| | | and sfps.leaves = #{farmProductStock.leaves} |
| | | </if> |
| | | <if test="farmProductStock.startTime!=null and farmProductStock.startTime!=''"> |
| | | and sfps.time >= #{farmProductStock.startTime} |
| | | </if> |
| | | <if test="farmProductStock.endTime!=null and farmProductStock.endTime!=''"> |
| | | and sfps.time <= #{farmProductStock.endTime} |
| | | </if> |
| | | group by sfps.strain_id,ss.url,ss.strain_name |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | IPage<FarmPlantVO> selectFarmPlantPage(IPage<FarmPlantVO> page, FarmPlantVO farm); |
| | | |
| | | /** |
| | | * 农产品种养统计 |
| | | * @param farmPlantVO 农产品种植对象 |
| | | * @param page 分页查询对象 |
| | | * @return |
| | | */ |
| | | IPage<FarmPlantVO> getFarmPlantStatistics(IPage<FarmPlantVO> page,FarmPlantVO farmPlantVO); |
| | | } |
| | |
| | | import org.springblade.modules.farmplant.vo.FarmPlantVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | }); |
| | | return page.setRecords(farmPlantVOS); |
| | | } |
| | | |
| | | /** |
| | | * 农产品种养统计 |
| | | * @param farm 农产品种植对象 |
| | | * @param page 分页查询对象 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<FarmPlantVO> getFarmPlantStatistics(IPage<FarmPlantVO> page, FarmPlantVO farm) { |
| | | List<FarmPlantVO> farmPlantVOS = baseMapper.getFarmPlantStatistics(page, farm); |
| | | //遍历 |
| | | farmPlantVOS.forEach(farmPlantVO -> { |
| | | if (farmPlantVO.getLandUnit().equals("1")){ |
| | | BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.1); |
| | | farmPlantVO.setAreas(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | } |
| | | if (farmPlantVO.getLandUnit().equals("2")){ |
| | | BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.0015); |
| | | farmPlantVO.setAreas(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | } |
| | | }); |
| | | return page.setRecords(farmPlantVOS); |
| | | } |
| | | } |
| | |
| | | */ |
| | | private String landUnit; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private String startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | |
| | | /** |
| | | * 面积合计 |
| | | */ |
| | | private Double areas; |
| | | |
| | | } |
| | |
| | | */ |
| | | private String strainName; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private String startTime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private String endTime; |
| | | |
| | | } |