| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- <?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.sale.MultiOwnerMapper">
- <!-- 通用设置 -->
- <!-- 通用查询列 -->
- <sql id="Base_Column_List">
- multi_id, order_id, owner_type, owner_id, allocation_ratio, flg_valid, cp_id
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.sale.MultiOwner">
- <id column="multi_id" property="multiId"/>
- <result column="order_id" property="orderId" typeHandler="UuidTypeHandler"/>
- <result column="owner_type" property="ownerType"/>
- <result column="owner_id" property="ownerId" typeHandler="UuidTypeHandler"/>
- <result column="allocation_ratio" property="allocationRatio"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition">
- <where>
- <if test="orderId != null and orderId != ''">
- AND order_id = #{orderId}
- </if>
- <if test="ownerType != null and ownerType != ''">
- AND owner_type = #{ownerType}
- </if>
- <if test="ownerId != null and ownerId != ''">
- AND owner_id = #{ownerId}
- </if>
- <if test="allocationRatio != null">
- AND allocation_ratio = #{allocationRatio}
- </if>
- <if test="flgValid != null">
- AND flg_valid = #{flgValid}
- </if>
- <if test="cpId != null">
- AND cp_id = #{cpId}
- </if>
- </where>
- </sql>
- <sql id="idsForeach">
- <!-- 根据主键multiId批量操作 -->
- WHERE multi_id in
- <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </sql>
- <!-- 查询表t_psi_multi_owner,(条件查询+分页)列表 -->
- <select id="selectByCond" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_psi_multi_owner
- <include refid="Condition"/>
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 查询表t_psi_multi_owner,(条件查询)个数 -->
- <select id="countByCond" resultType="Long">
- SELECT
- count(1)
- FROM dkic_b.t_psi_multi_owner
- <include refid="Condition"/>
- </select>
- <!-- 根据主键查询表t_psi_multi_owner的一行数据 -->
- <select id="selectById" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_psi_multi_owner
- WHERE multi_id = #{id}::uuid
- </select>
- <!-- 根据主键锁定表t_psi_multi_owner的一行数据 -->
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_psi_multi_owner
- WHERE multi_id = #{id}::uuid
- for update
- </select>
- <!-- 根据主键锁定表t_psi_multi_owner的多行数据 -->
- <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_psi_multi_owner
- <include refid="idsForeach"/>
- for update
- </select>
- <insert id="insertBatch">
- insert into dkic_b.t_psi_multi_owner
- (
- <trim suffixOverrides=",">
- order_id,
- owner_type,
- owner_id,
- allocation_ratio,
- cp_id,
- op_app_code,
- </trim>
- )
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- <trim suffixOverrides=",">
- #{item.orderId}::uuid,
- #{item.ownerType},
- #{item.ownerId}::uuid,
- #{item.allocationRatio},
- #{item.cpId},
- #{item.opAppCode},
- </trim>
- )
- </foreach>
- </insert>
- <delete id="deleteByOrderId">
- DELETE FROM dkic_b.t_psi_multi_owner WHERE order_id = #{orderId}::uuid
- </delete>
- </mapper>
|