智慧农业后台管理
zengh
2022-08-01 d95f6551e8214d69cd0fd511ec693641eb61ba16
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -17,6 +17,7 @@
    <select id="selectLandPage" resultMap="landResultMap">
        SELECT l.land_name,
        l.land_unit,
        l.id,
        l.land_area ,
        ST_ASTEXT(land_range) as land_range,
@@ -139,6 +140,16 @@
        where id = #{land.id}
    </update>
    <update id="updateLandAr">
        update sys_land set user_id = #{land.userId},
        land_area = #{land.landArea},
        <if test="land.landRange!=null and land.landRange!=''">
            land_range = ST_GeomFromText(${land.landRange}),
        </if>
        url = #{land.url},
        where id = #{land.id}
    </update>
    <select id="selectLandList" resultType="java.util.HashMap">
        select id, land_name as landName
        from sys_land
@@ -152,9 +163,6 @@
        <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">
@@ -165,9 +173,6 @@
        <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">
@@ -177,9 +182,6 @@
        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>
@@ -196,4 +198,23 @@
        GROUP BY sfp.strain_id
    </select>
    <!--查询统计地块是否有轮廓-->
    <select id="getLandIsAreaStatistic" resultType="java.lang.Integer">
        SELECT count(*) FROM sys_land where land_range is not null
        <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>
        union all
        SELECT count(*) FROM sys_land where land_range is null
        <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>
</mapper>