智慧农业后台管理
zengh
2022-08-01 d95f6551e8214d69cd0fd511ec693641eb61ba16
src/main/java/org/springblade/modules/farm/mapper/FarmingRecordMapper.xml
@@ -41,7 +41,7 @@
            and sfr.strain_id = #{farmingRecord.strainId}
        </if>
        <if test="farmingRecord.farmId!=null and farmingRecord.farmId!=''">
            and sl.farm_id = #{farm.farmId}
            and sl.farm_id = #{farmingRecord.farmId}
        </if>
    </select>
@@ -78,34 +78,40 @@
    <!--查询统计本年农事记录操作总数-->
    <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>
    <!--今年农资使用量-->
@@ -162,24 +168,26 @@
    <!--查询农事操作记录(不分页)-->
    <select id="getFarmingRecordListfarm" resultType="org.springblade.modules.farm.vo.FarmingRecordVO">
        select sfr.*,case
                   when sfr.type = 0 then '施肥'
                   when sfr.type = 1 then '翻耕'
                   when sfr.type = 2 then '灌溉'
                   when sfr.type = 3 then '起垄'
                   when sfr.type = 4 then '用药'
                   when sfr.type = 5 then '追肥'
                   when sfr.type = 6 then '除草'
                   when sfr.type = 7 then '修剪'
                   when sfr.type = 8 then '浸种'
                   when sfr.type = 9 then '拌种'
                   when sfr.type = 10 then '移栽'
                   when sfr.type = 11 then '直播'
                   when sfr.type = 12 then '采收'
                   else '其他' end as typeName,sl.land_name landName,ss.strain_name strainName,bu.real_name realName
            when sfr.type = 0 then '施肥'
            when sfr.type = 1 then '翻耕'
            when sfr.type = 2 then '灌溉'
            when sfr.type = 3 then '起垄'
            when sfr.type = 4 then '用药'
            when sfr.type = 5 then '追肥'
            when sfr.type = 6 then '除草'
            when sfr.type = 7 then '修剪'
            when sfr.type = 8 then '浸种'
            when sfr.type = 9 then '拌种'
            when sfr.type = 10 then '移栽'
            when sfr.type = 11 then '直播'
            when sfr.type = 12 then '采收'
        else '其他' end as typeName,sl.land_name landName,ss.strain_name strainName,
        bu.real_name realName,ss1.agricultural_name agriculturalName
        from sys_farming_record sfr
        left join blade_user bu on bu.id = sfr.operator
      left join sys_land sl on sl.id = sfr.land_id
      left join sys_strain ss on ss.id = sfr.strain_id
        left join sys_land sl on sl.id = sfr.land_id
        left join sys_strain ss on ss.id = sfr.strain_id
        left join sys_stockfactory ss1 on ss1.id = sfr.stock_id
        where 1=1
        <if test="farm.landId!=null and farm.landId!=''">
            and sfr.land_id = #{farm.landId}