智慧农业后台管理
Administrator
2022-07-01 0ea162c9bbd4e2ac337aae567005369fbc911032
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -17,6 +17,7 @@
    <select id="selectLandPage" resultMap="landResultMap">
        SELECT l.land_name,
        l.id,
        l.land_area ,
        ST_ASTEXT(land_range) as land_range,
        l.url,
@@ -24,12 +25,18 @@
        c.dict_value as dica,
        v.dept_name as deptname
        FROM `sys_land` l
        LEFT JOIN (SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'land' AND is_deleted = 0) d
        LEFT JOIN (SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'land' AND is_deleted = 0 <if
        test="land.tenantId!=null and land.tenantId != ''">
        AND blade_dict_biz.tenant_id = #{land.tenantId}
    </if> ) d
        ON d.dict_key = l.land_type
        LEFT JOIN (SELECT dict_key, dict_value
        FROM blade_dict_biz
        WHERE CODE = 'landunit'
        AND is_deleted = 0) c ON c.dict_key = l.land_unit
        AND is_deleted = 0 <if
        test="land.tenantId!=null and land.tenantId != ''">
        AND blade_dict_biz.tenant_id = #{land.tenantId}
    </if> ) c ON c.dict_key = l.land_unit
        LEFT JOIN ( SELECT id, dept_name FROM blade_dept WHERE is_deleted = 0 ) v ON v.id = l.dept_id
        where l.is_deleted = 0
        <if test="land.landType!=null and land.landType != ''">
@@ -37,6 +44,15 @@
        </if>
        <if test="land.landName!=null and land.landName != ''">
            and l.land_name like concat('%', #{land.landName},'%')
        </if>
        <if test="land.deptId!=null and land.deptId != ''">
            and l.dept_id=#{land.deptId}
        </if>
        <if test="land.type!=null and land.type != ''">
            and l.type=#{land.type}
        </if>
        <if test="land.tenantId!=null and land.tenantId != ''">
            and l.tenant_id =#{land.tenantId}
        </if>
    </select>
@@ -91,25 +107,37 @@
        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>
    </select>
    <!--土地使用面积-->
    <select id="selectSAre" resultType="java.util.HashMap">
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
        FROM sys_land
        WHERE is_deleted = 0
          and type = 0
        and type = 0
        <if test="deptId!= null and deptId!=''">
            and dept_id=#{deptId}
        </if>
    </select>
    <!--土地未使用面积-->
    <select id="selectWAre" resultType="java.util.HashMap">
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
        FROM sys_land
        WHERE is_deleted = 0
          and type = 1
        and type = 1
        <if test="deptId!= null and deptId!=''">
            and dept_id=#{deptId}
        </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}
        </if>
        GROUP BY strain_id
    </select>