表名修改

This commit is contained in:
luojiaquan
2026-09-24 09:25:47 +08:00
parent f834dd785b
commit cef55c517e
34 changed files with 184 additions and 152 deletions
@@ -82,24 +82,24 @@
// void setUp()
// {
// // 1) 若账户不存在则先创建(总额度=TEST_TOTAL,余额/已用/临时均为0),保证后续 update 有行可改
// jdbc.update("INSERT INTO customer_account "
// jdbc.update("INSERT INTO ctr_customer_account "
// + "(customer_id, currency, balance, frozen_balance, total_credit, extra_credit, used_credit, tax, version, del_flag, create_by, create_time) "
// + "SELECT ?, ?, 0, 0, ?, 0, 0, 0, 0, '0', '并发测试', now() "
// + "FROM DUAL WHERE NOT EXISTS "
// + "(SELECT 1 FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0')",
// + "(SELECT 1 FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0')",
// CUSTOMER_ID, CURRENCY, TEST_TOTAL, CUSTOMER_ID, CURRENCY);
//
// // 2) 快照账户原值(用于恢复)
// origTotal = queryAmount("SELECT total_credit FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// origUsed = queryAmount("SELECT used_credit FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// origExtra = queryAmount("SELECT extra_credit FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// origTotal = queryAmount("SELECT total_credit FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// origUsed = queryAmount("SELECT used_credit FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// origExtra = queryAmount("SELECT extra_credit FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
//
// // 3) 重置为受控状态:总额度=TEST_TOTAL,已用=0,临时=0,并清掉历史额度流水(只清本客户,避免影响统计断言)
// jdbc.update("UPDATE customer_account SET total_credit = ?, used_credit = 0, extra_credit = 0, "
// jdbc.update("UPDATE ctr_customer_account SET total_credit = ?, used_credit = 0, extra_credit = 0, "
// + "extra_effective_date = NULL, extra_expire_date = NULL, version = version + 1 "
// + "WHERE customer_id = ? AND currency = ? AND del_flag = '0'",
// TEST_TOTAL, CUSTOMER_ID, CURRENCY);
// jdbc.update("DELETE FROM customer_credit_flow WHERE customer_id = ? AND create_by = '并发测试'",
// jdbc.update("DELETE FROM ctr_customer_credit_flow WHERE customer_id = ? AND create_by = '并发测试'",
// CUSTOMER_ID);
//
// // 4) 构造登录态(occupyCredit 内部调用 SecurityUtils.getUsername()/getUserId())
@@ -115,10 +115,10 @@
// // 1) 物理删除测试产生的额度流水
// for (Long id : createdFlowIds)
// {
// jdbc.update("DELETE FROM customer_credit_flow WHERE id = ?", id);
// jdbc.update("DELETE FROM ctr_customer_credit_flow WHERE id = ?", id);
// }
// // 2) 恢复账户原值
// jdbc.update("UPDATE customer_account SET total_credit = ?, used_credit = ?, extra_credit = ? "
// jdbc.update("UPDATE ctr_customer_account SET total_credit = ?, used_credit = ?, extra_credit = ? "
// + "WHERE customer_id = ? AND currency = ? AND del_flag = '0'",
// origTotal, origUsed, origExtra, CUSTOMER_ID, CURRENCY);
// // 3) 清理线程本地上下文,避免污染其他用例
@@ -157,7 +157,7 @@
// public void 并发占用_额度充足时所有更新全部生效()
// throws InterruptedException
// {
// jdbc.update("UPDATE customer_account SET total_credit = 5000, used_credit = 0 "
// jdbc.update("UPDATE ctr_customer_account SET total_credit = 5000, used_credit = 0 "
// + "WHERE customer_id = ? AND currency = ? AND del_flag = '0'", CUSTOMER_ID, CURRENCY);
//
// RunResult result = runConcurrentOccupy(5, AMOUNT);
@@ -230,17 +230,17 @@
//
// private BigDecimal queryUsedCredit()
// {
// return queryAmount("SELECT used_credit FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// return queryAmount("SELECT used_credit FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// }
//
// private BigDecimal queryTotalCredit()
// {
// return queryAmount("SELECT total_credit FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// return queryAmount("SELECT total_credit FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// }
//
// private BigDecimal queryExtraCredit()
// {
// return queryAmount("SELECT extra_credit FROM customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// return queryAmount("SELECT extra_credit FROM ctr_customer_account WHERE customer_id = ? AND currency = ? AND del_flag = '0'");
// }
//
// private BigDecimal queryAmount(String sql)
@@ -7,8 +7,7 @@ import com.ruoyi.ar.domain.ArBill;
/**
* 应收账单余额核销 Service接口
*
* <p>资金来源为客户账户余额(customer_account.balance);核销时三方联动:账户余额扣减、已用额度释放、
* 账单已核销/未核销金额及状态更新。</p>
* <p>核销仅更新账单已核销/未核销金额及状态(2026-09-23 口径变更后不再变动 ctr_customer_account 余额与额度)。</p>
*
* @author ruoyi
* @date 2026-09-16
@@ -10,7 +10,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户主对象 bms_customer
* 客户主对象 ctr_customer
*
* @author ruoyi
* @date 2026-09-08
@@ -111,13 +111,13 @@ public class BmsCustomer extends BaseEntity
@Excel(name = "绑定产品代码")
private String productCodes;
/** 附件列表(子表 bms_customer_attachment) */
/** 附件列表(子表 ctr_customer_attachment) */
private List<BmsCustomerAttachment> attachmentList;
/** 公司主体列表(子表 bms_customer_company) */
/** 公司主体列表(子表 ctr_customer_company) */
private List<BmsCustomerCompany> companyList;
/** 联系人列表(子表 bms_customer_contact) */
/** 联系人列表(子表 ctr_customer_contact) */
private List<BmsCustomerContact> contactList;
/** 删除标记(0正常 2删除) */
@@ -9,7 +9,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户附件对象 bms_customer_attachment
* 客户附件对象 ctr_customer_attachment
*
* @author ruoyi
* @date 2026-09-08
@@ -11,7 +11,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户公司主体对象 bms_customer_company
* 客户公司主体对象 ctr_customer_company
*
* @author ruoyi
* @date 2026-09-09
@@ -7,7 +7,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 客户联系人对象 bms_customer_contact
* 客户联系人对象 ctr_customer_contact
*
* @author ruoyi
* @date 2026-09-09
@@ -9,7 +9,7 @@ import com.ruoyi.customer.customermoney.vo.CustomerAccountStatusVO;
* 客户资金公共服务:客户余额扣减/回补、授信额度占用/释放的统一入口。
*
* <p>客户余额、授信额度及其流水(客户模块资产)的所有变动都必须经过本接口,
* 其他模块(应收账单、计费订单/计费变动等)不得直接更新 customer_account /
* 其他模块(应收账单、计费订单/计费变动等)不得直接更新 ctr_customer_account /
* 直接插入流水表。每个方法在同一事务内完成:行锁账户 -> 乐观锁变动 -> 写流水,
* 调用方自身的事务会与本操作共享事务(默认 REQUIRED),任一失败整体回滚。</p>
*
@@ -549,7 +549,7 @@ public class CustomerAccountApiImpl implements ICustomerAccountApi
}
}
/** Deadlock / duplicate key while inserting customer_account. */
/** Deadlock / duplicate key while inserting ctr_customer_account. */
private static boolean isAccountInitRace(Throwable e)
{
Throwable t = e;
@@ -8,7 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户余额账户 customer_account
* 客户余额账户 ctr_customer_account
*
* @author ruoyi
* @date 2026-09-11
@@ -6,7 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户余额流水 customer_balance_flow
* 客户余额流水 ctr_customer_balance_flow
*
* @author ruoyi
* @date 2026-09-11
@@ -7,7 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户额度调整申请审批 customer_credit_apply
* 客户额度调整申请审批 ctr_customer_credit_apply
* 信用额度/额外额度(临时额度)调整先申请,审批通过后才真正调整账户额度
*
* @author ruoyi
@@ -8,7 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户额度流水 customer_credit_flow
* 客户额度流水 ctr_customer_credit_flow
*
* @author ruoyi
* @date 2026-09-16
@@ -8,7 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户授信额度分配台账 customer_credit_grant
* 客户授信额度分配台账 ctr_customer_credit_grant
* 审批通过的净增额度占一行(占用角色额度池);调减/到期按 FIFO 核销行余额。
* 角色池已用 = SUM(remaining WHERE role_id=? AND status='0')
*
@@ -10,7 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 客户收款 customer_receipt
* 客户收款 ctr_customer_receipt
*
* @author ruoyi
* @date 2026-09-11
@@ -122,7 +122,7 @@ public class CustomerReceipt extends BaseEntity
/** 删除标志(0存在 1删除) */
private String delFlag;
/** 收款附件列表(存 bms_customer_attachment,attachment_type='3',biz_id 关联本单) */
/** 收款附件列表(存 ctr_customer_attachment,attachment_type='3',biz_id 关联本单) */
private List<BmsCustomerAttachment> attachmentList;
/** 收款附件数量(列表查询统计) */
@@ -33,7 +33,7 @@ public class CustomerAccountStatusVO implements Serializable
private String customerCode;
/** 客户名称 */
private String customerName;
/** 启用状态(0正常 1停用)—— 来自 bms_customer.is_enable */
/** 启用状态(0正常 1停用)—— 来自 ctr_customer.is_enable */
private String isEnable;
/** 启用状态文案(正常 / 停用) */
private String isEnableLabel;
@@ -15,7 +15,7 @@ import com.ruoyi.customer.supplierinfo.domain.BmsSupplierCompany;
import com.ruoyi.customer.supplierinfo.domain.BmsSupplierContact;
/**
* 供应商主对象 bms_supplier
* 供应商主对象 sup_supplier
*
* @author ruoyi
* @date 2026-09-09
@@ -124,13 +124,13 @@ public class BmsSupplier extends BaseEntity
/** 绑定的渠道/服务ID */
private String channelIds;
/** 附件列表(子表 bms_supplier_attachment) */
/** 附件列表(子表 sup_supplier_attachment) */
private List<BmsSupplierAttachment> attachmentList;
/** 公司主体列表(子表 bms_supplier_company) */
/** 公司主体列表(子表 sup_supplier_company) */
private List<BmsSupplierCompany> companyList;
/** 联系人列表(子表 bms_supplier_contact) */
/** 联系人列表(子表 sup_supplier_contact) */
private List<BmsSupplierContact> contactList;
/** 删除标记(0正常 2删除) */
@@ -7,7 +7,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 供应商附件对象 bms_supplier_attachment
* 供应商附件对象 sup_supplier_attachment
*
* @author ruoyi
* @date 2026-09-10
@@ -9,7 +9,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 供应商公司主体(工商信息)对象 bms_supplier_company
* 供应商公司主体(工商信息)对象 sup_supplier_company
*
* @author ruoyi
* @date 2026-09-10
@@ -7,7 +7,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 供应商联系人对象 bms_supplier_contact
* 供应商联系人对象 sup_supplier_contact
*
* @author ruoyi
* @date 2026-09-10
@@ -18,7 +18,7 @@ public class PrcQuote extends BaseEntity
private String quoteId;
private String quoteKey;
private Long customerId;
/** bms_customer.customer_code */
/** ctr_customer.customer_code */
private String customerCode;
private String productCode;
private String productName;
@@ -14,7 +14,7 @@ public class TmsPriceQuoteRequest implements Serializable
private Long customerId;
/** Required. Maps to bms_customer.customer_code; used in quote unique key. */
/** Required. Maps to ctr_customer.customer_code; used in quote unique key. */
@NotBlank(message = "customerCode is required")
private String customerCode;
@@ -250,7 +250,7 @@ public class PrcBillingTaskServiceImpl implements IPrcBillingTaskService
}
/**
* Retry bill() on MySQL deadlock / lock wait (common when many tasks share one customer_account).
* Retry bill() on MySQL deadlock / lock wait (common when many tasks share one ctr_customer_account).
*/
private TmsPriceQuoteResult billWithDbRetry(Long taskId, TmsPriceBillRequest billReq)
{
@@ -335,7 +335,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
}
/**
* Require customerCode; resolve customer_id from bms_customer.
* Require customerCode; resolve customer_id from ctr_customer.
*/
private void resolveCustomer(TmsPriceQuoteRequest request)
{
@@ -36,24 +36,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
</resultMap>
<!-- 账户余额/外币余额统一取 customer_account 余额表(CNY 为本币,其余为外币),不取 bms_customer 冗余列 -->
<!-- 账户余额/外币余额统一取 ctr_customer_account 余额表(CNY 为本币,其余为外币),不取 ctr_customer 冗余列 -->
<!-- 信用额度=总额度+额外额度-已用额度-->
<sql id="selectBmsCustomerVo">
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
(select coalesce(sum(ca.balance), 0) from ctr_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
(select coalesce(sum(ca.balance), 0) from ctr_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,
(select coalesce(sum(ca.total_credit+ca.extra_credit-ca.used_credit), 0) from customer_account ca
(select coalesce(sum(ca.total_credit+ca.extra_credit-ca.used_credit), 0) from ctr_customer_account ca
where ca.customer_id = c.customer_id and ca.del_flag = '0') as credit_ed,
c.product_codes, c.remark,
c.create_by, c.create_time, c.update_by, c.update_time, c.del_flag
from bms_customer c
from ctr_customer c
<!-- 数据权限:销售(仅本人 c.sales_user_id)/销售经理(本部门 su.dept_id);
历史迁移数据 sales_user_id 为非数字工号,+0 后不匹配任何 sys_user,仅管理员可见 -->
left join sys_user su on su.user_id = c.sales_user_id + 0
@@ -97,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- TMS 实时状态接口只读取客户ID和启用状态,避免加载客户完整资料和额度汇总。 -->
<select id="selectCustomerStatusByCustomerId" parameterType="Long" resultMap="BmsCustomerResult">
select customer_id, is_enable
from bms_customer
from ctr_customer
where customer_id = #{customerId}
and del_flag = '0'
</select>
@@ -124,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsCustomerAttachmentVo">
select attachment_id, customer_id, biz_type, 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
select attachment_id, customer_id, biz_type, 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 ctr_customer_attachment
</sql>
<select id="selectBmsCustomerAttachmentList" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" resultMap="BmsCustomerAttachmentResult">
@@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsCustomerAttachment" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" useGeneratedKeys="true" keyProperty="attachmentId">
insert into bms_customer_attachment
insert into ctr_customer_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="bizType != null">biz_type,</if>
@@ -180,7 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsCustomerAttachment" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment">
update bms_customer_attachment
update ctr_customer_attachment
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
@@ -201,19 +201,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsCustomerAttachmentByCustomerId" parameterType="Long">
update bms_customer_attachment set del_flag = '2' where customer_id = #{customerId}
update ctr_customer_attachment set del_flag = '2' where customer_id = #{customerId}
</delete>
<!-- 仅逻辑删除客户档案模块的附件,保留收款水单等其他业务模块的附件 -->
<update id="deleteBmsCustomerProfileAttachmentByCustomerId" parameterType="Long">
update bms_customer_attachment set del_flag = '2'
update ctr_customer_attachment set del_flag = '2'
where customer_id = #{customerId}
and (biz_type = 'customer' or biz_type is null or biz_type = '')
</update>
<!-- 额度调整后回写客户档案额度字段(数据源为客户余额账户) -->
<update id="updateCustomerCredit">
update bms_customer
update ctr_customer
set credit_ed = #{creditEd},
temp_ed = #{tempEd},
update_by = #{updateBy},
@@ -226,19 +226,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select customer_id as customerId,
credit_ed as creditEd,
temp_ed as tempEd
from bms_customer
from ctr_customer
where customer_id = #{customerId}
</select>
<delete id="deleteBmsCustomerAttachmentByAttachmentIds" parameterType="String">
update bms_customer_attachment set del_flag = '2' where attachment_id in
update ctr_customer_attachment set del_flag = '2' where attachment_id in
<foreach item="attachmentId" collection="attachmentIds" open="(" separator="," close=")">
#{attachmentId}
</foreach>
</delete>
<insert id="insertBmsCustomer" parameterType="BmsCustomer" useGeneratedKeys="true" keyProperty="customerId">
insert into bms_customer
insert into ctr_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
@@ -302,7 +302,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsCustomer" parameterType="BmsCustomer">
update bms_customer
update ctr_customer
<trim prefix="SET" suffixOverrides=",">
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
@@ -335,17 +335,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsCustomerByCustomerId" parameterType="Long">
update bms_customer set del_flag = '2' where customer_id = #{customerId}
update ctr_customer set del_flag = '2' where customer_id = #{customerId}
</delete>
<delete id="deleteBmsCustomerByCustomerIds" parameterType="Long">
update bms_customer set del_flag = '2' where customer_id in
update ctr_customer set del_flag = '2' where customer_id in
<foreach item="customerId" collection="customerIds" open="(" separator="," close=")">
#{customerId}
</foreach>
</delete>
<!-- ========== bms_customer_company 子表 ========== -->
<!-- ========== ctr_customer_company 子表 ========== -->
<resultMap type="com.ruoyi.customer.customerinfo.domain.BmsCustomerCompany" id="BmsCustomerCompanyResult">
<result property="companyId" column="company_id" />
<result property="customerId" column="customer_id" />
@@ -387,7 +387,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsCustomerCompanyVo">
select company_id, customer_id, company_name_full, english_name, credit_code, legal_person, legal_person_phone, legal_person_id_card, registered_capital, capital_currency, paid_in_capital, establish_date, business_term_start, business_term_end, business_term_permanent, registration_authority, registration_number, operating_status, business_scope, shareholders, employee_count, company_phone, company_fax, company_website, company_email, registered_province, registered_city, registered_district, registered_address_detail, business_license_url, attachment_ids, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_company
select company_id, customer_id, company_name_full, english_name, credit_code, legal_person, legal_person_phone, legal_person_id_card, registered_capital, capital_currency, paid_in_capital, establish_date, business_term_start, business_term_end, business_term_permanent, registration_authority, registration_number, operating_status, business_scope, shareholders, employee_count, company_phone, company_fax, company_website, company_email, registered_province, registered_city, registered_district, registered_address_detail, business_license_url, attachment_ids, remark, create_by, create_time, update_by, update_time, del_flag from ctr_customer_company
</sql>
<select id="selectBmsCustomerCompanyList" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerCompany" resultMap="BmsCustomerCompanyResult">
@@ -409,7 +409,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsCustomerCompany" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerCompany" useGeneratedKeys="true" keyProperty="companyId">
insert into bms_customer_company
insert into ctr_customer_company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="companyNameFull != null">company_name_full,</if>
@@ -485,7 +485,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsCustomerCompany" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerCompany">
update bms_customer_company
update ctr_customer_company
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="companyNameFull != null">company_name_full = #{companyNameFull},</if>
@@ -525,14 +525,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsCustomerCompanyByCustomerId" parameterType="Long">
update bms_customer_company set del_flag = '2' where customer_id = #{customerId}
update ctr_customer_company set del_flag = '2' where customer_id = #{customerId}
</delete>
<delete id="deleteBmsCustomerCompanyByCompanyId" parameterType="Long">
update bms_customer_company set del_flag = '2' where company_id = #{companyId}
update ctr_customer_company set del_flag = '2' where company_id = #{companyId}
</delete>
<!-- ========== bms_customer_contact 子表 ========== -->
<!-- ========== ctr_customer_contact 子表 ========== -->
<resultMap type="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact" id="BmsCustomerContactResult">
<result property="contactId" column="contact_id" />
<result property="customerId" column="customer_id" />
@@ -562,7 +562,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsCustomerContactVo">
select contact_id, customer_id, contact_name, position, department, phone, landline, email, wechat, qq, country, province, city, district, contact_address, postal_code, is_default, contact_type, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_contact
select contact_id, customer_id, contact_name, position, department, phone, landline, email, wechat, qq, country, province, city, district, contact_address, postal_code, is_default, contact_type, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from ctr_customer_contact
</sql>
<select id="selectBmsCustomerContactList" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact" resultMap="BmsCustomerContactResult">
@@ -583,7 +583,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsCustomerContact" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact" useGeneratedKeys="true" keyProperty="contactId">
insert into bms_customer_contact
insert into ctr_customer_contact
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="contactName != null">contact_name,</if>
@@ -635,7 +635,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsCustomerContact" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact">
update bms_customer_contact
update ctr_customer_contact
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="contactName != null">contact_name = #{contactName},</if>
@@ -663,10 +663,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsCustomerContactByCustomerId" parameterType="Long">
update bms_customer_contact set del_flag = '2' where customer_id = #{customerId}
update ctr_customer_contact set del_flag = '2' where customer_id = #{customerId}
</delete>
<delete id="deleteBmsCustomerContactByContactId" parameterType="Long">
update bms_customer_contact set del_flag = '2' where contact_id = #{contactId}
update ctr_customer_contact set del_flag = '2' where contact_id = #{contactId}
</delete>
</mapper>
@@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.service_user_id, s.service_user, s.ed, s.zq, s.settlement_type, s.temp_ed, s.account_balance,
s.foreign_currency_balance, s.credit_ed, s.weight_threshold, s.throw_ratio, s.cooperation_start_date,
s.cooperation_status, s.channel_ids, s.remark, s.create_by, s.create_time, s.update_by, s.update_time, s.del_flag
from bms_supplier s
from sup_supplier s
<!-- 数据权限:采购/销售(仅本人 s.purchaser_user_id)/部门经理(本部门 su.dept_id);
非数字历史工号 +0 后不匹配任何 sys_user,仅管理员可见 -->
left join sys_user su on su.user_id = s.purchaser_user_id + 0
@@ -79,7 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsSupplier" parameterType="BmsSupplier" useGeneratedKeys="true" keyProperty="supplierId">
insert into bms_supplier
insert into sup_supplier
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="supplierCode != null and supplierCode != ''">supplier_code,</if>
<if test="supplierName != null and supplierName != ''">supplier_name,</if>
@@ -143,7 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsSupplier" parameterType="BmsSupplier">
update bms_supplier
update sup_supplier
<trim prefix="SET" suffixOverrides=",">
<if test="supplierCode != null and supplierCode != ''">supplier_code = #{supplierCode},</if>
<if test="supplierName != null and supplierName != ''">supplier_name = #{supplierName},</if>
@@ -178,17 +178,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsSupplierBySupplierId" parameterType="Long">
delete from bms_supplier where supplier_id = #{supplierId}
delete from sup_supplier where supplier_id = #{supplierId}
</delete>
<delete id="deleteBmsSupplierBySupplierIds" parameterType="Long">
delete from bms_supplier where supplier_id in
delete from sup_supplier where supplier_id in
<foreach item="supplierId" collection="array" open="(" separator="," close=")">
#{supplierId}
</foreach>
</delete>
<!-- ========== bms_supplier_attachment 子表 ========== -->
<!-- ========== sup_supplier_attachment 子表 ========== -->
<resultMap type="com.ruoyi.customer.supplierinfo.domain.BmsSupplierAttachment" id="BmsSupplierAttachmentResult">
<result property="attachmentId" column="attachment_id" />
<result property="supplierId" column="supplier_id" />
@@ -209,7 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsSupplierAttachmentVo">
select attachment_id, supplier_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_supplier_attachment
select attachment_id, supplier_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 sup_supplier_attachment
</sql>
<select id="selectBmsSupplierAttachmentList" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierAttachment" resultMap="BmsSupplierAttachmentResult">
@@ -225,7 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsSupplierAttachment" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierAttachment" useGeneratedKeys="true" keyProperty="attachmentId">
insert into bms_supplier_attachment
insert into sup_supplier_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="supplierId != null">supplier_id,</if>
<if test="fileName != null">file_name,</if>
@@ -259,7 +259,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsSupplierAttachment" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierAttachment">
update bms_supplier_attachment
update sup_supplier_attachment
<trim prefix="SET" suffixOverrides=",">
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="fileName != null">file_name = #{fileName},</if>
@@ -278,14 +278,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsSupplierAttachmentBySupplierId" parameterType="Long">
update bms_supplier_attachment set del_flag = '2' where supplier_id = #{supplierId}
update sup_supplier_attachment set del_flag = '2' where supplier_id = #{supplierId}
</delete>
<delete id="deleteBmsSupplierAttachmentByAttachmentId" parameterType="Long">
update bms_supplier_attachment set del_flag = '2' where attachment_id = #{attachmentId}
update sup_supplier_attachment set del_flag = '2' where attachment_id = #{attachmentId}
</delete>
<!-- ========== bms_supplier_company 子表 ========== -->
<!-- ========== sup_supplier_company 子表 ========== -->
<resultMap type="com.ruoyi.customer.supplierinfo.domain.BmsSupplierCompany" id="BmsSupplierCompanyResult">
<result property="companyId" column="company_id" />
<result property="supplierId" column="supplier_id" />
@@ -327,7 +327,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsSupplierCompanyVo">
select company_id, supplier_id, company_name_full, english_name, credit_code, legal_person, legal_person_phone, legal_person_id_card, registered_capital, capital_currency, paid_in_capital, establish_date, business_term_start, business_term_end, business_term_permanent, registration_authority, registration_number, operating_status, business_scope, shareholders, employee_count, company_phone, company_fax, company_website, company_email, registered_province, registered_city, registered_district, registered_address_detail, business_license_oss_id, attachment_ids, remark, create_by, create_time, update_by, update_time, del_flag from bms_supplier_company
select company_id, supplier_id, company_name_full, english_name, credit_code, legal_person, legal_person_phone, legal_person_id_card, registered_capital, capital_currency, paid_in_capital, establish_date, business_term_start, business_term_end, business_term_permanent, registration_authority, registration_number, operating_status, business_scope, shareholders, employee_count, company_phone, company_fax, company_website, company_email, registered_province, registered_city, registered_district, registered_address_detail, business_license_oss_id, attachment_ids, remark, create_by, create_time, update_by, update_time, del_flag from sup_supplier_company
</sql>
<select id="selectBmsSupplierCompanyList" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierCompany" resultMap="BmsSupplierCompanyResult">
@@ -349,7 +349,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsSupplierCompany" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierCompany" useGeneratedKeys="true" keyProperty="companyId">
insert into bms_supplier_company
insert into sup_supplier_company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="supplierId != null">supplier_id,</if>
<if test="companyNameFull != null">company_name_full,</if>
@@ -425,7 +425,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsSupplierCompany" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierCompany">
update bms_supplier_company
update sup_supplier_company
<trim prefix="SET" suffixOverrides=",">
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="companyNameFull != null">company_name_full = #{companyNameFull},</if>
@@ -465,14 +465,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsSupplierCompanyBySupplierId" parameterType="Long">
update bms_supplier_company set del_flag = '2' where supplier_id = #{supplierId}
update sup_supplier_company set del_flag = '2' where supplier_id = #{supplierId}
</delete>
<delete id="deleteBmsSupplierCompanyByCompanyId" parameterType="Long">
update bms_supplier_company set del_flag = '2' where company_id = #{companyId}
update sup_supplier_company set del_flag = '2' where company_id = #{companyId}
</delete>
<!-- ========== bms_supplier_contact 子表 ========== -->
<!-- ========== sup_supplier_contact 子表 ========== -->
<resultMap type="com.ruoyi.customer.supplierinfo.domain.BmsSupplierContact" id="BmsSupplierContactResult">
<result property="contactId" column="contact_id" />
<result property="supplierId" column="supplier_id" />
@@ -502,7 +502,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBmsSupplierContactVo">
select contact_id, supplier_id, contact_name, position, department, phone, landline, email, wechat, qq, country, province, city, district, contact_address, postal_code, is_default, contact_type, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_supplier_contact
select contact_id, supplier_id, contact_name, position, department, phone, landline, email, wechat, qq, country, province, city, district, contact_address, postal_code, is_default, contact_type, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from sup_supplier_contact
</sql>
<select id="selectBmsSupplierContactList" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierContact" resultMap="BmsSupplierContactResult">
@@ -524,7 +524,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmsSupplierContact" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierContact" useGeneratedKeys="true" keyProperty="contactId">
insert into bms_supplier_contact
insert into sup_supplier_contact
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="supplierId != null">supplier_id,</if>
<if test="contactName != null">contact_name,</if>
@@ -576,7 +576,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateBmsSupplierContact" parameterType="com.ruoyi.customer.supplierinfo.domain.BmsSupplierContact">
update bms_supplier_contact
update sup_supplier_contact
<trim prefix="SET" suffixOverrides=",">
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="contactName != null">contact_name = #{contactName},</if>
@@ -604,11 +604,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBmsSupplierContactBySupplierId" parameterType="Long">
update bms_supplier_contact set del_flag = '2' where supplier_id = #{supplierId}
update sup_supplier_contact set del_flag = '2' where supplier_id = #{supplierId}
</delete>
<delete id="deleteBmsSupplierContactByContactId" parameterType="Long">
update bms_supplier_contact set del_flag = '2' where contact_id = #{contactId}
update sup_supplier_contact set del_flag = '2' where contact_id = #{contactId}
</delete>
</mapper>
@@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.status as status,
coalesce(q.total_quota, 0) as totalQuota,
(select coalesce(sum(g.remaining), 0)
from customer_credit_grant g
from ctr_customer_credit_grant g
where g.role_id = r.role_id and g.status = '0' and g.del_flag = '0') as usedQuota,
q.remark as remark
from sys_role r
@@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.status as status,
q.total_quota as totalQuota,
(select coalesce(sum(g.remaining), 0)
from customer_credit_grant g
from ctr_customer_credit_grant g
where g.role_id = r.role_id and g.status = '0' and g.del_flag = '0') as usedQuota,
q.remark as remark
from sys_user_role ur
@@ -50,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="sumActiveRemaining" resultType="java.math.BigDecimal">
select coalesce(sum(remaining), 0)
from customer_credit_grant
from ctr_customer_credit_grant
where role_id = #{roleId} and status = '0' and del_flag = '0'
</select>
@@ -109,8 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
c.customer_code, c.customer_name,
r.role_name,
u.user_name as approve_by
from customer_credit_grant g
left join bms_customer c on c.customer_id = g.customer_id
from ctr_customer_credit_grant g
left join ctr_customer c on c.customer_id = g.customer_id
left join sys_role r on r.role_id = g.role_id
left join sys_user u on u.user_id = g.approve_user_id
</sql>
@@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select grant_id, customer_id, account_id, role_id, approve_user_id, apply_id, flow_id,
credit_type, amount, remaining, effective_date, expire_date, status,
create_by, create_time, update_by, update_time, del_flag
from customer_credit_grant
from ctr_customer_credit_grant
where customer_id = #{customerId}
and credit_type = #{creditType}
and status = '0'
@@ -145,7 +145,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertGrant" parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditGrant"
useGeneratedKeys="true" keyProperty="grantId">
insert into customer_credit_grant (
insert into ctr_customer_credit_grant (
customer_id, account_id, role_id, approve_user_id, apply_id, flow_id,
credit_type, amount, remaining, effective_date, expire_date, status,
create_by, create_time, remark, del_flag
@@ -158,7 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateGrantRemaining"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditGrant">
update customer_credit_grant
update ctr_customer_credit_grant
set remaining = #{remaining},
status = #{status},
release_time = #{releaseTime},
@@ -44,8 +44,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.del_flag,
c.customer_code, c.customer_name,
r.role_name as approve_role_name
from customer_credit_apply a
left join bms_customer c on c.customer_id = a.customer_id
from ctr_customer_credit_apply a
left join ctr_customer c on a.customer_id = c.customer_id
left join sys_role r on r.role_id = a.approve_role_id
</sql>
@@ -75,13 +75,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectApplyByIdForUpdate" resultMap="CustomerCreditApplyResult">
select * from customer_credit_apply where apply_id = #{applyId} and del_flag = '0' for update
select * from ctr_customer_credit_apply where apply_id = #{applyId} and del_flag = '0' for update
</select>
<insert id="insertApply"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply"
useGeneratedKeys="true" keyProperty="applyId">
insert into customer_credit_apply (
insert into ctr_customer_credit_apply (
apply_no, customer_id, credit_type, adjust_mode, change_amount,
effective_date, expire_date, reason, status,
apply_by, apply_user_id, apply_time,
@@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateApproved"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply">
update customer_credit_apply
update ctr_customer_credit_apply
set status = 'APPROVED',
account_id = #{accountId},
flow_id = #{flowId},
@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateRejected"
parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditApply">
update customer_credit_apply
update ctr_customer_credit_apply
set status = 'REJECTED',
approve_by = #{approveBy},
approve_user_id = #{approveUserId},
@@ -124,7 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateCancelled">
update customer_credit_apply
update ctr_customer_credit_apply
set status = 'CANCELLED',
update_by = #{updateBy},
update_time = sysdate()
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
credit_effective_date, credit_expire_date, 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
from ctr_customer_account
</sql>
<select id="selectAccountByCustomerCurrency" resultMap="CustomerAccountResult">
@@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 扫描已到期授信的CNY账户(信用或临时额度失效日早于今天;失效日当天仍有效,故严格小于今天) -->
<select id="selectExpiredCreditCustomerIds" resultType="java.lang.Long">
select distinct customer_id
from customer_account
from ctr_customer_account
where del_flag = '0'
and currency = 'CNY'
and (
@@ -67,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertAccount" parameterType="com.ruoyi.customer.customermoney.domain.CustomerAccount"
useGeneratedKeys="true" keyProperty="id">
insert into customer_account
insert into ctr_customer_account
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="currency != null">currency,</if>
@@ -99,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="updateAccountBalance">
update customer_account
update ctr_customer_account
set balance = #{balance},
frozen_balance = #{frozenBalance},
used_credit = #{usedCredit},
@@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 乐观锁更新额度(信用/临时额度及各自有效期) -->
<update id="updateAccountCredit">
update customer_account
update ctr_customer_account
set total_credit = #{totalCredit},
credit_effective_date = #{creditEffectiveDate},
credit_expire_date = #{creditExpireDate},
@@ -159,7 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
before_amount, change_amount, after_amount, used_credit,
effective_date, expire_date, reason, adjust_mode, operator_id, role_id,
create_by, create_time, update_by, update_time, remark, del_flag
from customer_credit_flow
from ctr_customer_credit_flow
</sql>
<select id="selectCreditFlowList" parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditFlow"
@@ -180,7 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertCreditFlow" parameterType="com.ruoyi.customer.customermoney.domain.CustomerCreditFlow"
useGeneratedKeys="true" keyProperty="id">
insert into customer_credit_flow
insert into ctr_customer_credit_flow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="flowNo != null">flow_no,</if>
<if test="customerId != null">customer_id,</if>
@@ -275,9 +275,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
r.received_at, r.status,
r.confirmed_at, r.confirmed_by, r.invoice_status, r.version, r.create_by, r.create_time,
r.update_by, r.update_time, r.remark, r.del_flag,
(select count(1) from bms_customer_attachment a
(select count(1) from ctr_customer_attachment a
where a.biz_id = r.id and a.attachment_type = '3' and a.del_flag = '0') as attachment_count
from customer_receipt r
from ctr_customer_receipt r
</sql>
<select id="selectReceiptList" parameterType="com.ruoyi.customer.customermoney.domain.CustomerReceipt"
@@ -312,7 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertReceipt" parameterType="com.ruoyi.customer.customermoney.domain.CustomerReceipt"
useGeneratedKeys="true" keyProperty="id">
insert into customer_receipt
insert into ctr_customer_receipt
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="receiptNo != null">receipt_no,</if>
<if test="customerId != null">customer_id,</if>
@@ -374,7 +374,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update id="confirmReceipt" parameterType="com.ruoyi.customer.customermoney.domain.CustomerReceipt">
update customer_receipt
update ctr_customer_receipt
set status = 'CONFIRMED',
confirmed_at = #{confirmedAt},
confirmed_by = #{confirmedBy},
@@ -385,7 +385,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="cancelReceipt">
update customer_receipt
update ctr_customer_receipt
set status = 'CANCELLED',
update_by = #{updateBy},
update_time = now()
@@ -424,7 +424,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
direction, amount,
before_balance, after_balance, before_frozen_balance, after_frozen_balance, operator_id,
create_by, create_time, update_by, update_time, remark, del_flag
from customer_balance_flow
from ctr_customer_balance_flow
</sql>
<select id="selectFlowList" parameterType="com.ruoyi.customer.customermoney.domain.CustomerBalanceFlow"
@@ -450,7 +450,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertFlow" parameterType="com.ruoyi.customer.customermoney.domain.CustomerBalanceFlow"
useGeneratedKeys="true" keyProperty="id">
insert into customer_balance_flow
insert into ctr_customer_balance_flow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="flowNo != null">flow_no,</if>
<if test="customerId != null">customer_id,</if>
+2 -2
View File
@@ -1,6 +1,6 @@
DROP TABLE IF EXISTS `bms_customer`;
DROP TABLE IF EXISTS `ctr_customer`;
CREATE TABLE `bms_customer` (
CREATE TABLE `ctr_customer` (
`customer_id` VARCHAR(32) NOT NULL AUTO_INCREMENT COMMENT '客户ID',
`customer_code` varchar(50) NOT NULL COMMENT '客户编码',
`customer_name` varchar(100) NOT NULL COMMENT '客户名称',
@@ -1,13 +1,13 @@
-- =============================================================
-- 客户额度调整申请/审批表
-- 信用额度、额外额度(临时额度)调整不再直接生效:
-- 先申请(PENDING)-> 审批通过(APPROVED)后才真正调整 customer_account
-- 并生成 customer_credit_flow 额度流水;可驳回(REJECTED)/撤销(CANCELLED)
-- 先申请(PENDING)-> 审批通过(APPROVED)后才真正调整 ctr_customer_account
-- 并生成 ctr_customer_credit_flow 额度流水;可驳回(REJECTED)/撤销(CANCELLED)
-- 2026-09-16
-- =============================================================
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_credit_apply` (
CREATE TABLE IF NOT EXISTS `ctr_customer_credit_apply` (
`apply_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '申请单ID',
`apply_no` VARCHAR(64) NOT NULL COMMENT '申请单号(EDSQ前缀)',
`customer_id` BIGINT(20) NOT NULL COMMENT '客户ID',
@@ -26,7 +26,7 @@ CREATE TABLE IF NOT EXISTS `customer_credit_apply` (
`approve_user_id` BIGINT(20) DEFAULT NULL COMMENT '审批人ID',
`approve_time` DATETIME DEFAULT NULL COMMENT '审批时间',
`approve_remark` VARCHAR(255) DEFAULT NULL COMMENT '审批意见/驳回原因',
`flow_id` BIGINT(20) DEFAULT NULL COMMENT '审批通过后生成的额度流水ID(customer_credit_flow.id)',
`flow_id` BIGINT(20) DEFAULT NULL COMMENT '审批通过后生成的额度流水ID(ctr_customer_credit_flow.id)',
`remark` VARCHAR(500) DEFAULT NULL COMMENT '备注',
`create_by` VARCHAR(64) DEFAULT '' COMMENT '创建者',
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -1,5 +1,5 @@
DROP TABLE IF EXISTS `customer_account`;
CREATE TABLE `customer_account` (
DROP TABLE IF EXISTS `ctr_customer_account`;
CREATE TABLE `ctr_customer_account` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`customer_id` BIGINT(20) NOT NULL COMMENT '客户ID',
`currency` CHAR(3) NOT NULL DEFAULT 'CNY' COMMENT '币种,如 CNY/USD',
@@ -21,8 +21,8 @@ CREATE TABLE `customer_account` (
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户余额表';
DROP TABLE IF EXISTS `customer_receipt`;
CREATE TABLE `customer_receipt` (
DROP TABLE IF EXISTS `ctr_customer_receipt`;
CREATE TABLE `ctr_customer_receipt` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`receipt_no` VARCHAR(64) NOT NULL COMMENT '收款单号',
`customer_id` BIGINT(20) NOT NULL COMMENT '客户ID',
@@ -55,7 +55,7 @@ CREATE TABLE `customer_receipt` (
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='客户收款表';
CREATE TABLE `customer_balance_flow` (
CREATE TABLE `ctr_customer_balance_flow` (
`id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`flow_no` VARCHAR(64) NOT NULL COMMENT '流水号',
`customer_id` BIGINT(20) NOT NULL COMMENT '客户ID',
@@ -84,7 +84,7 @@ CREATE TABLE `customer_balance_flow` (
KEY `idx_biz` (`biz_type`, `biz_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='余额流水表';
-- 收款单附件复用客户附件表:attachment_type='3'(其他),biz_id 关联 customer_receipt.id
ALTER TABLE `bms_customer_attachment`
-- 收款单附件复用客户附件表:attachment_type='3'(其他),biz_id 关联 ctr_customer_receipt.id
ALTER TABLE `ctr_customer_attachment`
ADD COLUMN `biz_id` BIGINT(20) DEFAULT NULL COMMENT '关联业务ID(如收款单ID,attachment_type=3时使用)' AFTER `attachment_type`,
ADD KEY `idx_biz_id` (`biz_id`);
@@ -0,0 +1,33 @@
-- =============================================================
-- 表名按模块缩写重命名
-- 供应商模块:bms_supplier* -> sup_supplier*
-- 客户模块: bms_customer* -> ctr_customer*
-- customer_* -> ctr_customer_*
-- 2026-09-24
-- 说明:
-- 1. 14 张表均无外键约束(子表通过 customer_id/supplier_id 逻辑关联),可直接 RENAME;
-- 2. RENAME TABLE 为单条 DDL,MySQL 原子执行;
-- 3. 同步更新代码生成器元数据 gen_table.table_name;
-- 4. 注意:bms_customer_attachment.biz_type 中的枚举值 'customer_receipt' 是业务类型,
-- 不是表名,保持不变。
-- =============================================================
SET NAMES utf8mb4;
RENAME TABLE
bms_supplier TO sup_supplier,
bms_supplier_attachment TO sup_supplier_attachment,
bms_supplier_company TO sup_supplier_company,
bms_supplier_contact TO sup_supplier_contact,
bms_customer TO ctr_customer,
bms_customer_attachment TO ctr_customer_attachment,
bms_customer_company TO ctr_customer_company,
bms_customer_contact TO ctr_customer_contact,
customer_account TO ctr_customer_account,
customer_balance_flow TO ctr_customer_balance_flow,
customer_credit_apply TO ctr_customer_credit_apply,
customer_credit_flow TO ctr_customer_credit_flow,
customer_credit_grant TO ctr_customer_credit_grant,
customer_receipt TO ctr_customer_receipt;
-- 代码生成器元数据(类名 BmsCustomer 不变,仅表名同步)
UPDATE gen_table SET table_name = 'ctr_customer' WHERE table_name = 'bms_customer';
@@ -1,29 +1,29 @@
-- =============================================================
-- 角色额度池 + 客户信用额度有效期 改造
-- 1. customer_account 新增信用额度生效/失效日期(与临时额度口径一致,到期次日自动清零)
-- 2. customer_credit_apply 新增 approve_role_id,记录审批占用的额度池角色
-- 3. customer_credit_flow 新增 role_id,流水留痕额度池归属角色
-- 1. ctr_customer_account 新增信用额度生效/失效日期(与临时额度口径一致,到期次日自动清零)
-- 2. ctr_customer_credit_apply 新增 approve_role_id,记录审批占用的额度池角色
-- 3. ctr_customer_credit_flow 新增 role_id,流水留痕额度池归属角色
-- 4. 新表 sys_role_credit_quota:管理员为角色设置的可分配额度总额(额度池)
-- 5. 新表 customer_credit_grant:审批增量额度的占用台账(池余额=该表remaining求和)
-- 5. 新表 ctr_customer_credit_grant:审批增量额度的占用台账(池余额=该表remaining求和)
-- 2026-09-20
-- 说明:ALTER 语句非自动幂等,若字段/表已存在,对应语句会报 Duplicate/already exists,忽略即可
-- =============================================================
SET NAMES utf8mb4;
-- -------------------------------------------------------------
-- 1. customer_account:信用额度有效期
-- 1. ctr_customer_account:信用额度有效期
-- -------------------------------------------------------------
ALTER TABLE `customer_account`
ALTER TABLE `ctr_customer_account`
ADD COLUMN `credit_effective_date` DATE DEFAULT NULL COMMENT '信用额度生效日期' AFTER `total_credit`,
ADD COLUMN `credit_expire_date` DATE DEFAULT NULL COMMENT '信用额度失效日期(空=长期;到期次日清零)' AFTER `credit_effective_date`;
-- -------------------------------------------------------------
-- 2. customer_credit_apply / customer_credit_flow:额度池归属
-- 2. ctr_customer_credit_apply / ctr_customer_credit_flow:额度池归属
-- -------------------------------------------------------------
ALTER TABLE `customer_credit_apply`
ALTER TABLE `ctr_customer_credit_apply`
ADD COLUMN `approve_role_id` BIGINT(20) DEFAULT NULL COMMENT '审批占用的额度池角色ID(NULL=超管审批不占池)' AFTER `approve_user_id`;
ALTER TABLE `customer_credit_flow`
ALTER TABLE `ctr_customer_credit_flow`
ADD COLUMN `role_id` BIGINT(20) DEFAULT NULL COMMENT '额度池角色ID(审批调整流水留痕;NULL=超管/系统)' AFTER `operator_id`;
-- -------------------------------------------------------------
@@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS `sys_role_credit_quota` (
-- 角色池已用 = SUM(remaining WHERE role_id=? AND status='0')
-- role_id 为 NULL 表示超管审批(不占池)或历史/建档直配额度。
-- -------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `customer_credit_grant` (
CREATE TABLE IF NOT EXISTS `ctr_customer_credit_grant` (
`grant_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '台账ID',
`customer_id` BIGINT(20) NOT NULL COMMENT '客户ID',
`account_id` BIGINT(20) NOT NULL COMMENT '客户账户ID',
+4 -4
View File
@@ -1,17 +1,17 @@
-- 假设开发库表里无重要数据,直接 ALTER;如有数据需先备份迁移
-- 1) 客户主表
ALTER TABLE bms_customer MODIFY COLUMN customer_id varchar(32) NOT NULL COMMENT '客户ID(UUID)';
ALTER TABLE ctr_customer MODIFY COLUMN customer_id varchar(32) NOT NULL COMMENT '客户ID(UUID)';
-- 2) 供应商主表
ALTER TABLE bms_supplier MODIFY COLUMN supplier_id varchar(32) NOT NULL COMMENT '供应商ID(UUID)';
ALTER TABLE sup_supplier MODIFY COLUMN supplier_id varchar(32) NOT NULL COMMENT '供应商ID(UUID)';
select * from sys_menu
DROP TABLE IF EXISTS `bms_supplier`;
DROP TABLE IF EXISTS `sup_supplier`;
CREATE TABLE `bms_supplier` (
CREATE TABLE `sup_supplier` (
-- ========== 主键 ==========
`supplier_id` VARCHAR(32) NOT NULL AUTO_INCREMENT COMMENT '供应商ID',