修改对外代码查询
This commit is contained in:
@@ -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
|
||||
FROM ctr_customer
|
||||
WHERE
|
||||
<foreach collection="keywords" item="kw" separator=" OR ">
|
||||
customer_code = #{kw} OR customer_name = #{kw}
|
||||
</foreach>
|
||||
SELECT DISTINCT code FROM (
|
||||
SELECT customer_code AS code
|
||||
FROM ctr_customer
|
||||
WHERE customer_code IS NOT NULL AND customer_code <> ''
|
||||
AND (
|
||||
<foreach collection="keywords" item="kw" separator=" OR ">
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user