| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <?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.dk.mdm.mapper.mst.IntegralShareMapper">
- <!-- 通用设置 -->
- <!-- 通用查询列 -->
- <sql id="Base_Column_List">
- share_id,cp_id, tactic_id, share_date, end_date,integral_type, flg_valid,user_id
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.IntegralShare">
- <id column="share_id" property="shareId"/>
- <result column="cp_id" property="cpId"/>
- <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
- <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
- <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
- <result column="integral_type" property="integralType"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="user_id" property="userId"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition">
- <where>
- <if test="tacticId != null and tacticId != ''">
- AND tactic_id = #{tacticId}
- </if>
- <if test="shareDate != null">
- AND share_date = #{shareDate}
- </if>
- <if test="endDate != null">
- AND end_date = #{endDate}
- </if>
- <if test="flgValid != null">
- AND flg_valid = #{flgValid}
- </if>
- <if test="userId != null">
- AND user_id = #{userId}
- </if>
- </where>
- </sql>
- <!-- 通用查询列 -->
- <sql id="Base_Column_List_list">
- share_id,cp_id, tactic_id, share_date, end_date,integral_type, flg_valid,user_id
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap_list" type="com.dk.mdm.model.response.mst.IntegralShareResponse">
- <id column="share_id" property="shareId"/>
- <result column="cp_id" property="cpId"/>
- <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
- <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
- <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
- <result column="integral_type" property="integralType"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="user_id" property="userId"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition_list">
- <where>
- <if test="shareId != null and shareId != ''">
- AND share_id = #{shareId}::uuid
- </if>
- <if test="cpId != null and cpId != ''">
- AND cp_id = #{cpId}
- </if>
- <if test="tacticId != null and tacticId != ''">
- AND tactic_id = #{tacticId}
- </if>
- <if test="shareDate != null">
- AND share_date = #{shareDate}
- </if>
- <if test="endDate != null">
- AND end_date = #{endDate}
- </if>
- <if test="flgValid != null">
- AND flg_valid = #{flgValid}
- </if>
- <if test="userId != null">
- AND user_id = #{userId}
- </if>
- </where>
- </sql>
- <sql id="idsForeach">
- <!-- 根据主键cpId批量操作 -->
- WHERE cp_id in
- <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </sql>
- <!-- 查询表dkic_a.t_mst_integral_share,(条件查询+分页)列表 -->
- <select id="selectByCond" resultMap="BaseResultMap_list">
- SELECT
- <include refid="Base_Column_List_list"/>
- FROM dkic_a.t_mst_integral_share
- <include refid="Condition_list"/>
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 查询表dkic_a.t_mst_integral_share,(条件查询)个数 -->
- <select id="countByCond" resultType="Long">
- SELECT
- count(1)
- FROM dkic_a.t_mst_integral_share
- <include refid="Condition_list"/>
- </select>
- <!-- 根据主键锁定表dkic_a.t_mst_integral_share的一行数据 -->
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_a.t_mst_integral_share
- WHERE cp_id = #{cpId}
- for update
- </select>
- <!-- 根据主键锁定表dkic_a.t_mst_integral_share的多行数据 -->
- <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_a.t_mst_integral_share
- <include refid="idsForeach"/>
- for update
- </select>
- <insert id="insertBatch">
- insert into dkic_a.t_mst_integral_share
- (
- <trim suffixOverrides=",">
- tactic_id,
- share_date,
- end_date,
- </trim>
- )
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- <trim suffixOverrides=",">
- #{item.tacticId}::uuid,
- #{item.shareDate},
- #{item.endDate},
- </trim>
- )
- </foreach>
- </insert>
- </mapper>
|