123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <?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.zhyc.xps.lylc.mapper.AssessStoryTargetItemMapper">
- <resultMap id="AssessStoryItemDtoResultMap" type="com.zhyc.xps.lylc.dto.AssessStoryTargetItemDto">
- <result column="story_id" property="storyId" jdbcType="BIGINT" />
- <result column="target_id" property="targetId" jdbcType="BIGINT" />
- <result column="item_id" property="itemId" jdbcType="BIGINT" />
- <result column="item_title" property="itemTitle" jdbcType="VARCHAR" />
- <result column="item_code" property="itemCode" jdbcType="VARCHAR" />
- <result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
- <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
- </resultMap>
- <sql id="AssessStoryItemDto_Cols">
- A.story_id,
- A.target_id,
- A.item_id,
- A.item_title,
- A.item_code,
- A.item_desc,
- A.sort_no
- </sql>
- <!--基于ID查询-->
- <select id="getById" resultMap="AssessStoryItemDtoResultMap">
- SELECT
- <include refid="AssessStoryItemDto_Cols"/>
- FROM assess_story_target_item AS A
- <where>
- <if test="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="targetId != null">
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- </where>
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="AssessStoryItemDtoResultMap">
- SELECT
- <include refid="AssessStoryItemDto_Cols"/>
- FROM assess_story_target_item AS A
- WHERE A.deleted_flag = 0
- <if test="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="targetId != null">
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and A.item_title like "%"#{keywords}"%"
- </if>
- ORDER BY A.story_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="AssessStoryItemDtoResultMap">
- SELECT
- <include refid="AssessStoryItemDto_Cols"/>
- FROM assess_story_target_item AS A
- WHERE A.deleted_flag = 0
- <if test="storyId != null">
- AND A.story_id = #{storyId ,jdbcType=BIGINT}
- </if>
- <if test="targetId != null">
- AND A.target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND A.item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- <if test="keywords != null and keywords != ''">
- and A.item_title like "%"#{keywords}"%"
- </if>
- </select>
- <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessStoryTargetItem">
- INSERT INTO assess_story_target_item
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="storyId != null">
- story_id,
- </if>
- <if test="targetId != null">
- target_id,
- </if>
- <if test="itemId != null">
- item_id,
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- item_title,
- </if>
- <if test="itemCode != null and itemCode != ''">
- item_code,
- </if>
- <if test="itemDesc != null and itemDesc != ''">
- item_desc,
- </if>
- <if test="sortNo != null">
- sort_no,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="storyId != null">
- #{storyId,jdbcType=BIGINT},
- </if>
- <if test="targetId != null">
- #{targetId,jdbcType=BIGINT},
- </if>
- <if test="itemId != null">
- #{itemId ,jdbcType=BIGINT},
- </if>
- <if test="itemTitle != null and itemTitle != ''">
- #{itemTitle ,jdbcType=VARCHAR},
- </if>
- <if test="itemCode != null and itemCode != ''">
- #{itemCode ,jdbcType=VARCHAR},
- </if>
- <if test="itemDesc != null and itemDesc != ''">
- #{itemDesc ,jdbcType=VARCHAR},
- </if>
- <if test="sortNo != null">
- #{sortNo ,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy ,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt ,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.lylc.entity.AssessStoryTargetItem">
- UPDATE assess_story_target_item
- <trim suffixOverrides=",">
- <set>
- <if test="itemTitle != null and itemTitle != ''">
- item_title = #{itemTitle, jdbcType=VARCHAR},
- </if>
- <if test="itemCode != null and itemCode != ''">
- item_code = #{itemCode ,jdbcType=VARCHAR},
- </if>
- <if test="itemDesc != null and itemDesc != ''">
- item_desc = #{itemDesc, jdbcType=VARCHAR},
- </if>
- <if test="sortNo != null">
- sort_no = #{sortNo ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null ">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE story_id = #{storyId ,jdbcType=BIGINT}
- AND target_id = #{targetId ,jdbcType=BIGINT}
- AND item_id = #{itemId ,jdbcType=BIGINT}
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE assess_story_target_item
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag,jdbcType=BIGINT},
- </if>
- <if test="deletedTime != null">
- deleted_time = #{deletedTime,jdbcType=TIMESTAMP},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE story_id = #{storyId ,jdbcType=BIGINT}
- <if test="targetId != null">
- AND target_id = #{targetId ,jdbcType=BIGINT}
- </if>
- <if test="itemId != null">
- AND item_id = #{itemId ,jdbcType=BIGINT}
- </if>
- </update>
- </mapper>
|