智慧农业后台管理
guoshilong
2022-08-19 4d60a2ee6bbfe76e2740307c832c8f309090a41e
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -42,7 +42,7 @@
    </if> ) c ON c.dict_key = l.land_unit
        LEFT JOIN ( SELECT id, farm_name FROM sys_farm ) v ON v.id = l.farm_id
        where l.is_deleted = 0
        <if test="land.landType!=null and land.landType != ''">
        <if test="land.landType!=null and land.landType != '' or land.landType == 0 ">
            and l.land_type = #{land.landType}
        </if>
        <if test="land.landName!=null and land.landName != ''">
@@ -205,7 +205,7 @@
    <!--查询统计地块是否有轮廓-->
    <select id="getLandIsAreaStatistic" resultType="java.lang.Integer">
        SELECT count(*) FROM sys_land where land_range is not null
        SELECT count(*) FROM sys_land where land_range is not null AND sys_land.is_deleted = 0
        <if test="land.farmId!= null and land.farmId!=''">
            and farm_id=#{land.farmId}
        </if>
@@ -213,7 +213,7 @@
            and dept_id=#{land.deptId}
        </if>
        union all
        SELECT count(*) FROM sys_land where land_range is null
        SELECT count(*) FROM sys_land where land_range is null AND sys_land.is_deleted = 0
        <if test="land.farmId!= null and land.farmId!=''">
            and farm_id=#{land.farmId}
        </if>
@@ -235,10 +235,23 @@
        SELECT DISTINCT land.id,land.land_name,land.url,land.farm_id
        FROM sys_land land
        LEFT JOIN sys_farm_plant sfp ON sfp.land_id = land.id
        WHERE sfp.strain_id = #{strainId}
        <if test="farmId !=null and farmId != '' ">
            AND land.farm_id = #{farmId}
        WHERE land.is_deleted = 0
        <if test="land.strainId !=null and land.strainId !=''">
            AND sfp.strain_id = #{land.strainId}
        </if>
        <if test="land.farmId !=null and land.farmId != '' ">
            AND land.farm_id = #{land.farmId}
        </if>
        <if test="land.sfpStatus !=null and land.sfpStatus !=''">
            AND sfp.status = #{land.sfpStatus}
        </if>
    </select>
    <select id="findPlantInLand" resultType="org.springblade.modules.lang.vo.LandVO">
        SELECT land.*,sfp.id AS sfpId,sfp.strain_id
        FROM sys_land land
        LEFT JOIN sys_farm_plant sfp ON land.id = sfp.land_id
        WHERE land.is_deleted = 0  AND sfp.status = 1
        AND land.id = #{ids}
    </select>
</mapper>