| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <?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.FmsMachMapper">
- <sql id="selectFmsMachVo">
- select machId, machType, machName, machNo, machBrand, machSpec, machBuydate, machUsestatus, machOwnername, machOwnermobile from FmsMach
- </sql>
- <select id="selectFmsMachList" parameterType="FmsMachListReqVo" resultType="FmsMach">
- <include refid="selectFmsMachVo"/>
- <where>
- machSystype = '0'
- <if test="machType != null and machType != ''"> and machType = #{machType}</if>
- <if test="machName != null and machName != ''"> and machName like concat('%', #{machName}, '%')</if>
- <if test="machBrand != null and machBrand != ''"> and machBrand like concat('%', #{machBrand}, '%')</if>
- <if test="machUsestatus != null and machUsestatus != ''"> and machUsestatus = #{machUsestatus}</if>
- <if test="tid != null and tid !='' and tid != '-1'">
- and tid = #{tid}
- </if>
- </where>
- ORDER BY machId DESC
- </select>
-
- <select id="selectFmsMachByMachId" parameterType="String" resultType="FmsMach">
- <include refid="selectFmsMachVo"/>
- where machId = #{machId} and machSystype = '0'
- <if test="tid != null and tid !='' and tid != '-1'">
- and tid = #{tid}
- </if>
- </select>
- <select id="selectFmsMachByMachNo" parameterType="String" resultType="FmsMach">
- <include refid="selectFmsMachVo"/>
- where machNo = #{machNo} and machSystype = '0'
- <if test="tid != null and tid !='' and tid != '-1'">
- and tid = #{tid}
- </if>
- </select>
- <select id="selectFmsMachRecordList" parameterType="FmsMachRecordListReqVo" resultType="FmsMachRecordListResVo">
- SELECT ma.machName, ma.machType, p.planNo, t.taskId, t.taskNo, c.cropName, c.cropType, c.cropMaintype, m.taskmachUsedcount,
- ma.machNo, ma.machSpec, tc.taskrcdId, tc.taskrcdCompletedate, t.taskManager, u.userName AS taskManagername,
- t.taskType
- FROM FmsTaskmachine AS m
- JOIN FmsTaskrcd AS tc ON m.taskrcdId = tc.taskrcdId AND tc.taskrcdAuditstatus = #{taskrcdAuditstatus}
- JOIN FmsTask AS t ON tc.taskId = t.taskId
- JOIN FmsCrop AS c ON t.cropId = c.cropId
- JOIN FmsMach AS ma ON m.machId = ma.machId
- JOIN SysUser AS u ON t.taskManager = u.userId
- JOIN FmsPlan AS p ON p.planId = t.planId
- <where>
- machSystype = '0'
- <if test="machType != null and machType != ''"> and machType = #{machType}</if>
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="machName != null and machName != ''"> and machName like concat('%', #{machName}, '%')</if>
- <if test="planNo != null and planNo != ''"> and p.planNo like concat('%', #{planNo}, '%')</if>
- <if test="taskNo != null and taskNo != ''"> and t.taskNo like concat('%', #{taskNo}, '%')</if>
- <if test="cropName != null and cropName != ''"> and c.cropName like concat('%', #{cropName}, '%')</if>
- <if test="taskManagername != null and taskManagername != ''"> and u.userName like concat('%', #{taskManagername}, '%')</if>
- <if test="startDate != null and startDate != ''">
- and tc.taskrcdCompletedate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and tc.taskrcdCompletedate <![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="tid != null and tid !='' and tid != '-1'">
- and m.tid = #{tid}
- </if>
- </where>
- ORDER BY tc.taskrcdCompletedate DESC
- </select>
- <select id="selectFmsMachRecordExcelVoList"
- resultType="com.yunfeiyun.agmp.fms.domain.vo.FmsMachRecordExcelVo">
- SELECT
- ma.machName,
- ma.machType,
- t.taskNo,
- c.cropName,
- c.cropType,
- m.taskmachUsedcount,
- ma.machNo,
- ma.machSpec,
- tc.taskrcdCompletedate,
- m.taskmachInvestmentAmount,
- u.userName AS taskManagername
- FROM
- FmsTaskmachine AS m
- JOIN FmsTaskrcd AS tc ON m.taskrcdId = tc.taskrcdId
- JOIN FmsTask AS t ON tc.taskId = t.taskId
- JOIN FmsCrop AS c ON t.cropId = c.cropId
- JOIN FmsMach AS ma ON m.machId = ma.machId
- JOIN SysUser AS u ON t.taskManager = u.userId
- JOIN FmsPlan AS p ON p.planId = t.planId
- <where>
- tc.taskrcdAuditstatus = '2' and machSystype = '0'
- <if test="machType != null and machType != ''"> and machType = #{machType}</if>
- <if test="blockId != null and blockId != ''"> and t.blockId = #{blockId}</if>
- <if test="machName != null and machName != ''"> and machName like concat('%', #{machName}, '%')</if>
- <if test="planNo != null and planNo != ''"> and p.planNo like concat('%', #{planNo}, '%')</if>
- <if test="taskNo != null and taskNo != ''"> and t.taskNo like concat('%', #{taskNo}, '%')</if>
- <if test="cropName != null and cropName != ''"> and c.cropName like concat('%', #{cropName}, '%')</if>
- <if test="taskManagername != null and taskManagername != ''"> and u.userName like concat('%', #{taskManagername}, '%')</if>
- <if test="startDate != null and startDate != ''">
- and tc.taskrcdCompletedate >= #{startDate}
- </if>
- <if test="endDate != null and endDate != ''">
- and tc.taskrcdCompletedate <![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="tid != null and tid !='' and tid != '-1'">
- and m.tid = #{tid}
- </if>
- </where>
- ORDER BY tc.taskrcdCompletedate DESC
- </select>
- <select id="selectFmsMachExcelVoList" resultType="com.yunfeiyun.agmp.fms.domain.vo.FmsMachExcelVo">
- select machId, machType, machName, machNo, machBrand, machSpec, machBuydate, machUsestatus, machOwnername, machOwnermobile from FmsMach
- <where>
- machSystype = '0'
- <if test="machType != null and machType != ''"> and machType = #{machType}</if>
- <if test="machName != null and machName != ''"> and machName like concat('%', #{machName}, '%')</if>
- <if test="machBrand != null and machBrand != ''"> and machBrand like concat('%', #{machBrand}, '%')</if>
- <if test="machUsestatus != null and machUsestatus != ''"> and machUsestatus = #{machUsestatus}</if>
- <if test="tid != null and tid !='' and tid != '-1'">
- and tid = #{tid}
- </if>
- </where>
- ORDER BY machId DESC
- </select>
- <select id="selectFmsMachTypeStat" resultType="com.yunfeiyun.agmp.fms.domain.resvo.FmsMachTypeStatResVo">
- SELECT
- machType,
- IFNULL( count( machType ), 0 ) AS num
- FROM FmsMach
- <where>
- machSystype = '0' and tid = #{tid}
- </where>
- GROUP BY machType
- </select>
- <select id="selectFmsMachSum" resultType="BigDecimal">
- select count(1) count from FmsMach
- <where>
- machSystype = '0'
- <if test="tid != null and tid !='' and tid != '-1'">
- and tid = #{tid}
- </if>
- </where>
- </select>
- <insert id="insertFmsMach" parameterType="FmsMach">
- insert into FmsMach
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="machId != null">machId,</if>
- <if test="machType != null">machType,</if>
- <if test="machName != null">machName,</if>
- <if test="machNo != null">machNo,</if>
- <if test="machBrand != null">machBrand,</if>
- <if test="machSpec != null">machSpec,</if>
- <if test="machBuydate != null">machBuydate,</if>
- <if test="machUsestatus != null">machUsestatus,</if>
- <if test="machOwnername != null">machOwnername,</if>
- <if test="machOwnermobile != null">machOwnermobile,</if>
- machSystype,
- tid
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="machId != null">#{machId},</if>
- <if test="machType != null">#{machType},</if>
- <if test="machName != null">#{machName},</if>
- <if test="machNo != null">#{machNo},</if>
- <if test="machBrand != null">#{machBrand},</if>
- <if test="machSpec != null">#{machSpec},</if>
- <if test="machBuydate != null">#{machBuydate},</if>
- <if test="machUsestatus != null">#{machUsestatus},</if>
- <if test="machOwnername != null">#{machOwnername},</if>
- <if test="machOwnermobile != null">#{machOwnermobile},</if>
- '0',
- #{tid}
- </trim>
- </insert>
- <update id="updateFmsMach" parameterType="FmsMach">
- update FmsMach
- <trim prefix="SET" suffixOverrides=",">
- <if test="machType != null">machType = #{machType},</if>
- <if test="machName != null">machName = #{machName},</if>
- <if test="machNo != null">machNo = #{machNo},</if>
- <if test="machBrand != null">machBrand = #{machBrand},</if>
- <if test="machSpec != null">machSpec = #{machSpec},</if>
- <if test="machBuydate != null">machBuydate = #{machBuydate},</if>
- <if test="machUsestatus != null">machUsestatus = #{machUsestatus},</if>
- <if test="machOwnername != null">machOwnername = #{machOwnername},</if>
- <if test="machOwnermobile != null">machOwnermobile = #{machOwnermobile},</if>
- <if test="tid != null">tid = #{tid},</if>
- </trim>
- where machId = #{machId} and machSystype = '0' and tid = #{tid}
- </update>
- <delete id="deleteFmsMachByMachId" parameterType="String">
- delete from FmsMach where machId = #{machId} and machSystype = '0' and tid = #{tid}
- </delete>
- <delete id="deleteFmsMachByMachIds" parameterType="String">
- delete from FmsMach where machSystype = '0' and tid = #{tid} and machId in
- <foreach item="machId" collection="array" open="(" separator="," close=")">
- #{machId}
- </foreach>
- </delete>
- </mapper>
|