| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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.FmsCropMapper">
- <sql id="selectFmsCropVo">
- select cropId, cropName, cropType, cropMaintype, cropRcmdstatus, cropRemark, cropCreator, cropCreateddate, cropInitialvalue,tid,cropProduction from FmsCrop
- </sql>
- <sql id="selectFmsCropHasResVo">
- select c.*,
- (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 FmsCrop c
- </sql>
- <select id="selectFmsCropList" parameterType="FmsCrop" resultType="FmsCropResVo">
- SELECT
- cropId,
- cropName,
- cropType,
- cropMaintype,
- cropRcmdstatus,
- cropRemark,
- cropCreator,
- cropCreateddate,
- cropInitialvalue,
- cropProduction,
- tid,
- ( SELECT count( 1 ) FROM FmsPeriod p WHERE p.cropId = c.cropId ) count,
- ( SELECT sum( periodDays ) FROM FmsPeriod p WHERE p.cropId = c.cropId ) periodDays,
- (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 GROUP_CONCAT(resUrl) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP_VIDEO') cropVideo,
- (select GROUP_CONCAT(resId) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP_VIDEO') videoIds
- FROM
- FmsCrop c
- <where>
- tid = #{tid}
- <if test="cropName != null and cropName != ''"> and c.cropName = #{cropName}</if>
- <if test="cropType != null and cropType != ''"> and c.cropType = #{cropType}</if>
- <if test="cropMaintype != null and cropMaintype != ''"> and c.cropMaintype = #{cropMaintype}</if>
- <if test="cropRcmdstatus != null and cropRcmdstatus != ''"> and c.cropRcmdstatus = #{cropRcmdstatus}</if>
- <if test="cropRemark != null and cropRemark != ''"> and c.cropRemark = #{cropRemark}</if>
- </where>
- order by c.cropCreateddate desc
- </select>
-
- <select id="selectFmsCropByCropId" parameterType="String" resultType="FmsCrop">
- <include refid="selectFmsCropHasResVo"/>
- <where>
- cropId = #{cropId}
- and tid = #{tid}
- </where>
- </select>
- <select id="selectFmsCropNameByCropMaintype" parameterType="String" resultType="FmsCrop">
- select cropName from FmsCrop
- where cropRcmdstatus = '0'
- <if test="cropMaintype != null and cropMaintype != ''"> and cropMaintype = #{cropMaintype}</if>
- and tid = #{tid}
- group by cropName
- </select>
- <select id="selectFmsCropNameByBlockId" parameterType="String" resultType="FmsBlockCropDto">
- SELECT c.cropName, c.cropType, p.blockId, r.resUrl as cropPreview
- FROM FmsPlan p
- LEFT JOIN FmsCrop c ON p.cropId = c.cropId
- left join SysRes r on r.resBusId = c.cropId and r.resBiztype = 'CROP'
- where p.blockId in
- <foreach item="blockId" collection="array" open="(" separator="," close=")">
- #{blockId}
- </foreach>
- and p.planStatus != '2'
- and p.tid = #{tid}
- </select>
-
- <insert id="insertFmsCrop" parameterType="FmsCrop">
- insert into FmsCrop
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="cropId != null">cropId,</if>
- <if test="cropName != null">cropName,</if>
- <if test="cropType != null">cropType,</if>
- <if test="cropMaintype != null">cropMaintype,</if>
- <if test="cropRcmdstatus != null">cropRcmdstatus,</if>
- <if test="cropRemark != null">cropRemark,</if>
- <if test="cropCreator != null">cropCreator,</if>
- <if test="cropCreateddate != null">cropCreateddate,</if>
- <if test="cropInitialvalue != null">cropInitialvalue,</if>
- <if test="cropProduction != null">cropProduction,</if>
- <if test="tid != null">tid,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="cropId != null">#{cropId},</if>
- <if test="cropName != null">#{cropName},</if>
- <if test="cropType != null">#{cropType},</if>
- <if test="cropMaintype != null">#{cropMaintype},</if>
- <if test="cropRcmdstatus != null">#{cropRcmdstatus},</if>
- <if test="cropRemark != null">#{cropRemark},</if>
- <if test="cropCreator != null">#{cropCreator},</if>
- <if test="cropCreateddate != null">#{cropCreateddate},</if>
- <if test="cropInitialvalue != null">#{cropInitialvalue},</if>
- <if test="cropProduction != null">#{cropProduction},</if>
- <if test="tid != null">#{tid},</if>
- </trim>
- </insert>
- <update id="updateFmsCrop" parameterType="FmsCrop">
- update FmsCrop
- <trim prefix="SET" suffixOverrides=",">
- <if test="cropName != null">cropName = #{cropName},</if>
- <if test="cropType != null">cropType = #{cropType},</if>
- <if test="cropMaintype != null">cropMaintype = #{cropMaintype},</if>
- <if test="cropRcmdstatus != null">cropRcmdstatus = #{cropRcmdstatus},</if>
- <if test="cropRemark != null">cropRemark = #{cropRemark},</if>
- <if test="cropCreator != null">cropCreator = #{cropCreator},</if>
- <if test="cropCreateddate != null">cropCreateddate = #{cropCreateddate},</if>
- <if test="cropInitialvalue != null">cropInitialvalue = #{cropInitialvalue},</if>
- <if test="cropProduction != null">cropProduction = #{cropProduction},</if>
- <if test="tid != null">tid = #{tid},</if>
- </trim>
- where cropId = #{cropId} and tid = #{tid}
- </update>
- <delete id="deleteFmsCropByCropId" parameterType="String">
- delete from FmsCrop where cropId = #{cropId}
- and tid = #{tid}
- </delete>
- <delete id="deleteFmsCropByCropIds" parameterType="String">
- delete from FmsCrop where cropId in
- <foreach item="cropId" collection="array" open="(" separator="," close=")">
- #{cropId}
- </foreach>
- and tid = #{tid}
- </delete>
- <select id="selectFmsCropListByCropIds" resultType="com.yunfeiyun.agmp.fms.domain.FmsCrop">
- <include refid="selectFmsCropVo"/>
- <where>
- tid = #{tid}
- <if test="cropIds != null and cropIds.size() != 0">
- and cropId in
- <foreach collection="cropIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- </mapper>
|