智慧农业后台管理
guoshilong
2022-08-26 81523d36a8349d6a6fbef0dcd3e262bd05828d57
src/main/java/org/springblade/modules/farmplant/mapper/FarmPlantMapper.xml
@@ -4,13 +4,19 @@
    <!--自定义查询农场养殖记录分页数据-->
    <select id="selectFarmPlantPage" resultType="org.springblade.modules.farmplant.vo.FarmPlantVO">
        select sfp.*,ss.strain_name strainName,ss.url,sl.land_name landName,sl.land_area area,land_unit landUnit
        select sfp.*,ss.strain_name strainName,ss.url,sl.land_name landName,sl.land_area area,land_unit landUnit,bdb.dict_value dica,a.farm_id AS otherFarmId
        ,(SELECT IFNULL(SUM(r.weight),0) from sys_recovery r where sfp.land_id = r.land_id and sfp.strain_id = r.strain_id) as outputNum
        from
        sys_farm_plant sfp
        left join sys_strain ss on ss.id = sfp.strain_id
        left join sys_land sl on sl.id = sfp.land_id
        LEFT JOIN (
        SELECT l.id,l.land_name,l.farm_id FROM sys_land l
        ) a ON a.id = sfp.other_land_id
        LEFT JOIN sys_farm farm ON farm.id = a.farm_id
        LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = sl.land_unit
        where 1=1
        AND bdb.code = "landunit"
        <if test="farmPlant.plant!=null and farmPlant.plant!=''">
            and sfp.plant = #{farmPlant.plant}
        </if>
@@ -38,6 +44,9 @@
        <if test="farmPlant.varieties!=null and farmPlant.varieties!=''">
            and sfp.varieties like concat('%',#{farmPlant.varieties},'%')
        </if>
        <if test="farmPlant.landName!=null and farmPlant.landName!=''">
            and sl.land_name like concat('%',#{farmPlant.landName},'%')
        </if>
        <if test="farmPlant.startTime!=null and farmPlant.startTime!=''">
            and sfp.transplan_time &gt;= #{farmPlant.startTime}
        </if>
@@ -59,6 +68,9 @@
        <if test="farmPlant.transplanTimeEnd !=null and farmPlant.transplanTimeEnd!= ''">
            and sfp.transplan_time &lt; #{farmPlant.transplanTimeEnd}
        </if>
        <if test="farmPlant.otherLandId !=null and farmPlant.otherLandId !=''">
            AND sfp.other_land_id = #{farmPlant.otherLandId}
        </if>
        order by sfp.id desc
    </select>