| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yunfeiyun.agmp.fms.mapper.FmsPlanMapper">
- <sql id="selectFmsPlanVo">
- select planId, planNo, landId, blockId, cropId, planArea, planPlanstartdate, planPlanenddate, planStartdate, planEnddate, planStatus, planRemark, planCreator, planCreateddate, planModifier, planModifieddate, planPeriodname from FmsPlan
- </sql>
- <select id="selectFmsPlanList" parameterType="FmsPlan" resultType="FmsPlan">
- <include refid="selectFmsPlanVo"/>
- <where>
- tid = #{tid}
- <if test="planNo != null and planNo != ''"> and planNo = #{planNo}</if>
- <if test="landId != null and landId != ''"> and landId = #{landId}</if>
- <if test="blockId != null and blockId != ''"> and blockId = #{blockId}</if>
- <if test="cropId != null and cropId != ''"> and cropId = #{cropId}</if>
- <if test="planArea != null "> and planArea = #{planArea}</if>
- <if test="planPlanstartdate != null and planPlanstartdate != ''"> and planPlanstartdate = #{planPlanstartdate}</if>
- <if test="planPlanenddate != null and planPlanenddate != ''"> and planPlanenddate = #{planPlanenddate}</if>
- <if test="planStartdate != null and planStartdate != ''"> and planStartdate = #{planStartdate}</if>
- <if test="planEnddate != null and planEnddate != ''"> and planEnddate = #{planEnddate}</if>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="planRemark != null and planRemark != ''"> and planRemark = #{planRemark}</if>
- <if test="planCreator != null and planCreator != ''"> and planCreator = #{planCreator}</if>
- <if test="planCreateddate != null and planCreateddate != ''"> and planCreateddate = #{planCreateddate}</if>
- <if test="planModifier != null and planModifier != ''"> and planModifier = #{planModifier}</if>
- <if test="planModifieddate != null and planModifieddate != ''"> and planModifieddate = #{planModifieddate}</if>
- <if test="planPeriodname != null and planPeriodname != ''"> and planPeriodname = #{planPeriodname}</if>
- </where>
- </select>
- <select id="selectFmsPlanNoList" parameterType="FmsPlan" resultType="FmsPlan">
- select
- planId,
- planNo
- from FmsPlan
- <where>
- tid = #{tid}
- </where>
- order by planNo desc
- </select>
- <select id="selectCountFmsPlanByBlockId" parameterType="String" resultType="int">
- select count(1) from FmsPlan where blockId = #{blockId}
- <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
- </select>
- <select id="selectCountFmsPlan" parameterType="FmsPlanReqVo" resultType="int">
- select count(1) from FmsPlan
- <where>
- <if test="planNo != null and planNo != ''"> and planNo = #{planNo}</if>
- <if test="landId != null and landId != ''"> and landId = #{landId}</if>
- <if test="blockId != null and blockId != ''"> and blockId = #{blockId}</if>
- <if test="cropId != null and cropId != ''"> and cropId = #{cropId}</if>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
- </where>
- </select>
- <select id="selectPlanList" parameterType="FmsPlanReqVo" resultType="FmsPlanResVo">
- SELECT p.*,c.cropName, c.cropType, c.cropMaintype, l.landName, b.blockName,
- (select GROUP_CONCAT(resUrl) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP') cropPreview,
- (select GROUP_CONCAT(resId) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP') resIds,
- (select sum(tp.pickWeight) from FmsTaskpick tp left join FmsTask f on tp.taskId = f.taskId where f.planId = p.planId) pickWeightSum
- from FmsPlan p
- LEFT JOIN FmsCrop c ON p.cropId = c.cropId
- LEFT JOIN FmsLand l ON p.landId = l.landId
- LEFT JOIN FmsBlock b ON p.blockId = b.blockId
- <where>
- <if test="planNo != null and planNo != ''"> and p.planNo = #{planNo}</if>
- <if test="landId != null and landId != ''"> and p.landId = #{landId}</if>
- <if test="blockId != null and blockId != ''"> and p.blockId = #{blockId}</if>
- <if test="cropId != null and cropId != ''"> and p.cropId = #{cropId}</if>
- <if test="cropName != null and cropName != ''"> and c.cropName = #{cropName}</if>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test=" endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND b.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- order by p.planNo desc
- </select>
- <select id="selectPlanListScheduler" parameterType="FmsPlanReqVo" resultType="FmsPlan">
- SELECT p.* from FmsPlan p
- <where>
- <if test="planNo != null and planNo != ''"> and p.planNo = #{planNo}</if>
- <if test="landId != null and landId != ''"> and p.landId = #{landId}</if>
- <if test="blockId != null and blockId != ''"> and p.blockId = #{blockId}</if>
- <if test="cropId != null and cropId != ''"> and p.cropId = #{cropId}</if>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test=" endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test=" nowDate != null and nowDate != ''">
- <if test="updateType != null and updateType == '0'.toString()">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{nowDate}
- </if>
- <if test="updateType != null and updateType == '1'.toString()">
- and p.planPlanenddate <![CDATA[ < ]]> #{nowDate}
- </if>
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- </select>
- <select id="selectFmsPlanByPlanId" parameterType="String" resultType="FmsPlanResVo">
- select p.*, c.cropName, c.cropType, c.cropMaintype, fb.blockName, fl.landName
- from FmsPlan p
- LEFT JOIN FmsCrop c ON p.cropId = c.cropId
- LEFT JOIN FmsBlock fb on fb.blockId = p.blockId
- LEFT JOIN FmsLand fl on fl.landId = p.landId
- where p.planId = #{planId}
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </select>
- <select id="selectFmsPlanRecordByPlanId" parameterType="String" resultType="FmsPlanResVo">
- select p.*, c.cropName, c.cropType, c.cropMaintype, l.landName, b.blockName,
- (select GROUP_CONCAT(resUrl) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP') cropPreview,
- (select GROUP_CONCAT(resId) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP') resIds
- from FmsPlan p
- LEFT JOIN FmsCrop c ON p.cropId = c.cropId
- LEFT JOIN FmsLand l ON l.landId = p.landId
- LEFT JOIN FmsBlock b ON b.blockId = p.blockId
- where planId = #{planId}
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </select>
- <select id="selectSumPlanArea" parameterType="FmsPlanReqVo" resultType="BigDecimal">
- SELECT sum(p.planArea) FROM FmsPlan p
- <where>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="landId != null and landId != ''">
- and p.landId = #{landId}
- </if>
- <if test="blockId != null and blockId != ''">
- and p.blockId = #{blockId}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND p.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- </select>
- <select id="selectPlanByCropName" parameterType="FmsPlanReqVo" resultType="FmsPlanResVo">
- SELECT c.cropName,sum(p.planArea) planArea FROM FmsPlan p
- LEFT JOIN FmsLand l ON p.landId = l.landId
- LEFT JOIN FmsCrop c ON p.cropId = c.cropId
- LEFT JOIN FmsBlock b on b.blockId = p.blockId
- <where>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="landId != null and landId != ''">
- and p.landId = #{landId}
- </if>
- <if test="blockId != null and blockId != ''">
- and p.blockId = #{blockId}
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="dataFilter == true and landIds != null and landIds.size() > 0">
- AND l.landId in
- <foreach collection="landIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- GROUP BY c.cropName
- </select>
- <select id="selectPlanByCropNameAndType" parameterType="FmsPlanReqVo" resultType="FmsPlanResVo">
- SELECT c.cropName, c.cropType,
- sum(p.planArea) planArea
- FROM FmsPlan p
- LEFT JOIN FmsLand l ON p.landId = l.landId
- LEFT JOIN FmsCrop c ON p.cropId = c.cropId
- <where>
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="landId != null and landId != ''">
- and p.landId = #{landId}
- </if>
- <if test="blockId != null and blockId != ''">
- and p.blockId = #{blockId}
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- GROUP BY c.cropName, c.cropType
- </select>
- <select id="selectPlanByLandId" parameterType="FmsPlanReqVo" resultType="FmsPlanResVo">
- SELECT l.landId, l.landName, sum(p.planArea) planArea FROM FmsPlan p
- LEFT JOIN FmsLand l ON p.landId = l.landId
- <where>
- l.landId is not null
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="landId != null and landId != ''">
- and p.landId = #{landId}
- </if>
- <if test="blockId != null and blockId != ''">
- and p.blockId = #{blockId}
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="dataFilter == true and landIds != null and landIds.size() > 0">
- AND l.landId in
- <foreach collection="landIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- GROUP BY l.landId
- </select>
- <select id="selectPlanByBlockId" parameterType="FmsPlanReqVo" resultType="FmsPlanResVo">
- SELECT b.blockId, b.blockName, sum(p.planArea) planArea FROM FmsPlan p
- LEFT JOIN FmsBlock b on b.blockId = p.blockId
- <where>
- b.blockId is not null
- <if test="planStatus != null and planStatus != ''">
- and
- <foreach collection="planStatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- p.planStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="landId != null and landId != ''">
- and p.landId = #{landId}
- </if>
- <if test="blockId != null and blockId != ''">
- and p.blockId = #{blockId}
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- <if test="dataFilter == true and landIds != null and landIds.size() > 0">
- AND l.landId in
- <foreach collection="landIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY b.blockId
- </select>
- <insert id="insertFmsPlan" parameterType="FmsPlan">
- insert into FmsPlan
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="planId != null">planId,</if>
- <if test="planNo != null">planNo,</if>
- <if test="landId != null">landId,</if>
- <if test="blockId != null">blockId,</if>
- <if test="cropId != null">cropId,</if>
- <if test="planArea != null">planArea,</if>
- <if test="planPlanstartdate != null">planPlanstartdate,</if>
- <if test="planPlanenddate != null">planPlanenddate,</if>
- <if test="planStartdate != null">planStartdate,</if>
- <if test="planEnddate != null">planEnddate,</if>
- <if test="planStatus != null">planStatus,</if>
- <if test="planRemark != null">planRemark,</if>
- <if test="planCreator != null">planCreator,</if>
- <if test="planCreateddate != null">planCreateddate,</if>
- <if test="planModifier != null">planModifier,</if>
- <if test="planModifieddate != null">planModifieddate,</if>
- <if test="planPeriodname != null">planPeriodname,</if>
- <if test="tid != null">tid,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="planId != null">#{planId},</if>
- <if test="planNo != null">#{planNo},</if>
- <if test="landId != null">#{landId},</if>
- <if test="blockId != null">#{blockId},</if>
- <if test="cropId != null">#{cropId},</if>
- <if test="planArea != null">#{planArea},</if>
- <if test="planPlanstartdate != null">#{planPlanstartdate},</if>
- <if test="planPlanenddate != null">#{planPlanenddate},</if>
- <if test="planStartdate != null">#{planStartdate},</if>
- <if test="planEnddate != null">#{planEnddate},</if>
- <if test="planStatus != null">#{planStatusArray},</if>
- <if test="planRemark != null">#{planRemark},</if>
- <if test="planCreator != null">#{planCreator},</if>
- <if test="planCreateddate != null">#{planCreateddate},</if>
- <if test="planModifier != null">#{planModifier},</if>
- <if test="planModifieddate != null">#{planModifieddate},</if>
- <if test="planPeriodname != null">#{planPeriodname},</if>
- <if test="tid != null">#{tid},</if>
- </trim>
- </insert>
- <update id="updateFmsPlan" parameterType="FmsPlan">
- update FmsPlan
- <trim prefix="SET" suffixOverrides=",">
- <if test="planNo != null">planNo = #{planNo},</if>
- <if test="landId != null">landId = #{landId},</if>
- <if test="blockId != null">blockId = #{blockId},</if>
- <if test="cropId != null">cropId = #{cropId},</if>
- <if test="planArea != null">planArea = #{planArea},</if>
- <if test="planPlanstartdate != null">planPlanstartdate = #{planPlanstartdate},</if>
- <if test="planPlanenddate != null">planPlanenddate = #{planPlanenddate},</if>
- <if test="planStartdate != null">planStartdate = #{planStartdate},</if>
- <if test="planEnddate != null">planEnddate = #{planEnddate},</if>
- <if test="planStatus != null">planStatus = #{planStatusArray},</if>
- <if test="planRemark != null">planRemark = #{planRemark},</if>
- <if test="planCreator != null">planCreator = #{planCreator},</if>
- <if test="planCreateddate != null">planCreateddate = #{planCreateddate},</if>
- <if test="planModifier != null">planModifier = #{planModifier},</if>
- <if test="planModifieddate != null">planModifieddate = #{planModifieddate},</if>
- <if test="planPeriodname != null">planPeriodname = #{planPeriodname},</if>
- </trim>
- where planId = #{planId}
- <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
- </update>
- <update id="updateFmsPlanBatch" parameterType="FmsPlan">
- <foreach collection="list" item="fmsPlan" separator=";">
- update FmsPlan
- <trim prefix="SET" suffixOverrides=",">
- <if test="fmsPlan.planNo != null">planNo = #{fmsPlan.planNo},</if>
- <if test="fmsPlan.landId != null">landId = #{fmsPlan.landId},</if>
- <if test="fmsPlan.blockId != null">blockId = #{fmsPlan.blockId},</if>
- <if test="fmsPlan.cropId != null">cropId = #{fmsPlan.cropId},</if>
- <if test="fmsPlan.planArea != null">planArea = #{fmsPlan.planArea},</if>
- <if test="fmsPlan.planPlanstartdate != null">planPlanstartdate = #{fmsPlan.planPlanstartdate},</if>
- <if test="fmsPlan.planPlanenddate != null">planPlanenddate = #{fmsPlan.planPlanenddate},</if>
- <if test="fmsPlan.planStartdate != null">planStartdate = #{fmsPlan.planStartdate},</if>
- <if test="fmsPlan.planEnddate != null">planEnddate = #{fmsPlan.planEnddate},</if>
- <if test="fmsPlan.planStatus != null">planStatus = #{fmsPlan.planStatus},</if>
- <if test="fmsPlan.planRemark != null">planRemark = #{fmsPlan.planRemark},</if>
- <if test="fmsPlan.planCreator != null">planCreator = #{fmsPlan.planCreator},</if>
- <if test="fmsPlan.planCreateddate != null">planCreateddate = #{fmsPlan.planCreateddate},</if>
- <if test="fmsPlan.planModifier != null">planModifier = #{fmsPlan.planModifier},</if>
- <if test="fmsPlan.planModifieddate != null">planModifieddate = #{fmsPlan.planModifieddate},</if>
- <if test="fmsPlan.planPeriodname != null">planPeriodname = #{fmsPlan.planPeriodname},</if>
- <if test="fmsPlan.tid != null">tid = #{fmsPlan.tid},</if>
- </trim>
- where planId = #{fmsPlan.planId}
- <if test="fmsPlan.tid != null and fmsPlan.tid !='' and fmsPlan.tid != '-1'">and tid = #{fmsPlan.tid}</if>
- </foreach>
- </update>
- <delete id="deleteFmsPlanByPlanId" parameterType="String">
- delete from FmsPlan
- where
- planId = #{planId}
- <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
- </delete>
- <delete id="deleteFmsPlanByPlanIds" parameterType="String">
- delete from FmsPlan where planId in
- <foreach item="planId" collection="array" open="(" separator="," close=")">
- #{planId}
- </foreach>
- <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
- </delete>
- <select id="selectPlanListByWarnScheduler" resultType="FmsPlanByWarnSchedulerDto">
- SELECT p.planId,p.landId, pe.periodId, pe.periodName, pe.periodRemark, p.planPlanstartdate, p.planPlanenddate,p.tid,
- p.planEnddate, pe.periodDays, pe.periodSeq
- FROM FmsPlan AS p
- JOIN FmsCrop AS c ON p.cropId = c.cropId
- JOIN FmsPeriod AS pe ON p.cropId = pe.cropId
- <where>
- p.planStatus = 1
- <if test="planEnddate != null and planEnddate != ''">
- and p.planEnddate >= #{planEnddate} OR p.planEnddate IS NULL
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- </where>
- ORDER BY p.planId, pe.periodId, pe.periodSeq
- </select>
- <select id="selectPlanListOfTaskStatus" parameterType="String" resultType="FmsPlanListOfTaskStatusResVo">
- SELECT p.planId, p.blockId, p.cropId, p.landId, p.planNo, p.planPeriodname, c.cropName, c.cropType, b.blockName,p.planplanstartdate,p.planPlanenddate,
- (SELECT count(1) FROM FmsTask t WHERE t.taskStatus <![CDATA[ < ]]> 2 and t.planId = p.planId and t.taskManager = #{userId}) taskCount,
- (select GROUP_CONCAT(resUrl) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP') cropPreview
- FROM FmsPlan p
- LEFT JOIN FmsCrop c on c.cropId = p.cropId
- LEFT JOIN FmsBlock b on b.blockId = p.blockId
- <where>
- <if test="landId != null and landId != ''">
- and p.landId = #{landId}
- </if>
- <if test="tid != null and tid !='' and tid != '-1'">and p.tid = #{tid}</if>
- and p.planStatus != '2'
- </where>
- </select>
- <select id="selectBlockManagerByPlanId" resultType="java.lang.String">
- SELECT
- fb.blockManager
- FROM
- FmsPlan fp
- LEFT JOIN FmsBlock fb on fb.blockId = fp.blockId
- where fp.planId = #{planId}
- <if test="tid != null and tid !='' and tid != '-1'">and fp.tid = #{tid}</if>
- </select>
- <select id="selectCropPlanAreaTop" resultType="com.yunfeiyun.agmp.fms.domain.resvo.FmsCropPlanAreaResVo">
- SELECT
- sum( planArea ) planArea,
- cropId
- FROM
- FmsPlan
- <where>
- tid = #{tid}
- <if test="blockIds != null and blockIds.size() != 0">
- and blockId in
- <foreach collection="blockIds" item="item" index="index" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY cropId
- ORDER BY sum( planArea ) DESC
- </select>
- <select id="selectFmsPlanCropResVoList" resultType="com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanCropResVo">
- select
- p.*,
- c.cropId,
- c.cropName,
- c.cropType,
- c.cropMaintype,
- c.tid
- from
- FmsPlan p
- LEFT JOIN
- (select * from FmsCrop where tid = #{tid}) c on p.cropId = c.cropId
- <where>
- p.tid = #{tid}
- <if test="planNo != null and planNo != ''"> and p.planNo = #{planNo}</if>
- <if test="landId != null and landId != ''"> and p.landId = #{landId}</if>
- <if test="blockId != null and blockId != ''"> and p.blockId = #{blockId}</if>
- <if test="cropId != null and cropId != ''"> and p.cropId = #{cropId}</if>
- <if test="cropName != null and cropName != ''"> and c.cropName = #{cropName}</if>
- <if test="planStatus != null and planStatus != ''">
- and p.planStatus = #{planStatus}
- </if>
- <if test="startDate != null and startDate != ''">
- and p.planPlanenddate >= #{startDate}
- </if>
- <if test=" endDate != null and endDate != ''">
- and p.planPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="blockIds != null and blockIds.size() > 0">
- AND p.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="planStatusArray != null and planStatusArray.size() > 0">
- AND p.planStatus in
- <foreach collection="planStatusArray" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- </mapper>
|