智慧农业后台管理
zhongrj
2022-07-19 4df482d1be248888f6d31e5fc7f912f126920305
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
@@ -196,4 +207,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>