修改对外代码查询
This commit is contained in:
@@ -61,6 +61,14 @@ public class CustomerKeywordResolver
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pass-through raw keywords (covers codes not yet in ctr_customer)
|
||||
for (String kw : keywords)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(kw))
|
||||
{
|
||||
codes.add(kw.trim());
|
||||
}
|
||||
}
|
||||
query.setCustomerCodes(codes.isEmpty() ? null : new ArrayList<String>(codes));
|
||||
// 名称已全部解析为代码;Oracle 侧不保留跨列 OR 条件
|
||||
query.setCustomerKeywords(null);
|
||||
|
||||
@@ -4,14 +4,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.price.mapper.CustomerCodeResolveMapper">
|
||||
|
||||
<!-- 客户主数据仅 200 余行,名称精确匹配在 MySQL 侧代价极低 -->
|
||||
<!--
|
||||
Resolve customer keywords to codes for Oracle TAB_ORDER.CUSTOMER_CODE IN (...).
|
||||
Match: customer_code / customer_name / customer_code_dw (对外代码).
|
||||
Return both internal code and outer code so either form on TAB_ORDER hits.
|
||||
-->
|
||||
<select id="selectCustomerCodesByKeywords" resultType="java.lang.String">
|
||||
SELECT customer_code
|
||||
SELECT DISTINCT code FROM (
|
||||
SELECT customer_code AS code
|
||||
FROM ctr_customer
|
||||
WHERE
|
||||
WHERE customer_code IS NOT NULL AND customer_code <> ''
|
||||
AND (
|
||||
<foreach collection="keywords" item="kw" separator=" OR ">
|
||||
customer_code = #{kw} OR customer_name = #{kw}
|
||||
customer_code = #{kw} OR customer_name = #{kw} OR customer_code_dw = #{kw}
|
||||
</foreach>
|
||||
)
|
||||
UNION ALL
|
||||
SELECT customer_code_dw AS code
|
||||
FROM ctr_customer
|
||||
WHERE customer_code_dw IS NOT NULL AND customer_code_dw <> ''
|
||||
AND (
|
||||
<foreach collection="keywords" item="kw" separator=" OR ">
|
||||
customer_code = #{kw} OR customer_name = #{kw} OR customer_code_dw = #{kw}
|
||||
</foreach>
|
||||
)
|
||||
) t
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -136,7 +136,7 @@ const searchColumns = [
|
||||
label: '客户',
|
||||
prop: 'customerKeywords',
|
||||
component: 'textarea',
|
||||
placeholder: '客户名称/客户代码,一行一个',
|
||||
placeholder: '客户名称/客户编码/对外代码,一行一个',
|
||||
props: {
|
||||
rows: 2,
|
||||
autosize: { minRows: 1, maxRows: 4 },
|
||||
|
||||
Reference in New Issue
Block a user