客户余额记录

This commit is contained in:
luojiaquan
2026-09-14 11:51:54 +08:00
parent 4cc20386d9
commit 18f01d1b33
16 changed files with 2349 additions and 43 deletions
@@ -36,41 +36,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
</resultMap>
<!-- 账户余额/外币余额统一取 customer_account 余额表(CNY 为本币,其余为外币),不取 bms_customer 冗余列 -->
<sql id="selectBmsCustomerVo">
select customer_id, customer_code, customer_name, customer_code_dw, credit_code, customer_type, is_enable, sales_user_id, sales_user, ed, zq, settlement_user_id, settlement_user, service_user_id, service_user, settlement_type, temp_ed, account_balance, foreign_currency_balance, weight_threshold, throw_ratio, credit_ed, product_ids, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer
select c.customer_id, c.customer_code, c.customer_name, c.customer_code_dw, c.credit_code, c.customer_type,
c.is_enable, c.sales_user_id, c.sales_user, c.ed, c.zq, c.settlement_user_id, c.settlement_user,
c.service_user_id, c.service_user, c.settlement_type, c.temp_ed,
(select coalesce(sum(ca.balance), 0) from customer_account ca
where ca.customer_id = c.customer_id and ca.currency = 'CNY' and ca.del_flag = '0') as account_balance,
(select coalesce(sum(ca.balance), 0) from customer_account ca
where ca.customer_id = c.customer_id and ca.currency != 'CNY' and ca.del_flag = '0') as foreign_currency_balance,
c.weight_threshold, c.throw_ratio, c.credit_ed, c.product_ids, c.remark,
c.create_by, c.create_time, c.update_by, c.update_time, c.del_flag
from bms_customer c
</sql>
<select id="selectBmsCustomerList" parameterType="BmsCustomer" resultMap="BmsCustomerResult">
<include refid="selectBmsCustomerVo"/>
<where>
<if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="customerCodeDw != null and customerCodeDw != ''"> and customer_code_dw = #{customerCodeDw}</if>
<if test="creditCode != null and creditCode != ''"> and credit_code = #{creditCode}</if>
<if test="customerType != null and customerType != ''"> and customer_type = #{customerType}</if>
<if test="isEnable != null and isEnable != ''"> and is_enable = #{isEnable}</if>
<if test="salesUserId != null and salesUserId != ''"> and sales_user_id = #{salesUserId}</if>
<if test="salesUser != null and salesUser != ''"> and sales_user = #{salesUser}</if>
<if test="ed != null "> and ed = #{ed}</if>
<if test="zq != null "> and zq = #{zq}</if>
<if test="settlementUserId != null and settlementUserId != ''"> and settlement_user_id = #{settlementUserId}</if>
<if test="settlementUser != null and settlementUser != ''"> and settlement_user = #{settlementUser}</if>
<if test="serviceUserId != null and serviceUserId != ''"> and service_user_id = #{serviceUserId}</if>
<if test="serviceUser != null and serviceUser != ''"> and service_user = #{serviceUser}</if>
<if test="settlementType != null and settlementType != ''"> and settlement_type = #{settlementType}</if>
<if test="tempEd != null "> and temp_ed = #{tempEd}</if>
<if test="accountBalance != null "> and account_balance = #{accountBalance}</if>
<if test="foreignCurrencyBalance != null "> and foreign_currency_balance = #{foreignCurrencyBalance}</if>
<if test="weightThreshold != null "> and weight_threshold = #{weightThreshold}</if>
<if test="throwRatio != null "> and throw_ratio = #{throwRatio}</if>
<if test="creditEd != null "> and credit_ed = #{creditEd}</if>
<if test="productIds != null and productIds != ''"> and product_ids = #{productIds}</if>
<where>
<if test="customerCode != null and customerCode != ''"> and c.customer_code = #{customerCode}</if>
<if test="customerName != null and customerName != ''"> and c.customer_name like concat('%', #{customerName}, '%')</if>
<if test="customerCodeDw != null and customerCodeDw != ''"> and c.customer_code_dw = #{customerCodeDw}</if>
<if test="creditCode != null and creditCode != ''"> and c.credit_code = #{creditCode}</if>
<if test="customerType != null and customerType != ''"> and c.customer_type = #{customerType}</if>
<if test="isEnable != null and isEnable != ''"> and c.is_enable = #{isEnable}</if>
<if test="salesUserId != null and salesUserId != ''"> and c.sales_user_id = #{salesUserId}</if>
<if test="salesUser != null and salesUser != ''"> and c.sales_user = #{salesUser}</if>
<if test="ed != null "> and c.ed = #{ed}</if>
<if test="zq != null "> and c.zq = #{zq}</if>
<if test="settlementUserId != null and settlementUserId != ''"> and c.settlement_user_id = #{settlementUserId}</if>
<if test="settlementUser != null and settlementUser != ''"> and c.settlement_user = #{settlementUser}</if>
<if test="serviceUserId != null and serviceUserId != ''"> and c.service_user_id = #{serviceUserId}</if>
<if test="serviceUser != null and serviceUser != ''"> and c.service_user = #{serviceUser}</if>
<if test="settlementType != null and settlementType != ''"> and c.settlement_type = #{settlementType}</if>
<if test="tempEd != null "> and c.temp_ed = #{tempEd}</if>
<if test="weightThreshold != null "> and c.weight_threshold = #{weightThreshold}</if>
<if test="throwRatio != null "> and c.throw_ratio = #{throwRatio}</if>
<if test="creditEd != null "> and c.credit_ed = #{creditEd}</if>
<if test="productIds != null and productIds != ''"> and c.product_ids = #{productIds}</if>
</where>
order by c.customer_id desc
</select>
<select id="selectBmsCustomerByCustomerId" parameterType="Long" resultMap="BmsCustomerResult">
<include refid="selectBmsCustomerVo"/>
where customer_id = #{customerId} and del_flag = '0'
where c.customer_id = #{customerId} and c.del_flag = '0'
</select>
<resultMap type="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" id="BmsCustomerAttachmentResult">
@@ -82,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="fileType" column="file_type" />
<result property="fileExtension" column="file_extension" />
<result property="attachmentType" column="attachment_type" />
<result property="bizId" column="biz_id" />
<result property="isLogo" column="is_logo" />
<result property="sortOrder" column="sort_order" />
<result property="remark" column="remark" />
@@ -93,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsCustomerAttachmentVo">
select attachment_id, customer_id, file_name, file_path, file_size, file_type, file_extension, attachment_type, is_logo, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_attachment
select attachment_id, customer_id, file_name, file_path, file_size, file_type, file_extension, attachment_type, biz_id, is_logo, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_attachment
</sql>
<select id="selectBmsCustomerAttachmentList" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" resultMap="BmsCustomerAttachmentResult">
@@ -102,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="attachmentType != null and attachmentType != ''"> and attachment_type = #{attachmentType}</if>
<if test="bizId != null"> and biz_id = #{bizId}</if>
<if test="isLogo != null and isLogo != ''"> and is_logo = #{isLogo}</if>
and del_flag = '0'
</where>
@@ -118,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileType != null">file_type,</if>
<if test="fileExtension != null">file_extension,</if>
<if test="attachmentType != null">attachment_type,</if>
<if test="bizId != null">biz_id,</if>
<if test="isLogo != null">is_logo,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="remark != null">remark,</if>
@@ -133,6 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileType != null">#{fileType},</if>
<if test="fileExtension != null">#{fileExtension},</if>
<if test="attachmentType != null">#{attachmentType},</if>
<if test="bizId != null">#{bizId},</if>
<if test="isLogo != null">#{isLogo},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="remark != null">#{remark},</if>
@@ -152,6 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileType != null">file_type = #{fileType},</if>
<if test="fileExtension != null">file_extension = #{fileExtension},</if>
<if test="attachmentType != null">attachment_type = #{attachmentType},</if>
<if test="bizId != null">biz_id = #{bizId},</if>
<if test="isLogo != null">is_logo = #{isLogo},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="remark != null">remark = #{remark},</if>