|
@@ -16,8 +16,8 @@
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
|
- id_
|
|
|
- , account_id_, trans_amount_, in_or_out_, post_status_, biz_type_, biz_id_, memo_, order_no_, create_time_, update_time_
|
|
|
+ id_,
|
|
|
+ account_id_, trans_amount_, in_or_out_, post_status_, biz_type_, biz_id_, memo_, order_no_, create_time_, update_time_
|
|
|
</sql>
|
|
|
|
|
|
<insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
|
|
@@ -59,184 +59,79 @@
|
|
|
<if test="param.status">
|
|
|
post_status_ = #{param.status}
|
|
|
</if>
|
|
|
- <if test="param.startDate">
|
|
|
- update_time_ >= #{param.startDate}
|
|
|
- </if>
|
|
|
- <if test="param.endDate">
|
|
|
- update_time_ <= #{param.endDate}
|
|
|
- </if>
|
|
|
update_time_ = NOW()
|
|
|
</set>
|
|
|
- WHERE
|
|
|
- id_ = #{param.id}
|
|
|
+ WHERE id_ = #{param.id}
|
|
|
</foreach>
|
|
|
</update>
|
|
|
-
|
|
|
- <select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
|
|
|
- select * from platform_cash_account_record
|
|
|
- <where>
|
|
|
- <if test="param.orderNo">
|
|
|
- and order_no_ = #{param.orderNo}
|
|
|
- </if>
|
|
|
- <if test="param.bizId">
|
|
|
- and biz_id_ = #{param.bizId}
|
|
|
- </if>
|
|
|
- <if test="param.inOrOut">
|
|
|
- and in_or_out_ = #{param.inOrOut}
|
|
|
- </if>
|
|
|
- <if test="param.bizType">
|
|
|
- and biz_type_ = #{param.bizType}
|
|
|
- </if>
|
|
|
- <if test="param.status">
|
|
|
- and post_status_ = #{param.status}
|
|
|
- </if>
|
|
|
- <if test="param.startDate">
|
|
|
- and update_time_ >= #{param.startDate}
|
|
|
- </if>
|
|
|
- <if test="param.endDate">
|
|
|
- and update_time_ <= #{param.endDate}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="querySummary" resultType="com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo">
|
|
|
- select
|
|
|
- sum(case when in_or_out_ = 'IN' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancesReceived,
|
|
|
- sum(case when in_or_out_ = 'IN' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledReceived,
|
|
|
- sum(case when in_or_out_ = 'OUT' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancePayment,
|
|
|
- sum(case when in_or_out_ = 'OUT' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledPayment
|
|
|
- from platform_cash_account_record
|
|
|
- <where>
|
|
|
- <if test="param.orderNo">
|
|
|
- and order_no_ = #{param.orderNo}
|
|
|
- </if>
|
|
|
- <if test="param.bizId">
|
|
|
- and biz_id_ = #{param.bizId}
|
|
|
- </if>
|
|
|
- <if test="param.inOrOut">
|
|
|
- and in_or_out_ = #{param.inOrOut}
|
|
|
- </if>
|
|
|
- <if test="param.bizType">
|
|
|
- and biz_type_ = #{param.bizType}
|
|
|
- </if>
|
|
|
- <if test="param.status">
|
|
|
- and post_status_ = #{param.status}
|
|
|
- </if>
|
|
|
- <if test="param.startDate">
|
|
|
- and update_time_ >= #{param.startDate}
|
|
|
- </if>
|
|
|
- <if test="param.endDate">
|
|
|
- and update_time_ <= #{param.endDate}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="queryByBizTypeAndPaymentDays" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
|
|
|
- select * from platform_cash_account_record where biz_type_ = #{bizType} and TIMESTAMPDIFF(HOUR, create_time_, now()) >= ${24 * paymentDays} and post_status_ = 'WAIT'
|
|
|
- </select>
|
|
|
|
|
|
- <update id="batchUpdate">
|
|
|
- <foreach collection="list" item="param" separator=";">
|
|
|
- UPDATE platform_cash_account_record
|
|
|
- <set>
|
|
|
- <if test="param.accountId">
|
|
|
- account_id_ = #{param.accountId}
|
|
|
- </if>
|
|
|
- <if test="param.transAmount">
|
|
|
- trans_amount_ = #{param.transAmount}
|
|
|
- </if>
|
|
|
- <if test="param.memo">
|
|
|
- memo_ = #{param.memo}
|
|
|
- </if>
|
|
|
- <if test="param.orderNo">
|
|
|
- order_no_ = #{param.orderNo}
|
|
|
- </if>
|
|
|
- <if test="param.bizId">
|
|
|
- biz_id_ = #{param.bizId}
|
|
|
- </if>
|
|
|
- <if test="param.inOrOut">
|
|
|
- in_or_out_ = #{param.inOrOut}
|
|
|
- </if>
|
|
|
- <if test="param.bizType">
|
|
|
- biz_type_ = #{param.bizType}
|
|
|
- </if>
|
|
|
- <if test="param.status">
|
|
|
- post_status_ = #{param.status}
|
|
|
- </if>
|
|
|
- <if test="param.startDate">
|
|
|
- update_time_ >= #{param.startDate}
|
|
|
- </if>
|
|
|
- <if test="param.endDate">
|
|
|
- update_time_ <= #{param.endDate}
|
|
|
- </if>
|
|
|
- update_time_ = NOW()
|
|
|
- </set>
|
|
|
- WHERE
|
|
|
- id_ = #{param.id}
|
|
|
- </foreach>
|
|
|
- </update>
|
|
|
-
|
|
|
- <select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
|
|
|
+ <select id="queryPage" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
|
|
|
select * from platform_cash_account_record
|
|
|
- <where>
|
|
|
- <if test="param.orderNo">
|
|
|
- and order_no_ = #{param.orderNo}
|
|
|
- </if>
|
|
|
- <if test="param.bizId">
|
|
|
- and biz_id_ = #{param.bizId}
|
|
|
- </if>
|
|
|
- <if test="param.inOrOut">
|
|
|
- and in_or_out_ = #{param.inOrOut}
|
|
|
- </if>
|
|
|
- <if test="param.bizType">
|
|
|
- and biz_type_ = #{param.bizType}
|
|
|
- </if>
|
|
|
- <if test="param.status">
|
|
|
- and post_status_ = #{param.status}
|
|
|
- </if>
|
|
|
- <if test="param.startDate">
|
|
|
- and update_time_ >= #{param.startDate}
|
|
|
- </if>
|
|
|
- <if test="param.endDate">
|
|
|
- and update_time_ <= #{param.endDate}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ <where>
|
|
|
+ <if test="param.orderNo">
|
|
|
+ and order_no_ = #{param.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="param.bizId">
|
|
|
+ and biz_id_ = #{param.bizId}
|
|
|
+ </if>
|
|
|
+ <if test="param.inOrOut">
|
|
|
+ and in_or_out_ = #{param.inOrOut}
|
|
|
+ </if>
|
|
|
+ <if test="param.bizType">
|
|
|
+ and biz_type_ = #{param.bizType}
|
|
|
+ </if>
|
|
|
+ <if test="param.status">
|
|
|
+ and post_status_ = #{param.status}
|
|
|
+ </if>
|
|
|
+ <if test="param.startDate">
|
|
|
+ and update_time_ >= #{param.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="param.endDate">
|
|
|
+ and update_time_ <= #{param.endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="querySummary" resultType="com.yonge.cooleshow.biz.dal.vo.PlatformCashAccountRecordSummaryVo">
|
|
|
- select
|
|
|
- sum(case when in_or_out_ = 'IN' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancesReceived,
|
|
|
- sum(case when in_or_out_ = 'IN' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledReceived,
|
|
|
- sum(case when in_or_out_ = 'OUT' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancePayment,
|
|
|
- sum(case when in_or_out_ = 'OUT' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledPayment
|
|
|
- from platform_cash_account_record
|
|
|
- <where>
|
|
|
- <if test="param.orderNo">
|
|
|
- and order_no_ = #{param.orderNo}
|
|
|
- </if>
|
|
|
- <if test="param.bizId">
|
|
|
- and biz_id_ = #{param.bizId}
|
|
|
- </if>
|
|
|
- <if test="param.inOrOut">
|
|
|
- and in_or_out_ = #{param.inOrOut}
|
|
|
- </if>
|
|
|
- <if test="param.bizType">
|
|
|
- and biz_type_ = #{param.bizType}
|
|
|
- </if>
|
|
|
- <if test="param.status">
|
|
|
- and post_status_ = #{param.status}
|
|
|
- </if>
|
|
|
- <if test="param.startDate">
|
|
|
- and update_time_ >= #{param.startDate}
|
|
|
- </if>
|
|
|
- <if test="param.endDate">
|
|
|
- and update_time_ <= #{param.endDate}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ select
|
|
|
+ sum(case when in_or_out_ = 'IN' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancesReceived,
|
|
|
+ sum(case when in_or_out_ = 'IN' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledReceived,
|
|
|
+ sum(case when in_or_out_ = 'OUT' and post_status_ = 'WAIT' then trans_amount_ else 0 end) advancePayment,
|
|
|
+ sum(case when in_or_out_ = 'OUT' and post_status_ = 'RECORDED' then trans_amount_ else 0 end) settledPayment
|
|
|
+ from platform_cash_account_record
|
|
|
+ <where>
|
|
|
+ <if test="param.orderNo">
|
|
|
+ and order_no_ = #{param.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="param.bizId">
|
|
|
+ and biz_id_ = #{param.bizId}
|
|
|
+ </if>
|
|
|
+ <if test="param.inOrOut">
|
|
|
+ and in_or_out_ = #{param.inOrOut}
|
|
|
+ </if>
|
|
|
+ <if test="param.bizType">
|
|
|
+ and biz_type_ = #{param.bizType}
|
|
|
+ </if>
|
|
|
+ <if test="param.status">
|
|
|
+ and post_status_ = #{param.status}
|
|
|
+ </if>
|
|
|
+ <if test="param.startDate">
|
|
|
+ and update_time_ >= #{param.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="param.endDate">
|
|
|
+ and update_time_ <= #{param.endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="queryByBizTypeAndPaymentDays" resultType="com.yonge.cooleshow.biz.dal.entity.PlatformCashAccountRecord">
|
|
|
select * from platform_cash_account_record where biz_type_ = #{bizType} and TIMESTAMPDIFF(HOUR, create_time_, now()) >= ${24 * paymentDays} and post_status_ = 'WAIT'
|
|
|
</select>
|
|
|
|
|
|
+ <update id="cancelRecord">
|
|
|
+ update platform_cash_account_record set post_status_ = 'CANCEL'
|
|
|
+ where post_status_ = 'WAIT' and order_no_ = #{orderNo} and biz_id_ = #{bizId}
|
|
|
+ and biz_type_ = #{bizType}
|
|
|
+ </update>
|
|
|
+
|
|
|
</mapper>
|