智慧农业后台管理
Administrator
2022-07-13 9d1892790a7a18d18c19b8b1cf643056d1547f01
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -142,11 +142,10 @@
    </select>
    <!--土地总面积-->
    <select id="selectZAre" resultType="java.util.HashMap">
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
        FROM sys_land
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit FROM sys_land
        WHERE is_deleted = 0
        <if test="deptId!= null and deptId!=''">
            and dept_id=#{deptId}
        <if test="farmId!= null and farmId!=''">
            and farm_id=#{farmId}
        </if>
    </select>
    <!--土地使用面积-->
@@ -155,8 +154,8 @@
        FROM sys_land
        WHERE is_deleted = 0
        and type = 0
        <if test="deptId!= null and deptId!=''">
            and dept_id=#{deptId}
        <if test="farmId!= null and farmId!=''">
            and farm_id=#{farmId}
        </if>
    </select>
    <!--土地未使用面积-->
@@ -165,18 +164,19 @@
        FROM sys_land
        WHERE is_deleted = 0
        and type = 1
        <if test="deptId!= null and deptId!=''">
            and dept_id=#{deptId}
        <if test="farmId!= null and farmId!=''">
            and farm_id=#{farmId}
        </if>
    </select>
    <select id="selectNum" resultType="java.util.HashMap">
        SELECT strain_id
        FROM `sys_farm_plant`
        WHERE status = 1
        <if test="deptId!= null and deptId!=''">
            and dept_id=#{deptId}
        SELECT strain_id FROM sys_farm_plant sfp
        left join sys_land sl on sl.id = sfp.land_id
        WHERE sfp.status = 1
        <if test="farmId!= null and farmId!=''">
            and sl.farm_id=#{farmId}
        </if>
        GROUP BY strain_id
        GROUP BY sfp.strain_id
    </select>
</mapper>