| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmingCount") |
| | | public R getFarmingCount(String deptId) { |
| | | return R.data(farmService.getFarmingCount(deptId)); |
| | | public R getFarmingCount(String farmId) { |
| | | return R.data(farmService.getFarmingCount(farmId)); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmingStatis") |
| | | public R getFarmingStatis(String deptId) { |
| | | return R.data(farmService.getFarmingStatis(deptId)); |
| | | public R getFarmingStatis(String farmId) { |
| | | return R.data(farmService.getFarmingStatis(farmId)); |
| | | } |
| | | |
| | | |
| | |
| | | * 查询统计本年农事记录操作总数 |
| | | * @return |
| | | */ |
| | | Integer getFarmingCount(String deptId); |
| | | Integer getFarmingCount(String farmId); |
| | | |
| | | /** |
| | | * 查询统计本年农事记录操作,按分类统计 |
| | | * @return |
| | | */ |
| | | List<FarmingStatisVO> getFarmingStatis(String deptId); |
| | | List<FarmingStatisVO> getFarmingStatis(String farmId); |
| | | //今年农资使用量 |
| | | Double selectJyCount(@Param("farmId") String farmId); |
| | | //去年农资使用量 |
| | |
| | | <!--查询统计本年农事记录操作总数--> |
| | | <select id="getFarmingCount" resultType="java.lang.Integer"> |
| | | select ifnull(count(*), 0) count |
| | | from sys_farming_record |
| | | from sys_farming_record ss |
| | | LEFT JOIN sys_land sl ON sl.id = ss.land_id |
| | | where 1=1 |
| | | and YEAR (time)= YEAR (NOW()) |
| | | and dept_id=#{deptId} |
| | | <if test="farmId != null and farmId != ''"> |
| | | and sl.farm_id = #{sale.farmId} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--查询统计本年农事记录操作总数--> |
| | | <select id="getFarmingStatis" resultType="org.springblade.modules.farm.vo.FarmingStatisVO"> |
| | | select type,case when type = 0 then '施肥' |
| | | when type = 1 then '翻耕' |
| | | when type = 2 then '灌溉' |
| | | when type = 3 then '起垄' |
| | | when type = 4 then '用药' |
| | | when type = 5 then '追肥' |
| | | when type = 6 then '除草' |
| | | when type = 7 then '修剪' |
| | | when type = 8 then '浸种' |
| | | when type = 9 then '拌种' |
| | | when type = 10 then '移栽' |
| | | when type = 11 then '直播' |
| | | when type = 12 then '采收' |
| | | select ss.type,case when ss.type = 0 then '施肥' |
| | | when ss.type = 1 then '翻耕' |
| | | when ss.type = 2 then '灌溉' |
| | | when ss.type = 3 then '起垄' |
| | | when ss.type = 4 then '用药' |
| | | when ss.type = 5 then '追肥' |
| | | when ss.type = 6 then '除草' |
| | | when ss.type = 7 then '修剪' |
| | | when ss.type = 8 then '浸种' |
| | | when ss.type = 9 then '拌种' |
| | | when ss.type = 10 then '移栽' |
| | | when ss.type = 11 then '直播' |
| | | when ss.type = 12 then '采收' |
| | | else '其他' end as name, |
| | | ifnull(count(*), 0) value |
| | | from sys_farming_record |
| | | from sys_farming_record ss |
| | | LEFT JOIN sys_land sl ON sl.id = ss.land_id |
| | | where 1=1 |
| | | and YEAR (time)= YEAR (NOW()) |
| | | and dept_id=#{deptId} |
| | | group by type |
| | | <if test="farmId != null and farmId != ''"> |
| | | and sl.farm_id = #{sale.farmId} |
| | | </if> |
| | | group by ss.type |
| | | </select> |
| | | |
| | | <!--今年农资使用量--> |
| | |
| | | * 查询统计本年农事记录操作总数 |
| | | * @return |
| | | */ |
| | | Object getFarmingCount(String deptId); |
| | | Object getFarmingCount(String farmId); |
| | | |
| | | /** |
| | | * 查询统计本年农事记录操作,按分类统计 |
| | | * @return |
| | | */ |
| | | Object getFarmingStatis(String deptId); |
| | | Object getFarmingStatis(String farmId); |
| | | //今年农资使用量 |
| | | Double selectJyCount(String deptId); |
| | | //去年农资使用量 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getFarmingCount(String deptId) { |
| | | return baseMapper.getFarmingCount(deptId); |
| | | public Object getFarmingCount(String farmId) { |
| | | return baseMapper.getFarmingCount(farmId); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getFarmingStatis(String deptId) { |
| | | return baseMapper.getFarmingStatis(deptId); |
| | | public Object getFarmingStatis(String farmId) { |
| | | return baseMapper.getFarmingStatis(farmId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | */ |
| | | @GetMapping("/pagePalnt") |
| | | public R pagePalnt(FarmPlantVO farmPlant, Query query) { |
| | | int i = farmplantService.selectCount(); |
| | | int i = farmplantService.selectCount(farmPlant); |
| | | IPage<FarmPlantVO> pages = farmplantService.selectFarmPlantPage(Condition.getPage(query), farmPlant); |
| | | Map map = new HashMap<>(); |
| | | map.put("num", i); |
| | |
| | | */ |
| | | List<FarmPlantVO> getFarmPlantStatisticsCount(@Param("farmPlant") FarmPlantVO farm); |
| | | |
| | | int selectCount(); |
| | | int selectCount(@Param("farmPlant") FarmPlantVO farm); |
| | | |
| | | Map selectPlant(String code, String time); |
| | | |
| | |
| | | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | SELECT IFNULL(COUNT(*), 0) as num |
| | | FROM (SELECT strain_id FROM `sys_farm_plant` WHERE STATUS = 1 GROUP BY strain_id) a |
| | | FROM (SELECT strain_id |
| | | FROM `sys_farm_plant` ss |
| | | LEFT JOIN sys_land sl ON sl.id = ss.land_id |
| | | WHERE ss.STATUS = 1 |
| | | <if test="farmPlant.farmId != null and farmPlant.farmId != ''"> |
| | | and sl.farm_id = #{farmPlant.farmId} |
| | | </if> |
| | | GROUP BY strain_id) a |
| | | </select> |
| | | |
| | | <!--种植品种监管 0:有机 code=1(当天) =2(月) =3(年)--> |
| | |
| | | * @return |
| | | */ |
| | | FarmPlantVO getFarmPlantStatisticsCount(FarmPlantVO farmPlantVO); |
| | | int selectCount(); |
| | | int selectCount(FarmPlantVO farmPlantVO); |
| | | Map selectPlant(String code,String time); |
| | | Map selectPlantl(String code,String time); |
| | | Map selectPlantw(String code,String time); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int selectCount() { |
| | | return baseMapper.selectCount(); |
| | | public int selectCount(FarmPlantVO farm) { |
| | | return baseMapper.selectCount(farm); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <if test="land.farmId!= null and land.farmId!=''"> |
| | | and farm_id=#{land.farmId} |
| | | </if> |
| | | <if test="land.deptId!= null and land.deptId!=''"> |
| | | and dept_id=#{land.deptId} |
| | | </if> |
| | | </select> |
| | | <!--土地使用面积--> |
| | | <select id="selectSAre" resultType="java.util.HashMap"> |
| | |
| | | <if test="land.farmId!= null and land.farmId!=''"> |
| | | and farm_id=#{land.farmId} |
| | | </if> |
| | | <if test="land.deptId!= null and land.deptId!=''"> |
| | | and dept_id=#{land.deptId} |
| | | </if> |
| | | </select> |
| | | <!--土地未使用面积--> |
| | | <select id="selectWAre" resultType="java.util.HashMap"> |
| | |
| | | and type = 1 |
| | | <if test="land.farmId!= null and land.farmId!=''"> |
| | | and farm_id=#{land.farmId} |
| | | </if> |
| | | <if test="land.deptId!= null and land.deptId!=''"> |
| | | and dept_id=#{land.deptId} |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | * 大屏销售统计 |
| | | */ |
| | | @GetMapping("/selctSaletCount") |
| | | public R selctSaletCount() { |
| | | return R.data(saleService.selctSaletCount()); |
| | | public R selctSaletCount(String farmId) { |
| | | return R.data(saleService.selctSaletCount(farmId)); |
| | | } |
| | | |
| | | /** |
| | | * 统计今年和去年的销售总额 |
| | | */ |
| | | @GetMapping("/selctSaletZ") |
| | | public R selctSaletZ() { |
| | | return R.data(saleService.selctSaletZ()); |
| | | public R selctSaletZ(SaleVO sale) { |
| | | return R.data(saleService.selctSaletZ(sale)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 按行政区统计市场流通 |
| | | */ |
| | | @GetMapping("/selectMarketDistrict") |
| | | public R selectMarketDistrict() { |
| | | return R.data(saleService.selectMarketDistrict()); |
| | | public R selectMarketDistrict(String farmId) { |
| | | return R.data(saleService.selectMarketDistrict(farmId)); |
| | | } |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<SaleVO> selectSalePage(IPage page, SaleVO sale); |
| | | Map<String, String> selctSaletCount(); |
| | | List<Map<Object,String>> selctSaletZ(); |
| | | Map<String, String> selctSaletCount(String farmId); |
| | | List<Map<Object,String>> selctSaletZ(@Param("sale") SaleVO sale); |
| | | |
| | | /** |
| | | * 统计市场流通/去年流通量/本月流通量 |
| | |
| | | */ |
| | | List<Map<Object,String>> selectMarketCirculate(@Param("sale") SaleVO sale); |
| | | |
| | | List<Map<Object,String>> selectMarketDistrict(); |
| | | List<Map<Object,String>> selectMarketDistrict(String farmId); |
| | | } |
| | |
| | | IFNULL(SUM( CASE WHEN MONTH ( s.sale_time ) = 12 THEN s.sale_num * sale_price END ),0) AS '12' |
| | | FROM |
| | | sys_sale AS s |
| | | LEFT JOIN sys_land sl ON sl.id = s.land_id |
| | | WHERE |
| | | YEAR ( sale_time ) = YEAR ( NOW( ) ) |
| | | <if test="farmId != null and farmId != ''"> |
| | | and sl.farm_id = #{farmId} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--统计今年和去年的销售总额--> |
| | |
| | | SELECT |
| | | IFNULL( SUM( sale_num * sale_price), 0 ) AS num |
| | | FROM |
| | | sys_sale |
| | | sys_sale ss |
| | | LEFT JOIN sys_land sl ON sl.id = ss.land_id |
| | | WHERE |
| | | YEAR ( sale_time ) = YEAR ( NOW( )-1 ) UNION ALL |
| | | YEAR ( sale_time ) = YEAR ( NOW( )-1 ) |
| | | <if test="sale.farmId != null and sale.farmId != ''"> |
| | | and sl.farm_id = #{sale.farmId} |
| | | </if> |
| | | UNION ALL |
| | | SELECT |
| | | IFNULL( SUM( sale_num * sale_price ), 0 ) AS num |
| | | FROM |
| | | sys_sale |
| | | sys_sale ss |
| | | LEFT JOIN sys_land sl ON sl.id = ss.land_id |
| | | WHERE |
| | | YEAR ( sale_time ) = YEAR ( date_sub( now( ), INTERVAL 1 YEAR ) ) |
| | | <if test="sale.farmId != null and sale.farmId != ''"> |
| | | and sl.farm_id = #{sale.farmId} |
| | | </if> |
| | | </select> |
| | | <!--统计市场流通/去年流通量/本月流通量--> |
| | | <select id="selectMarketCirculate" resultType="java.util.HashMap" > |
| | |
| | | FROM |
| | | sys_sale sale |
| | | LEFT JOIN sys_district dis ON sale.sale_destination = dis.CODE |
| | | LEFT JOIN sys_land sl ON sl.id = sale.land_id |
| | | WHERE |
| | | YEAR ( sale_time ) = YEAR ( NOW( ) ) |
| | | <if test="farmId != null and farmId != ''"> |
| | | and sl.farm_id = #{farmId} |
| | | </if> |
| | | GROUP BY |
| | | dis.NAME, |
| | | dis.lat, |
| | |
| | | * @return |
| | | */ |
| | | IPage<SaleVO> selectSalePage(IPage<SaleVO> page, SaleVO sale); |
| | | Map<String, String> selctSaletCount(); |
| | | List<Map<Object,String>> selctSaletZ(); |
| | | Map<String, String> selctSaletCount(String farmId); |
| | | List<Map<Object,String>> selctSaletZ(SaleVO sale); |
| | | |
| | | /** |
| | | * 统计市场流通/去年流通量/本月流通量 |
| | |
| | | * @return |
| | | */ |
| | | List<Map<Object,String>> selectMarketCirculate(SaleVO sale); |
| | | List<Map<Object,String>> selectMarketDistrict(); |
| | | List<Map<Object,String>> selectMarketDistrict(String farmId); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> selctSaletCount() { |
| | | return baseMapper.selctSaletCount(); |
| | | public Map<String, String> selctSaletCount(String farmId) { |
| | | return baseMapper.selctSaletCount(farmId); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<Object, String>> selctSaletZ() { |
| | | return baseMapper.selctSaletZ(); |
| | | public List<Map<Object, String>> selctSaletZ(SaleVO sale) { |
| | | return baseMapper.selctSaletZ(sale); |
| | | } |
| | | |
| | | /** |
| | |
| | | return baseMapper.selectMarketCirculate(sale); |
| | | } |
| | | @Override |
| | | public List<Map<Object, String>> selectMarketDistrict() { |
| | | return baseMapper.selectMarketDistrict(); |
| | | public List<Map<Object, String>> selectMarketDistrict(String farmId) { |
| | | return baseMapper.selectMarketDistrict(farmId); |
| | | } |
| | | |
| | | } |