|
|
@@ -5,36 +5,44 @@
|
|
|
<!-- 通用设置 -->
|
|
|
<!-- 通用查询列 -->
|
|
|
<sql id="Base_Column_List">
|
|
|
- cp_id, user_id, tactic_id, share_date, end_date, flg_valid
|
|
|
+ share_id, cp_id, user_id, tactic_id, share_date, end_date, flg_valid,integral_type
|
|
|
</sql>
|
|
|
<!-- 通用查询列Response -->
|
|
|
<sql id="Base_Column_List_Response">
|
|
|
- tmis.cp_id, tmis.user_id, tmis.tactic_id, tmis.share_date, tmis.end_date, tmis.flg_valid
|
|
|
+ tmis.share_id, tmis.cp_id, tmis.user_id, tmis.tactic_id, tmis.share_date, tmis.end_date, tmis.flg_valid,tmis.integral_type
|
|
|
</sql>
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.IntegralShare">
|
|
|
- <id column="cp_id" property="cpId"/>
|
|
|
+ <id column="share_id" property="shareId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
<result column="user_id" property="userId" typeHandler="UuidTypeHandler"/>
|
|
|
<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="flg_valid" property="flgValid"/>
|
|
|
+ <result column="integral_type" property="integralType"/>
|
|
|
</resultMap>
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.IntegralShareResponse">
|
|
|
- <id column="cp_id" property="cpId" />
|
|
|
+ <id column="share_id" property="shareId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="cp_id" property="cpId"/>
|
|
|
<result column="user_id" property="userId" typeHandler="UuidTypeHandler"/>
|
|
|
<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="flg_valid" property="flgValid"/>
|
|
|
<result column="cp_name" property="cpName"/>
|
|
|
+ <result column="integral_type" property="integralType"/>
|
|
|
+ <result column="integral_type_name" property="integralTypeName"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用条件列 -->
|
|
|
<sql id="Condition">
|
|
|
<where>
|
|
|
+ <if test="cpId != null and cpId != ''">
|
|
|
+ AND tmis.cp_id = #{cpId}
|
|
|
+ </if>
|
|
|
<if test="tacticId != null and tacticId != ''">
|
|
|
AND tmis.tactic_id = #{tacticId}::uuid
|
|
|
</if>
|
|
|
@@ -50,12 +58,18 @@
|
|
|
<if test="flgValid != null">
|
|
|
AND tmis.flg_valid = #{flgValid}
|
|
|
</if>
|
|
|
+ <if test="shareDateFlag != null and shareDateFlag ">
|
|
|
+ AND tmis.share_date >= NOW() - INTERVAL '1 DAY'
|
|
|
+ </if>
|
|
|
+ <if test="integralType != null and integralType != ''">
|
|
|
+ AND tmis.integral_type = #{integralType}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
|
|
|
<sql id="idsForeach">
|
|
|
<!-- 根据主键cpId批量操作 -->
|
|
|
- WHERE cp_id in
|
|
|
+ WHERE share_id in
|
|
|
<foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
@@ -66,8 +80,10 @@
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List_Response"/>
|
|
|
,tac.cp_name
|
|
|
+ ,sys.f_get_name_i18n(tdk.kind_name_i18n,#{i18n}) as integral_type_name
|
|
|
FROM dkic_a.t_mst_integral_share tmis
|
|
|
left join dkic_a.t_a_company tac on tac.cp_id = tmis.cp_id
|
|
|
+ LEFT JOIN sys.t_data_kind tdk ON tmis.integral_type = tdk.kind_code
|
|
|
<include refid="Condition"/>
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
@@ -80,6 +96,7 @@
|
|
|
count(1)
|
|
|
FROM dkic_a.t_mst_integral_share tmis
|
|
|
left join dkic_a.t_a_company tac on tac.cp_id = tmis.cp_id
|
|
|
+ LEFT JOIN sys.t_data_kind tdk ON tmis.integral_type = tdk.kind_code
|
|
|
<include refid="Condition"/>
|
|
|
</select>
|
|
|
|
|
|
@@ -88,9 +105,11 @@
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List_Response"/>
|
|
|
,tac.cp_name
|
|
|
+ ,sys.f_get_name_i18n(tdk.kind_name_i18n,#{i18n}) as integral_type_name
|
|
|
FROM dkic_a.t_mst_integral_share tmis
|
|
|
left join dkic_a.t_a_company tac on tac.cp_id = tmis.cp_id
|
|
|
- WHERE cp_id = #{cpId}
|
|
|
+ LEFT JOIN sys.t_data_kind tdk ON tmis.integral_type = tdk.kind_code
|
|
|
+ WHERE share_id = #{id}::uuid
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据主键锁定表dkic_a.t_mst_integral_share的一行数据 -->
|
|
|
@@ -98,7 +117,7 @@
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
FROM dkic_a.t_mst_integral_share
|
|
|
- WHERE cp_id = #{id}
|
|
|
+ WHERE share_id = #{shareId}::uuid
|
|
|
for update
|
|
|
</select>
|
|
|
|
|
|
@@ -119,6 +138,8 @@
|
|
|
share_date,
|
|
|
end_date,
|
|
|
user_id,
|
|
|
+ cp_id,
|
|
|
+ integral_type,
|
|
|
</trim>
|
|
|
)
|
|
|
values
|
|
|
@@ -129,6 +150,8 @@
|
|
|
#{item.shareDate},
|
|
|
#{item.endDate},
|
|
|
#{item.userId}::uuid,
|
|
|
+ #{item.cpId},
|
|
|
+ #{item.integralType},
|
|
|
</trim>
|
|
|
)
|
|
|
</foreach>
|