客户余额,额度记录流水
This commit is contained in:
@@ -198,6 +198,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and (biz_type = 'customer' or biz_type is null or biz_type = '')
|
||||
</update>
|
||||
|
||||
<!-- 额度调整后回写客户档案额度字段(数据源为客户余额账户) -->
|
||||
<update id="updateCustomerCredit">
|
||||
update bms_customer
|
||||
set credit_ed = #{creditEd},
|
||||
temp_ed = #{tempEd},
|
||||
update_by = #{updateBy},
|
||||
update_time = now()
|
||||
where customer_id = #{customerId}
|
||||
</update>
|
||||
|
||||
<!-- 只取档案物理额度列(列表查询里的 credit_ed 是账户可用额度子查询) -->
|
||||
<select id="selectRawCreditByCustomerId" resultType="BmsCustomer">
|
||||
select customer_id as customerId,
|
||||
credit_ed as creditEd,
|
||||
temp_ed as tempEd
|
||||
from bms_customer
|
||||
where customer_id = #{customerId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteBmsCustomerAttachmentByAttachmentIds" parameterType="String">
|
||||
update bms_customer_attachment set del_flag = '2' where attachment_id in
|
||||
<foreach item="attachmentId" collection="attachmentIds" open="(" separator="," close=")">
|
||||
@@ -287,12 +306,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
service_user_id = #{serviceUserId},
|
||||
service_user = #{serviceUser},
|
||||
<if test="settlementType != null">settlement_type = #{settlementType},</if>
|
||||
<if test="tempEd != null">temp_ed = #{tempEd},</if>
|
||||
<if test="accountBalance != null">account_balance = #{accountBalance},</if>
|
||||
<if test="foreignCurrencyBalance != null">foreign_currency_balance = #{foreignCurrencyBalance},</if>
|
||||
<if test="weightThreshold != null">weight_threshold = #{weightThreshold},</if>
|
||||
<if test="throwRatio != null">throw_ratio = #{throwRatio},</if>
|
||||
<if test="creditEd != null">credit_ed = #{creditEd},</if>
|
||||
<if test="productIds != null">product_ids = #{productIds},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
|
||||
@@ -13,6 +13,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="frozenBalance" column="frozen_balance" />
|
||||
<result property="totalCredit" column="total_credit" />
|
||||
<result property="extraCredit" column="extra_credit" />
|
||||
<result property="extraEffectiveDate" column="extra_effective_date" />
|
||||
<result property="extraExpireDate" column="extra_expire_date" />
|
||||
<result property="usedCredit" column="used_credit" />
|
||||
<result property="tax" column="tax" />
|
||||
<result property="version" column="version" />
|
||||
@@ -25,7 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCustomerAccountVo">
|
||||
select id, customer_id, currency, balance, frozen_balance, total_credit, extra_credit, used_credit,
|
||||
select id, customer_id, currency, balance, frozen_balance, total_credit, extra_credit,
|
||||
extra_effective_date, extra_expire_date, used_credit,
|
||||
tax, version, create_by, create_time, update_by, update_time, remark, del_flag
|
||||
from customer_account
|
||||
</sql>
|
||||
@@ -90,6 +93,112 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{id} and version = #{version} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<!-- 乐观锁更新额度(信用/临时额度及临时额度有效期) -->
|
||||
<update id="updateAccountCredit">
|
||||
update customer_account
|
||||
set total_credit = #{totalCredit},
|
||||
extra_credit = #{extraCredit},
|
||||
extra_effective_date = #{extraEffectiveDate},
|
||||
extra_expire_date = #{extraExpireDate},
|
||||
version = version + 1,
|
||||
update_by = #{updateBy},
|
||||
update_time = now()
|
||||
where id = #{id} and version = #{version} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<!-- ================= 客户额度流水 ================= -->
|
||||
<resultMap type="com.ruoyi.customer.customermoney.domain.CustomerCreditFlow" id="CustomerCreditFlowResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="flowNo" column="flow_no" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="accountId" column="account_id" />
|
||||
<result property="creditType" column="credit_type" />
|
||||
<result property="changeType" column="change_type" />
|
||||
<result property="direction" column="direction" />
|
||||
<result property="beforeAmount" column="before_amount" />
|
||||
<result property="changeAmount" column="change_amount" />
|
||||
<result property="afterAmount" column="after_amount" />
|
||||
<result property="usedCredit" column="used_credit" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="reason" column="reason" />
|
||||
<result property="adjustMode" column="adjust_mode" />
|
||||
<result property="operatorId" column="operator_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCustomerCreditFlowVo">
|
||||
select id, flow_no, customer_id, account_id, credit_type, change_type, direction,
|
||||
before_amount, change_amount, after_amount, used_credit,
|
||||
effective_date, expire_date, reason, adjust_mode, operator_id,
|
||||
create_by, create_time, update_by, update_time, remark, del_flag
|
||||
from customer_credit_flow
|
||||
</sql>
|
||||
|
||||
<select id="selectCreditFlowList" parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditFlow"
|
||||
resultMap="CustomerCreditFlowResult">
|
||||
<include refid="selectCustomerCreditFlowVo"/>
|
||||
<where>
|
||||
<if test="customerId != null"> and customer_id = #{customerId}</if>
|
||||
<if test="creditType != null and creditType != ''"> and credit_type = #{creditType}</if>
|
||||
<if test="changeType != null and changeType != ''"> and change_type = #{changeType}</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"> and date(create_time) >= #{params.beginTime}</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"> and date(create_time) <= #{params.endTime}</if>
|
||||
and del_flag = '0'
|
||||
</where>
|
||||
order by create_time desc, id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertCreditFlow" parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditFlow"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into customer_credit_flow
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="flowNo != null">flow_no,</if>
|
||||
<if test="customerId != null">customer_id,</if>
|
||||
<if test="accountId != null">account_id,</if>
|
||||
<if test="creditType != null">credit_type,</if>
|
||||
<if test="changeType != null">change_type,</if>
|
||||
<if test="direction != null">direction,</if>
|
||||
<if test="beforeAmount != null">before_amount,</if>
|
||||
<if test="changeAmount != null">change_amount,</if>
|
||||
<if test="afterAmount != null">after_amount,</if>
|
||||
<if test="usedCredit != null">used_credit,</if>
|
||||
<if test="effectiveDate != null">effective_date,</if>
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="adjustMode != null">adjust_mode,</if>
|
||||
<if test="operatorId != null">operator_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="flowNo != null">#{flowNo},</if>
|
||||
<if test="customerId != null">#{customerId},</if>
|
||||
<if test="accountId != null">#{accountId},</if>
|
||||
<if test="creditType != null">#{creditType},</if>
|
||||
<if test="changeType != null">#{changeType},</if>
|
||||
<if test="direction != null">#{direction},</if>
|
||||
<if test="beforeAmount != null">#{beforeAmount},</if>
|
||||
<if test="changeAmount != null">#{changeAmount},</if>
|
||||
<if test="afterAmount != null">#{afterAmount},</if>
|
||||
<if test="usedCredit != null">#{usedCredit},</if>
|
||||
<if test="effectiveDate != null">#{effectiveDate},</if>
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
<if test="reason != null">#{reason},</if>
|
||||
<if test="adjustMode != null">#{adjustMode},</if>
|
||||
<if test="operatorId != null">#{operatorId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- ================= 客户收款 ================= -->
|
||||
<resultMap type="com.ruoyi.customer.customermoney.domain.CustomerReceipt" id="CustomerReceiptResult">
|
||||
<id property="id" column="id" />
|
||||
|
||||
Reference in New Issue
Block a user