| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723 |
- <?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.FmsTaskMapper">
- <sql id="selectFmsTaskVo">
- select taskId, taskNo,taskVisible, planId, blockId, landId, cropId, taskCreatetype, taskType, taskContent, taskPlanstartdate, taskPlanenddate, taskAudittype, taskStatus, taskManager, taskCreator, taskCreateddate, taskCompletedate, taskModifieddate, taskCompletereason, taskAuditor, tid from FmsTask
- </sql>
- <select id="selectFmsTaskList" parameterType="FmsTask" resultType="FmsTask">
- <include refid="selectFmsTaskVo"/>
- <where>
- tid = #{tid}
- <if test="taskNo != null and taskNo != ''"> and taskNo = #{taskNo}</if>
- <if test="planId != null and planId != ''"> and planId = #{planId}</if>
- <if test="blockId != null and blockId != ''"> and blockId = #{blockId}</if>
- <if test="landId != null and landId != ''"> and landId = #{landId}</if>
- <if test="cropId != null and cropId != ''"> and cropId = #{cropId}</if>
- <if test="taskCreatetype != null and taskCreatetype != ''"> and taskCreatetype = #{taskCreatetype}</if>
- <if test="taskType != null and taskType != ''"> and taskType = #{taskType}</if>
- <if test="taskContent != null and taskContent != ''"> and taskContent = #{taskContent}</if>
- <if test="taskPlanstartdate != null and taskPlanstartdate != ''"> and taskPlanstartdate = #{taskPlanstartdate}</if>
- <if test="taskPlanenddate != null and taskPlanenddate != ''"> and taskPlanenddate = #{taskPlanenddate}</if>
- <if test="taskAudittype != null and taskAudittype != ''"> and taskAudittype = #{taskAudittype}</if>
- <if test="taskManager != null and taskManager != ''"> and taskManager = #{taskManager}</if>
- <if test="taskCreator != null and taskCreator != ''"> and taskCreator = #{taskCreator}</if>
- <if test="taskCreateddate != null and taskCreateddate != ''"> and taskCreateddate = #{taskCreateddate}</if>
- <if test="taskCompletedate != null and taskCompletedate != ''"> and taskCompletedate = #{taskCompletedate}</if>
- <if test="taskModifieddate != null and taskModifieddate != ''"> and taskModifieddate = #{taskModifieddate}</if>
- <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
- <if test="startDate != null and startDate != ''">
- and taskPlanstartdate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and taskPlanenddate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND t.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
- </where>
- </select>
- <select id="selectTaskList" parameterType="FmsTaskListReqVo" resultType="FmsTaskResVo">
- select t.*, c.cropName, c.cropType, l.landName, b.blockName, p.planNo, p.planArea,s.taskrcdHour,
- s.taskrcdId,
- t.taskVisible
- from FmsTask t
- LEFT JOIN FmsCrop c on t.cropId = c.cropId
- LEFT JOIN FmsLand l ON t.landId = l.landId
- LEFT JOIN FmsBlock b ON t.blockId = b.blockId
- LEFT JOIN FmsPlan p ON t.planId = p.planId
- LEFT JOIN FmsTaskrcd s ON t.taskId = s.taskId and s.taskrcdAuditstatus = 2
- <where>
- t.tid = #{tid}
- <if test="taskNo != null and taskNo != ''"> and t.taskNo = #{taskNo}</if>
- <if test="planNo != null and planNo != ''"> and p.planNo = #{planNo}</if>
- <if test="planId != null and planId != ''"> and t.planId = #{planId}</if>
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="cropId != null and cropId != ''"> and t.cropId = #{cropId}</if>
- <if test="taskAuditstatus != null and taskAuditstatus != ''">
- and
- <foreach collection="taskAuditstatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- t.taskStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="taskAudittype != null and taskAudittype != ''"> and t.taskAudittype = #{taskAudittype}</if>
- <if test="cropName != null and cropName != ''"> and c.cropName = #{cropName}</if>
- <if test="taskCreatetype != null and taskCreatetype != ''"> and t.taskCreatetype = #{taskCreatetype}</if>
- <if test="queryAllTask == false">
- <if test="taskType != null and taskType != ''"> and t.taskType = #{taskType}</if>
- <if test="taskType == null || taskType == ''">and t.taskType >= 0</if>
- </if>
- <if test="taskManager != null and taskManager != ''"> and t.taskManager = #{taskManager}</if>
- <if test="startDate != null and startDate != ''">
- and t.taskPlanstartdate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and t.taskPlanenddate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="taskAuditor != null and taskAuditor !=''">
- and t.taskAuditor = #{taskAuditor}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND t.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
- </where>
- </select>
- <select id="selectTaskListAll" parameterType="FmsTaskListReqVo" resultType="FmsTaskResVo">
- select t.*, c.cropName, c.cropType, l.landName, b.blockName, p.planNo, p.planArea,s.taskrcdHour
- from FmsTask t
- LEFT JOIN FmsCrop c on t.cropId = c.cropId
- LEFT JOIN FmsLand l ON t.landId = l.landId
- LEFT JOIN FmsBlock b ON t.blockId = b.blockId
- LEFT JOIN FmsPlan p ON t.planId = p.planId
- LEFT JOIN FmsTaskrcd s ON t.taskId = s.taskId and s.taskrcdAuditstatus = 2
- <where>
- t.tid = #{tid}
- <if test="taskNo != null and taskNo != ''"> and t.taskNo = #{taskNo}</if>
- <if test="planId != null and planId != ''"> and t.planId = #{planId}</if>
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="cropId != null and cropId != ''"> and t.cropId = #{cropId}</if>
- <if test="taskAuditstatus != null and taskAuditstatus != ''"> and t.taskStatus = #{taskAuditstatus}</if>
- <if test="taskAudittype != null and taskAudittype != ''"> and t.taskAudittype = #{taskAudittype}</if>
- <if test="cropName != null and cropName != ''"> and c.cropName = #{cropName}</if>
- <if test="taskCreatetype != null and taskCreatetype != ''"> and t.taskCreatetype = #{taskCreatetype}</if>
- <if test="taskType != null and taskType != ''">
- and t.taskType in
- <foreach collection="taskType.split(',')" item="items" open="(" separator="," close=")">
- <if test="items != null and items != ''">
- #{items}
- </if>
- </foreach>
- </if>
- <if test="taskManager != null and taskManager != ''"> and t.taskManager = #{taskManager}</if>
- <if test="startDate != null and startDate != ''">
- and t.taskPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and t.taskPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="taskAuditor != null and taskAuditor !=''">
- and t.taskAuditor = #{taskAuditor}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND t.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
- </where>
- </select>
- <select id="selectTaskListScreenData" parameterType="FmsTaskListReqVo" resultType="FmsTaskResVo">
- select t.*, c.cropName, c.cropType, l.landName, b.blockName
- from FmsTask t
- LEFT JOIN FmsCrop c on t.cropId = c.cropId
- LEFT JOIN FmsLand l ON t.landId = l.landId
- LEFT JOIN FmsBlock b ON t.blockId = b.blockId
- <where>
- t.tid = #{tid}
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="dataFilter == true and blockIds !=null and blockIds.size()>0">
- and t.blockId in
- <foreach collection="blockIds" item="blockId" index="index" open="(" close=")" separator=",">
- #{blockId}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
- </where>
- order by taskCreateddate desc limit 10
- </select>
- <select id="selectAllTaskList" parameterType="FmsTaskListReqVo" resultType="FmsTaskMessageResVo">
- select t.*, c.cropName, c.cropType, l.landName, b.blockName, p.planNo, p.planArea,tp.taskpatrolWay,tp.taskpatrolAddress
- from FmsTask t
- LEFT JOIN FmsCrop c on t.cropId = c.cropId
- LEFT JOIN FmsLand l ON t.landId = l.landId
- LEFT JOIN FmsBlock b ON t.blockId = b.blockId
- LEFT JOIN FmsPlan p ON t.planId = p.planId
- LEFT JOIN FmsTaskpatrol tp on tp.taskId = t.taskId
- <where>
- t.tid = #{tid}
- <if test="taskNo != null and taskNo != ''"> and t.taskNo = #{taskNo}</if>
- <if test="planId != null and planId != ''"> and t.planId = #{planId}</if>
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="cropId != null and cropId != ''"> and t.cropId = #{cropId}</if>
- <if test="taskAuditstatus != null and taskAuditstatus != ''"> and t.taskStatus = #{taskAuditstatus}</if>
- <if test="cropName != null and cropName != ''"> and c.cropName = #{cropName}</if>
- <if test="taskCreatetype != null and taskCreatetype != ''"> and t.taskCreatetype = #{taskCreatetype}</if>
- <if test="taskType != null and taskType != ''"> and t.taskType = #{taskType}</if>
- <if test="taskManager != null and taskManager != ''"> and t.taskManager = #{taskManager}</if>
- <if test="startDate != null and startDate != ''">
- and t.taskPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and t.taskPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="taskAuditor != null and taskAuditor !=''">
- and t.taskAuditor = #{taskAuditor}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size()>0 and landIds !=null and landIds.size()>0">
- AND (
- t.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- or
- t.landId in
- <foreach collection="landIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
- </if>
- <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
- </where>
- </select>
-
- <select id="selectFmsTaskByTaskId" parameterType="String" resultType="FmsTask">
- <include refid="selectFmsTaskVo"/>
- where
- taskId = #{taskId}
- and tid = #{tid}
- </select>
- <select id="selectCountFmsTaskByPlanId" parameterType="String" resultType="int">
- select count(1) from FmsTask
- where
- planId = #{planId}
- and tid = #{tid}
- </select>
- <select id="selectCountFmsTask" parameterType="FmsTaskListReqVo" resultType="int">
- select count(1) from FmsTask
- <where>
- tid = #{tid}
- <if test="taskAuditstatus != null and taskAuditstatus != ''">
- and
- <foreach collection="taskAuditstatus.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- taskStatus = #{items}
- </if>
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''"> and taskCompletedate <![CDATA[ >= ]]> #{startDate}</if>
- <if test="endDate != null and endDate != ''"> and taskCompletedate <![CDATA[ <= ]]> #{endDate}</if>
- <if test="taskManager != null and taskManager != ''"> and taskManager = #{taskManager}</if>
- <if test="landId != null and landId != ''"> and landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
- </where>
- </select>
- <select id="selectCountFmsTaskByType" parameterType="FmsTaskListReqVo" resultType="FmsTaskTypeCountResVo">
- SELECT count(taskType) count, taskType FROM FmsTask
- <where>
- tid = #{tid}
- <if test="taskAuditstatus != null and taskAuditstatus != ''"> and taskStatus = #{taskAuditstatus}</if>
- <if test="landId != null and landId != ''"> and landId = #{landId}</if>
- <if test="taskAudittype != null and taskAudittype != ''">
- and
- <foreach collection="taskAudittype.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- taskAudittype = #{items}
- </if>
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''"> and taskCreateddate <![CDATA[ >= ]]> #{startDate}</if>
- <if test="endDate != null and endDate != ''"> and taskCreateddate <![CDATA[ <= ]]> #{endDate}</if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
- and taskType >=0
- </where>
- GROUP BY taskType
- order by count desc;
- </select>
- <select id="selectCountFmsTaskByTypeBoard" parameterType="FmsTaskListReqVo" resultType="FmsTaskTypeCountResVo">
- SELECT count(taskType) count, taskType FROM FmsTask
- <where>
- tid = #{tid}
- <if test="taskAuditstatus != null and taskAuditstatus != ''"> and taskStatus = #{taskAuditstatus}</if>
- <if test="landId != null and landId != ''"> and landId = #{landId}</if>
- <if test="planId != null and planId != ''"> and planId = #{planId}</if>
- <if test="blockId != null and blockId != ''"> and blockId = #{blockId}</if>
- <if test="taskManager != null and taskManager != ''"> and taskManager = #{taskManager}</if>
- <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
- <if test="taskAudittype != null and taskAudittype != ''">
- and
- <foreach collection="taskAudittype.split(',')" item="items" open="(" separator="or" close=")">
- <if test="items != null and items != ''">
- taskAudittype = #{items}
- </if>
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''">
- and taskPlanstartdate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and taskPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
- </where>
- GROUP BY taskType
- </select>
- <select id="selectSumTaskrcdHour" parameterType="FmsTaskListReqVo" resultType="FmsTaskSumTaskrcdHourResVo">
- select sum(tb1.taskrcdHour) taskrcdHour,t.taskType
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '1' or tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where t.taskType >= 0 and tb1.taskrcdAuditstatus = '2' and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="startDate != null and startDate != ''"> and t.taskCompletedate <![CDATA[ >= ]]> #{startDate}</if>
- <if test="endDate != null and endDate != ''"> and t.taskCompletedate <![CDATA[ <= ]]> #{endDate}</if>
- <if test="dataFilter == true and landIds != null and landIds.size() > 0">
- AND t.landId in
- <foreach collection="landIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
- group by t.taskType
- </select>
- <select id="selectInfoByTaskId" parameterType="String" resultType="FmsTaskResVo">
- select t.*, c.cropName, c.cropType, l.landName, b.blockName, p.planNo, p.planArea, u.userName taskCreatorName
- from FmsTask t
- LEFT JOIN FmsCrop c on t.cropId = c.cropId
- LEFT JOIN FmsLand l ON t.landId = l.landId
- LEFT JOIN FmsBlock b ON t.blockId = b.blockId
- LEFT JOIN FmsPlan p ON t.planId = p.planId
- LEFT JOIN SysUser u ON t.taskCreator = u.userId
- where
- t.taskId = #{taskId}
- and t.tid = #{tid}
- </select>
- <select id="getInfoByPlanId" parameterType="String" resultType="FmsTaskResVo">
- select t.*, tb1.taskrcdId
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where taskrcdAuditstatus = '1' or taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where
- t.taskType >= 0
- and t.taskStatus = '3'
- and t.planId = #{planId}
- and t.tid = #{tid}
- </select>
- <insert id="insertFmsTask" parameterType="FmsTask">
- insert into FmsTask
- <trim suffixOverrides="," suffix=")" prefix="(">
- <if test="taskId != null">taskId,</if>
- <if test="taskNo != null">taskNo,</if>
- <if test="planId != null">planId,</if>
- <if test="blockId != null">blockId,</if>
- <if test="landId != null">landId,</if>
- <if test="cropId != null">cropId,</if>
- <if test="taskCreatetype != null">taskCreatetype,</if>
- <if test="taskType != null">taskType,</if>
- <if test="taskContent != null">taskContent,</if>
- <if test="taskPlanstartdate != null">taskPlanstartdate,</if>
- <if test="taskPlanenddate != null">taskPlanenddate,</if>
- <if test="taskAudittype != null">taskAudittype,</if>
- <if test="taskStatus != null">taskStatus,</if>
- <if test="taskManager != null">taskManager,</if>
- <if test="taskCreator != null">taskCreator,</if>
- <if test="taskCreateddate != null">taskCreateddate,</if>
- <if test="taskCompletedate != null">taskCompletedate,</if>
- <if test="taskModifieddate != null">taskModifieddate,</if>
- <if test="taskCompletereason != null">taskCompletereason,</if>
- <if test="taskAuditor != null">taskAuditor,</if>
- <if test="taskVisible != null">taskVisible,</if>
- <if test="tid != null">tid,</if>
- </trim>
- <trim suffixOverrides="," suffix=")" prefix="values (">
- <if test="taskId != null">#{taskId},</if>
- <if test="taskNo != null">#{taskNo},</if>
- <if test="planId != null">#{planId},</if>
- <if test="blockId != null">#{blockId},</if>
- <if test="landId != null">#{landId},</if>
- <if test="cropId != null">#{cropId},</if>
- <if test="taskCreatetype != null">#{taskCreatetype},</if>
- <if test="taskType != null">#{taskType},</if>
- <if test="taskContent != null">#{taskContent},</if>
- <if test="taskPlanstartdate != null">#{taskPlanstartdate},</if>
- <if test="taskPlanenddate != null">#{taskPlanenddate},</if>
- <if test="taskAudittype != null">#{taskAudittype},</if>
- <if test="taskStatus != null">#{taskStatus},</if>
- <if test="taskManager != null">#{taskManager},</if>
- <if test="taskCreator != null">#{taskCreator},</if>
- <if test="taskCreateddate != null">#{taskCreateddate},</if>
- <if test="taskCompletedate != null">#{taskCompletedate},</if>
- <if test="taskModifieddate != null">#{taskModifieddate},</if>
- <if test="taskCompletereason != null">#{taskCompletereason},</if>
- <if test="taskAuditor != null">#{taskAuditor},</if>
- <if test="taskVisible != null">#{taskVisible},</if>
- <if test="tid != null">#{tid},</if>
- </trim>
- </insert>
- <update id="updateFmsTask" parameterType="FmsTask">
- update FmsTask
- <trim prefix="SET" suffixOverrides=",">
- <if test="taskNo != null">taskNo = #{taskNo},</if>
- <if test="planId != null">planId = #{planId},</if>
- <if test="blockId != null">blockId = #{blockId},</if>
- <if test="landId != null">landId = #{landId},</if>
- <if test="cropId != null">cropId = #{cropId},</if>
- <if test="taskCreatetype != null">taskCreatetype = #{taskCreatetype},</if>
- <if test="taskType != null">taskType = #{taskType},</if>
- <if test="taskStatus != null">taskStatus = #{taskStatus},</if>
- <if test="taskContent != null">taskContent = #{taskContent},</if>
- <if test="taskPlanstartdate != null">taskPlanstartdate = #{taskPlanstartdate},</if>
- <if test="taskPlanenddate != null">taskPlanenddate = #{taskPlanenddate},</if>
- <if test="taskAudittype != null">taskAudittype = #{taskAudittype},</if>
- <if test="taskManager != null">taskManager = #{taskManager},</if>
- <if test="taskVisible != null">taskVisible = #{taskVisible},</if>
- <if test="taskCreator != null">taskCreator = #{taskCreator},</if>
- <if test="taskCreateddate != null">taskCreateddate = #{taskCreateddate},</if>
- <if test="taskCompletedate != null">taskCompletedate = #{taskCompletedate},</if>
- <if test="taskModifieddate != null">taskModifieddate = #{taskModifieddate},</if>
- <if test="taskCompletereason != null">taskCompletereason = #{taskCompletereason},</if>
- <if test="taskAuditor != null">taskAuditor = #{taskAuditor},</if>
- <if test="tid != null">tid = #{tid},</if>
- </trim>
- where taskId = #{taskId}
- and tid = #{tid}
- </update>
- <delete id="deleteFmsTaskByTaskId" parameterType="String">
- delete from FmsTask
- where
- taskId = #{taskId}
- and tid = #{tid}
- </delete>
- <delete id="deleteFmsTaskByTaskIds" parameterType="String">
- delete from FmsTask
- where
- taskId in
- <foreach item="taskId" collection="array" open="(" separator="," close=")">
- #{taskId}
- </foreach>
- and tid = #{tid}
- </delete>
- <select id="selectTaskCountOfTaskStatus" parameterType="String" resultType="int">
- SELECT count(1) taskCount
- FROM FmsTask t
- WHERE t.taskStatus <![CDATA[ < ]]> 2
- <if test="landId != null and landId != ''">
- and t.landId = #{landId}
- </if>
- <if test="taskManager != null and taskManager != ''">
- and t.taskManager = #{taskManager}
- </if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- and t.tid = #{tid}
- </select>
- <select id="selectTaskListOfTaskStatus" parameterType="String" resultType="FmsTaskMessageResVo">
- select t.*, c.cropName, c.cropType, l.landName, b.blockName, p.planNo, p.planArea,tp.taskpatrolWay,tp.taskpatrolAddress
- from FmsTask t
- LEFT JOIN FmsCrop c on t.cropId = c.cropId
- LEFT JOIN FmsLand l ON t.landId = l.landId
- LEFT JOIN FmsBlock b ON t.blockId = b.blockId
- LEFT JOIN FmsPlan p ON t.planId = p.planId
- LEFT JOIN FmsTaskpatrol tp on tp.taskId = t.taskId
- WHERE
- t.taskStatus <![CDATA[ < ]]> 2
- and t.tid = #{tid}
- <if test="landId != null and landId != ''">
- and t.landId = #{landId}
- </if>
- <if test="taskManager != null and taskManager != ''">
- and t.taskManager =#{taskManager}
- </if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- </select>
-
- <!-- 溯源统计页面使用:成本占比(农资,农机,人工费用) -->
- <select id="selectSumTaskrcdMoney" parameterType="SelectOfTssStatReqVo" resultType="map">
- select IFNULL(sum(tb1.taskrcdCost),0) rgSum
- ,IFNULL(sum(tb1.taskrcdAssetInvestment),0) nzSum
- ,IFNULL(sum(tb1.taskrcdMachineInvestment),0) njSum
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where left(t.taskCompletedate,4)=#{startTime}
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- </select>
- <select id="selectSumTaskrcdMoneyByLandId" parameterType="SelectOfTssStatReqVo" resultType="map">
- select IFNULL(sum(tb1.taskrcdCost),0) rgSum,
- IFNULL(sum(tb1.taskrcdAssetInvestment),0) nzSum,
- IFNULL(sum(tb1.taskrcdMachineInvestment),0) njSum,
- l.landId, l.landName
- from FmsTask t
- left join (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1 on tb1.taskId = t.taskId
- left join FmsLand l on l.landId = t.landId
- where left(t.taskCompletedate,4)=#{startTime} and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- GROUP BY l.landId
- </select>
- <select id="selectSumTaskrcdMoneyByBlockId" parameterType="SelectOfTssStatReqVo" resultType="map">
- select IFNULL(sum(tb1.taskrcdCost),0) rgSum,
- IFNULL(sum(tb1.taskrcdAssetInvestment),0) nzSum,
- IFNULL(sum(tb1.taskrcdMachineInvestment),0) njSum,
- b.blockId, b.blockName
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- left join FmsBlock b on b.blockId = t.blockId
- where left(t.taskCompletedate,4)=#{startTime}
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- GROUP BY b.blockId
- </select>
-
- <!-- 溯源统计页面使用:年度分析-每月(人工) -->
- <select id="selectPayMonthByRg" parameterType="SelectOfTssStatReqVo" resultType="map">
- SELECT left(tb1.taskrcdSubmitdate,7) month
- ,IFNULL(sum(tb1.taskrcdCost),0) money
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where left(tb1.taskrcdSubmitdate,4)=#{startTime}
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- GROUP BY left(tb1.taskrcdSubmitdate,7)
- order by tb1.taskrcdSubmitdate
- </select>
-
- <!-- 溯源统计页面使用:成本占比-明细(人工) -->
- <select id="selectPayByRg" parameterType="SelectOfTssStatReqVo" resultType="SpmPayOfTssStatResVo">
- select tb1.taskrcdCost money,
- tb1.taskrcdSubmitdate time,
- '用工费用' typeName
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- <where>
- and left(t.taskCompletedate,4)=#{startTime}
- and tb1.taskrcdCost>0
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- </where>
- order by tb1.taskrcdSubmitdate desc
- </select>
-
- <!-- 溯源统计页面使用:年度分析-每月(农资) -->
- <select id="selectPayMonthByNz" parameterType="SelectOfTssStatReqVo" resultType="map">
- SELECT left(tb1.taskrcdSubmitdate,7) month
- ,IFNULL(sum(tb1.taskrcdAssetInvestment),0) money
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where left(tb1.taskrcdSubmitdate,4)=#{startTime}
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- GROUP BY left(tb1.taskrcdSubmitdate,7)
- order by tb1.taskrcdSubmitdate
- </select>
-
- <!-- 溯源统计页面使用:成本占比-明细(农资) -->
- <select id="selectPayByNz" parameterType="SelectOfTssStatReqVo" resultType="SpmPayOfTssStatResVo">
- select tb1.taskrcdAssetInvestment money,
- tb1.taskrcdSubmitdate time,
- '农资费用' typeName
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where left(t.taskCompletedate,4)=#{startTime} and tb1.taskrcdAssetInvestment>0
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- order by tb1.taskrcdSubmitdate desc
- </select>
-
- <!-- 溯源统计页面使用:年度分析-每月(农机) -->
- <select id="selectPayMonthByNj" parameterType="SelectOfTssStatReqVo" resultType="map">
- SELECT left(tb1.taskrcdSubmitdate,7) month
- ,IFNULL(sum(tb1.taskrcdMachineInvestment),0) money
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- where left(tb1.taskrcdSubmitdate,4)=#{startTime}
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- GROUP BY left(tb1.taskrcdSubmitdate,7)
- order by tb1.taskrcdSubmitdate
- </select>
-
- <!-- 溯源统计页面使用:成本占比-明细(农机) -->
- <select id="selectPayByNj" parameterType="SelectOfTssStatReqVo" resultType="SpmPayOfTssStatResVo">
- select tb1.taskrcdMachineInvestment money,
- tb1.taskrcdSubmitdate time,
- '农机费用' typeName
- from FmsTask t
- left join
- (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
- on tb1.taskId = t.taskId
- <where>
- and left(t.taskCompletedate,4)=#{startTime}
- and tb1.taskrcdMachineInvestment>0
- and t.tid = #{tid}
- <if test="landId != null and landId != ''"> and t.landId = #{landId}</if>
- <if test="taskVisible != null and taskVisible != ''">
- and t.taskVisible = #{taskVisible}
- </if>
- </where>
- order by tb1.taskrcdSubmitdate desc
- </select>
- <select id="selectFmsTaskExcelVoList" resultType="com.yunfeiyun.agmp.fms.domain.vo.FmsTaskExcelVo">
- SELECT
- ft.taskNo,
- ft.taskType,
- fl.landName,
- fb.blockName,
- fc.cropName,
- ft.taskPlanstartdate,
- ft.taskPlanenddate,
- ft.taskCreateddate,
- ftr.taskrcdCost,
- sum(ftm.taskmachInvestmentAmount) as taskmachInvestmentAmount,
- sum(fta.taskassetInvestmentAmount) as taskassetInvestmentAmount,
- ft.taskAudittype,
- ft.taskStatus,
- su.userName as taskManagername
- FROM
- FmsTask ft
- LEFT JOIN FmsLand fl ON fl.landId = ft.landId
- LEFT JOIN FmsBlock fb on fb.blockId = ft.blockId
- LEFT JOIN FmsPlan fp on fp.planId = ft.planId
- LEFT JOIn FmsCrop fc on fc.cropId = fp.cropId
- LEfT JOIn (select taskId,taskrcdId,taskrcdCost from FmsTaskrcd where taskrcdAuditstatus = '2') ftr on ftr.taskId = ft.taskId
- LEFT JOIN FmsTaskmachine ftm on ftm.taskrcdId = ftr.taskrcdId
- LEFT JOIN FmsTaskasset fta on fta.taskrcdId = ftr.taskrcdId
- LEFT JOIN SysUser su on su.userId = ft.taskManager
- <where>
- ft.tid = #{tid}
- <if test="taskNo != null and taskNo != ''"> and ft.taskNo = #{taskNo}</if>
- <if test="planId != null and planId != ''"> and ft.planId = #{planId}</if>
- <if test="planNo != null and planNo != ''"> and fp.planNo = #{planNo}</if>
- <if test="blockId != null and blockId != ''"> and ft.blockId = #{blockId}</if>
- <if test="landId != null and landId != ''"> and ft.landId = #{landId}</if>
- <if test="cropId != null and cropId != ''"> and ft.cropId = #{cropId}</if>
- <if test="taskAuditstatus != null and taskAuditstatus != ''"> and ft.taskStatus = #{taskAuditstatus}</if>
- <if test="taskAudittype != null and taskAudittype != ''"> and ft.taskAudittype = #{taskAudittype}</if>
- <if test="cropName != null and cropName != ''"> and fc.cropName = #{cropName}</if>
- <if test="taskCreatetype != null and taskCreatetype != ''"> and ft.taskCreatetype = #{taskCreatetype}</if>
- <if test="taskType != null and taskType != ''"> and ft.taskType = #{taskType}</if>
- <if test="taskType == null || taskType == ''">and ft.taskType >= 0</if>
- <if test="taskManager != null and taskManager != ''"> and ft.taskManager = #{taskManager}</if>
- <if test="taskVisible != null and taskVisible != ''">and ft.taskVisible = #{taskVisible}</if>
- <if test="startDate != null and startDate != ''">
- and ft.taskPlanenddate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and ft.taskPlanstartdate <![CDATA[ <= ]]> #{endDate}
- </if>
- <if test="taskAuditor != null and taskAuditor !=''">
- and ft.taskAuditor = #{taskAuditor}
- </if>
- <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
- AND ft.blockId in
- <foreach collection="blockIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- GROUP BY ft.taskId
- order by taskCreateddate desc
- </select>
- </mapper>
|