|
|
@@ -5,27 +5,31 @@
|
|
|
<!-- 通用设置 -->
|
|
|
<!-- 通用查询列 -->
|
|
|
<sql id="Base_Column_List">
|
|
|
- cp_id, coupon_id, use_valid_days, receive_date, use_date, coupon_status, receive_user, flg_valid
|
|
|
+ use_id, cp_id, send_id, coupon_id, use_valid_days, receive_date, use_date, coupon_status, receive_user, flg_valid
|
|
|
</sql>
|
|
|
<!-- 通用查询列Response -->
|
|
|
<sql id="Base_Column_List_Response">
|
|
|
- tmcu.cp_id, tmcu.coupon_id, tmcu.use_valid_days, tmcu.receive_date, tmcu.use_date, tmcu.coupon_status, tmcu.receive_user, tmcu.flg_valid
|
|
|
+ tmcu.use_id, tmcu.cp_id, tmcu.send_id, tmcu.coupon_id, tmcu.use_valid_days, tmcu.receive_date, tmcu.use_date, tmcu.coupon_status, tmcu.receive_user, tmcu.flg_valid
|
|
|
</sql>
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponUse">
|
|
|
- <id column="cp_id" property="cpId" />
|
|
|
- <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
|
|
|
- <result column="use_valid_days" property="useValidDays"/>
|
|
|
- <result column="receive_date" property="receiveDate" typeHandler="TimestampTypeHandler"/>
|
|
|
- <result column="use_date" property="useDate" typeHandler="TimestampTypeHandler"/>
|
|
|
- <result column="coupon_status" property="couponStatus"/>
|
|
|
- <result column="receive_user" property="receiveUser" typeHandler="UuidTypeHandler"/>
|
|
|
- <result column="flg_valid" property="flgValid"/>
|
|
|
+ <id column="use_id" property="useId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
+ <result column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="use_valid_days" property="useValidDays"/>
|
|
|
+ <result column="receive_date" property="receiveDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="use_date" property="useDate" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="coupon_status" property="couponStatus"/>
|
|
|
+ <result column="receive_user" property="receiveUser" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="flg_valid" property="flgValid"/>
|
|
|
</resultMap>
|
|
|
<!-- 通用查询映射结果Response -->
|
|
|
<resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponUseResponse">
|
|
|
- <id column="cp_id" property="cpId" />
|
|
|
+ <id column="use_id" property="useId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
+ <result column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
|
|
|
<result column="cp_name" property="cpName"/>
|
|
|
<result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
|
|
|
<result column="coupon_name" property="couponName" />
|
|
|
@@ -41,6 +45,12 @@
|
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
|
<where>
|
|
|
+ <if test="cpId != null and cpId != ''">
|
|
|
+ AND tmcu.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
+ <if test="sendId != null and sendId != ''">
|
|
|
+ AND tmcu.send_id = #{sendId}::uuid
|
|
|
+ </if>
|
|
|
<if test="couponId != null and couponId != ''">
|
|
|
AND tmcu.coupon_id = #{couponId}::uuid
|
|
|
</if>
|
|
|
@@ -73,7 +83,7 @@
|
|
|
|
|
|
<sql id="idsForeach">
|
|
|
<!-- 根据主键cpId批量操作 -->
|
|
|
- WHERE cp_id in
|
|
|
+ WHERE use_id in
|
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
@@ -113,7 +123,7 @@
|
|
|
FROM dkic_a.t_mst_coupon_use tmcu
|
|
|
left join dkic_a.t_mst_coupon tmc on tmc.coupon_id = tmcu.coupon_id
|
|
|
left join dkic_a.t_a_company tac on tac.cp_id = tmcu.cp_id
|
|
|
- WHERE cp_id = #{id}
|
|
|
+ WHERE use_id = #{id}
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据主键锁定表t_mst_coupon_use的一行数据 -->
|
|
|
@@ -121,7 +131,7 @@
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
FROM dkic_a.t_mst_coupon_use
|
|
|
- WHERE cp_id = #{cpId}
|
|
|
+ WHERE use_id = #{useId}
|
|
|
for update
|
|
|
</select>
|
|
|
|
|
|
@@ -138,7 +148,9 @@
|
|
|
insert into dkic_a.t_mst_coupon_use
|
|
|
(
|
|
|
<trim suffixOverrides=",">
|
|
|
+ cp_id,
|
|
|
coupon_id,
|
|
|
+ send_id,
|
|
|
use_valid_days,
|
|
|
receive_date,
|
|
|
use_date,
|
|
|
@@ -150,6 +162,8 @@
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
(
|
|
|
<trim suffixOverrides=",">
|
|
|
+ #{item.cpId},
|
|
|
+ #{item.sendId}::uuid,
|
|
|
#{item.couponId}::uuid,
|
|
|
#{item.useValidDays},
|
|
|
#{item.receiveDate},
|