供应商管理数据同步, tms系统产品,服务渠道,产品渠道关系数据同步
This commit is contained in:
+14
-8
@@ -4,13 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.customer.supplierinfo.mapper.OracleSupplierSyncMapper">
|
||||
|
||||
<!-- 老系统供应商主表全量读取;只取 sup_supplier 能承接的列。
|
||||
三个类型字段口径以 TAB_SUPPLIER 为准:
|
||||
SUP_TYPE 1卡车行 2航司代理 3报关行 4清关行 5尾派服务商 6报关代理
|
||||
INVOICE_TYPE 1增普 2增专 3电普 4其他普票;KACHE_TYPE 0国内 1国外 -->
|
||||
<select id="selectAllTabSupplier" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT SUP_CODE, SUP_NAME, SUP_TYPE, INVOICE_TYPE, KACHE_TYPE,
|
||||
BL_OPEN, QUOTA, SETTLEMENT_PERIOD, REMARK, CREATE_TIME
|
||||
FROM WEISHI_USER.TAB_SUPPLIER
|
||||
<!-- 服务商(供应商)主数据:TAB_SERVICE_INFO(2026-10-10 起替代取数错误的 TAB_SUPPLIER)
|
||||
SERVICE_TYPE 为中文口径:尾程渠道 -> 供应商类型 5(尾派服务商),清关 -> 4(清关行);
|
||||
BL_OPEN:1 启用,其余停用 -->
|
||||
<select id="selectAllServiceInfo" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT SERVICE_CODE, SERVICE_NAME, SERVICE_TYPE, BL_OPEN, REMARK, CREATE_DATE
|
||||
FROM WEISHI_USER.TAB_SERVICE_INFO
|
||||
</select>
|
||||
|
||||
<!-- 服务渠道:TAB_SERVICE_CHANNEL,按 SERVICE_CODE 归属于服务商;
|
||||
同步时将同一服务商下全部渠道编码(含停用)聚合写入 sup_supplier.channel_ids -->
|
||||
<select id="selectAllServiceChannel" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT SERVICE_CODE, CHANNEL_CODE
|
||||
FROM WEISHI_USER.TAB_SERVICE_CHANNEL
|
||||
ORDER BY SERVICE_CODE, CHANNEL_CODE
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -12,33 +12,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
INSERT INTO sup_supplier (
|
||||
supplier_code, supplier_name, is_enable, del_flag, create_by
|
||||
<if test="supplierType != null">, supplier_type</if>
|
||||
<if test="invoiceType != null">, invoice_type</if>
|
||||
<if test="kacheType != null">, kache_type</if>
|
||||
<if test="ed != null">, ed</if>
|
||||
<if test="zq != null">, zq</if>
|
||||
<if test="channelIds != null">, channel_ids</if>
|
||||
<if test="remark != null">, remark</if>
|
||||
<if test="createTime != null">, create_time</if>
|
||||
) VALUES (
|
||||
#{supplierCode}, #{supplierName}, #{isEnable}, '0', #{createBy}
|
||||
<if test="supplierType != null">, #{supplierType}</if>
|
||||
<if test="invoiceType != null">, #{invoiceType}</if>
|
||||
<if test="kacheType != null">, #{kacheType}</if>
|
||||
<if test="ed != null">, #{ed}</if>
|
||||
<if test="zq != null">, #{zq}</if>
|
||||
<if test="channelIds != null">, #{channelIds}</if>
|
||||
<if test="remark != null">, #{remark}</if>
|
||||
<if test="createTime != null">, #{createTime}</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 同步源(TAB_SERVICE_INFO/CHANNEL)无开票类型、卡车行类型、额度、账期,
|
||||
更新时这些列一律不动,保留库内维护值;supplier_type/channel_ids 以源为准 -->
|
||||
<update id="updateSyncSupplierByCode" parameterType="com.bms.customer.supplierinfo.domain.BmsSupplier">
|
||||
UPDATE sup_supplier
|
||||
SET supplier_name = #{supplierName}
|
||||
, is_enable = #{isEnable}
|
||||
, supplier_type = #{supplierType}
|
||||
, invoice_type = #{invoiceType}
|
||||
, kache_type = #{kacheType}
|
||||
<if test="ed != null">, ed = #{ed}</if>
|
||||
<if test="zq != null">, zq = #{zq}</if>
|
||||
, channel_ids = #{channelIds}
|
||||
<if test="remark != null">, remark = #{remark}</if>
|
||||
, update_by = #{updateBy}
|
||||
, update_time = #{updateTime}
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.masterdata.mapper.ChannelMasterSyncMapper">
|
||||
|
||||
<!-- ============ 服务渠道 ============ -->
|
||||
<insert id="upsertServiceChannel">
|
||||
INSERT INTO srv_service_channel (
|
||||
id, channel_code, channel_name, service_code, service_name,
|
||||
bl_open, bl_multiple, cargo_type, pay_type, shipper_name, shipper_id,
|
||||
query_type, trajectory_code, final_service_name, des_port,
|
||||
weight_type, dim_divisor, weight_rule, shipment_type, data_from, remarks,
|
||||
create_name, create_man_code, create_date, modifier, modifier_code, modify_date,
|
||||
gmt_create, gmt_modified, sync_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.id}, #{it.channelCode}, #{it.channelName}, #{it.serviceCode}, #{it.serviceName},
|
||||
#{it.blOpen}, #{it.blMultiple}, #{it.cargoType}, #{it.payType}, #{it.shipperName}, #{it.shipperId},
|
||||
#{it.queryType}, #{it.trajectoryCode}, #{it.finalServiceName}, #{it.desPort},
|
||||
#{it.weightType}, #{it.dimDivisor}, #{it.weightRule}, #{it.shipmentType}, #{it.dataFrom}, #{it.remarks},
|
||||
#{it.createName}, #{it.createManCode}, #{it.createDate}, #{it.modifier}, #{it.modifierCode}, #{it.modifyDate},
|
||||
#{it.gmtCreate}, #{it.gmtModified}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
channel_code = VALUES(channel_code),
|
||||
channel_name = VALUES(channel_name),
|
||||
service_code = VALUES(service_code),
|
||||
service_name = VALUES(service_name),
|
||||
bl_open = VALUES(bl_open),
|
||||
bl_multiple = VALUES(bl_multiple),
|
||||
cargo_type = VALUES(cargo_type),
|
||||
pay_type = VALUES(pay_type),
|
||||
shipper_name = VALUES(shipper_name),
|
||||
shipper_id = VALUES(shipper_id),
|
||||
query_type = VALUES(query_type),
|
||||
trajectory_code = VALUES(trajectory_code),
|
||||
final_service_name = VALUES(final_service_name),
|
||||
des_port = VALUES(des_port),
|
||||
weight_type = VALUES(weight_type),
|
||||
dim_divisor = VALUES(dim_divisor),
|
||||
weight_rule = VALUES(weight_rule),
|
||||
shipment_type = VALUES(shipment_type),
|
||||
data_from = VALUES(data_from),
|
||||
remarks = VALUES(remarks),
|
||||
create_name = VALUES(create_name),
|
||||
create_man_code = VALUES(create_man_code),
|
||||
create_date = VALUES(create_date),
|
||||
modifier = VALUES(modifier),
|
||||
modifier_code = VALUES(modifier_code),
|
||||
modify_date = VALUES(modify_date),
|
||||
gmt_create = VALUES(gmt_create),
|
||||
gmt_modified = VALUES(gmt_modified),
|
||||
sync_time = NOW()
|
||||
</insert>
|
||||
|
||||
<!-- ============ 线路产品 ============ -->
|
||||
<insert id="upsertLineProduct">
|
||||
INSERT INTO srv_line_product (
|
||||
id, line_code, line_name, product_type, line_type, bl_cargo, cargo_name,
|
||||
product_storage, product_first, product_clearance,
|
||||
product_storage_code, product_first_code, product_clearance_code,
|
||||
bl_open, bl_section, disp_code, disp_name, fee_class,
|
||||
gmt_create, gmt_modified, shipper_id, shipment_rule, weight, cargo_type,
|
||||
product_category, volume_basis, weight_type, service_type, shipment_type,
|
||||
tax_amount, tax_currency, battery_type, remark,
|
||||
create_name, create_man_code, create_date, modifier, modifier_code, modify_date, sync_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.id}, #{it.lineCode}, #{it.lineName}, #{it.productType}, #{it.lineType}, #{it.blCargo}, #{it.cargoName},
|
||||
#{it.productStorage}, #{it.productFirst}, #{it.productClearance},
|
||||
#{it.productStorageCode}, #{it.productFirstCode}, #{it.productClearanceCode},
|
||||
#{it.blOpen}, #{it.blSection}, #{it.dispCode}, #{it.dispName}, #{it.feeClass},
|
||||
#{it.gmtCreate}, #{it.gmtModified}, #{it.shipperId}, #{it.shipmentRule}, #{it.weight}, #{it.cargoType},
|
||||
#{it.productCategory}, #{it.volumeBasis}, #{it.weightType}, #{it.serviceType}, #{it.shipmentType},
|
||||
#{it.taxAmount}, #{it.taxCurrency}, #{it.batteryType}, #{it.remark},
|
||||
#{it.createName}, #{it.createManCode}, #{it.createDate}, #{it.modifier}, #{it.modifierCode}, #{it.modifyDate}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
line_code = VALUES(line_code),
|
||||
line_name = VALUES(line_name),
|
||||
product_type = VALUES(product_type),
|
||||
line_type = VALUES(line_type),
|
||||
bl_cargo = VALUES(bl_cargo),
|
||||
cargo_name = VALUES(cargo_name),
|
||||
product_storage = VALUES(product_storage),
|
||||
product_first = VALUES(product_first),
|
||||
product_clearance = VALUES(product_clearance),
|
||||
product_storage_code = VALUES(product_storage_code),
|
||||
product_first_code = VALUES(product_first_code),
|
||||
product_clearance_code = VALUES(product_clearance_code),
|
||||
bl_open = VALUES(bl_open),
|
||||
bl_section = VALUES(bl_section),
|
||||
disp_code = VALUES(disp_code),
|
||||
disp_name = VALUES(disp_name),
|
||||
fee_class = VALUES(fee_class),
|
||||
gmt_create = VALUES(gmt_create),
|
||||
gmt_modified = VALUES(gmt_modified),
|
||||
shipper_id = VALUES(shipper_id),
|
||||
shipment_rule = VALUES(shipment_rule),
|
||||
weight = VALUES(weight),
|
||||
cargo_type = VALUES(cargo_type),
|
||||
product_category = VALUES(product_category),
|
||||
volume_basis = VALUES(volume_basis),
|
||||
weight_type = VALUES(weight_type),
|
||||
service_type = VALUES(service_type),
|
||||
shipment_type = VALUES(shipment_type),
|
||||
tax_amount = VALUES(tax_amount),
|
||||
tax_currency = VALUES(tax_currency),
|
||||
battery_type = VALUES(battery_type),
|
||||
remark = VALUES(remark),
|
||||
create_name = VALUES(create_name),
|
||||
create_man_code = VALUES(create_man_code),
|
||||
create_date = VALUES(create_date),
|
||||
modifier = VALUES(modifier),
|
||||
modifier_code = VALUES(modifier_code),
|
||||
modify_date = VALUES(modify_date),
|
||||
sync_time = NOW()
|
||||
</insert>
|
||||
|
||||
<!-- ============ 产品-渠道关系 ============ -->
|
||||
<insert id="upsertProductChannel">
|
||||
INSERT INTO srv_product_channel (
|
||||
guid, product_id, channel_code, channel_name, priority, is_enabled,
|
||||
line_code, line_name, country_code, start_weight, end_weight,
|
||||
order_count, order_count_ratio, sync_time
|
||||
) VALUES
|
||||
<foreach collection="list" item="it" separator=",">
|
||||
(#{it.guid}, #{it.productId}, #{it.channelCode}, #{it.channelName}, #{it.priority}, #{it.isEnabled},
|
||||
#{it.lineCode}, #{it.lineName}, #{it.countryCode}, #{it.startWeight}, #{it.endWeight},
|
||||
#{it.orderCount}, #{it.orderCountRatio}, NOW())
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
product_id = VALUES(product_id),
|
||||
channel_code = VALUES(channel_code),
|
||||
channel_name = VALUES(channel_name),
|
||||
priority = VALUES(priority),
|
||||
is_enabled = VALUES(is_enabled),
|
||||
line_code = VALUES(line_code),
|
||||
line_name = VALUES(line_name),
|
||||
country_code = VALUES(country_code),
|
||||
start_weight = VALUES(start_weight),
|
||||
end_weight = VALUES(end_weight),
|
||||
order_count = VALUES(order_count),
|
||||
order_count_ratio = VALUES(order_count_ratio),
|
||||
sync_time = NOW()
|
||||
</insert>
|
||||
</mapper>
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.masterdata.mapper.OracleChannelMasterMapper">
|
||||
|
||||
<select id="selectAllServiceChannel" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT ID, CHANNEL_CODE, CHANNEL_NAME, SERVICE_CODE, SERVICE_NAME,
|
||||
CREATE_NAME, CREATE_MAN_CODE, CREATE_DATE, MODIFIER, MODIFIER_CODE, MODIFY_DATE,
|
||||
BL_OPEN, BL_MULTIPLE, GMT_CREATE, GMT_MODIFIED, DATA_FROM, REMARKS,
|
||||
CARGO_TYPE, PAY_TYPE, SHIPPER_NAME, SHIPPER_ID, QUERY_TYPE, TRAJECTORY_CODE,
|
||||
FINAL_SERVICE_NAME, DES_PORT, WEIGHT_TYPE, DIM_DIVISOR, WEIGHT_RULE, SHIPMENT_TYPE
|
||||
FROM WEISHI_USER.TAB_SERVICE_CHANNEL
|
||||
</select>
|
||||
|
||||
<select id="selectAllLineProduct" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT ID, LINE_CODE, LINE_NAME, PRODUCT_TYPE, LINE_TYPE, BL_CARGO, CARGO_NAME,
|
||||
PRODUCT_STORAGE, PRODUCT_FIRST, PRODUCT_CLEARANCE, REMARK,
|
||||
CREATE_NAME, CREATE_MAN_CODE, CREATE_DATE, MODIFIER, MODIFIER_CODE, MODIFY_DATE,
|
||||
BL_OPEN, PRODUCT_STORAGE_CODE, PRODUCT_FIRST_CODE, PRODUCT_CLEARANCE_CODE,
|
||||
BL_SECTION, DISP_CODE, DISP_NAME, FEE_CLASS, GMT_CREATE, GMT_MODIFIED,
|
||||
SHIPPER_ID, SHIPMENT_RULE, WEIGHT, CARGO_TYPE, PRODUCT_CATEGORY, VOLUME_BASIS,
|
||||
WEIGHT_TYPE, SERVICE_TYPE, SHIPMENT_TYPE, TAX_AMOUNT, TAX_CURRENCY, BATTERY_TYPE
|
||||
FROM WEISHI_USER.TAB_LINE_PRODUCT
|
||||
</select>
|
||||
|
||||
<select id="selectAllProductChannel" resultType="java.util.HashMap" fetchSize="500">
|
||||
SELECT GUID, PRODUCT_ID, CHANNEL_NAME, CHANNEL_CODE, PRIORITY, IS_ENABLED,
|
||||
LINE_NAME, LINE_CODE, COUNTRY_CODE, START_WEIGHT, END_WEIGHT,
|
||||
ORDER_COUNT, ORDER_COUNT_RATIO
|
||||
FROM WEISHI_USER.TAB_PRODUCT_CHANNEL
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bms.masterdata.mapper.ServiceChannelMapper">
|
||||
|
||||
<resultMap id="ServiceChannelResult" type="com.bms.masterdata.domain.ServiceChannel">
|
||||
<result property="id" column="id"/>
|
||||
<result property="channelCode" column="channel_code"/>
|
||||
<result property="channelName" column="channel_name"/>
|
||||
<result property="serviceCode" column="service_code"/>
|
||||
<result property="serviceName" column="service_name"/>
|
||||
<result property="blOpen" column="bl_open"/>
|
||||
<result property="blMultiple" column="bl_multiple"/>
|
||||
<result property="cargoType" column="cargo_type"/>
|
||||
<result property="payType" column="pay_type"/>
|
||||
<result property="shipperName" column="shipper_name"/>
|
||||
<result property="shipperId" column="shipper_id"/>
|
||||
<result property="queryType" column="query_type"/>
|
||||
<result property="trajectoryCode" column="trajectory_code"/>
|
||||
<result property="finalServiceName" column="final_service_name"/>
|
||||
<result property="desPort" column="des_port"/>
|
||||
<result property="weightType" column="weight_type"/>
|
||||
<result property="dimDivisor" column="dim_divisor"/>
|
||||
<result property="weightRule" column="weight_rule"/>
|
||||
<result property="shipmentType" column="shipment_type"/>
|
||||
<result property="dataFrom" column="data_from"/>
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="createName" column="create_name"/>
|
||||
<result property="createManCode" column="create_man_code"/>
|
||||
<result property="createDate" column="create_date"/>
|
||||
<result property="modifier" column="modifier"/>
|
||||
<result property="modifierCode" column="modifier_code"/>
|
||||
<result property="modifyDate" column="modify_date"/>
|
||||
<result property="gmtCreate" column="gmt_create"/>
|
||||
<result property="gmtModified" column="gmt_modified"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectChannelVo">
|
||||
select id, channel_code, channel_name, service_code, service_name, bl_open, bl_multiple,
|
||||
cargo_type, pay_type, shipper_name, shipper_id, query_type, trajectory_code,
|
||||
final_service_name, des_port, weight_type, dim_divisor, weight_rule, shipment_type,
|
||||
data_from, remarks, create_name, create_man_code, create_date, modifier,
|
||||
modifier_code, modify_date, gmt_create, gmt_modified, sync_time
|
||||
from srv_service_channel
|
||||
</sql>
|
||||
|
||||
<select id="selectServiceChannelList" parameterType="com.bms.masterdata.domain.ServiceChannel" resultMap="ServiceChannelResult">
|
||||
<include refid="selectChannelVo"/>
|
||||
<where>
|
||||
<if test="channelCode != null and channelCode != ''">
|
||||
AND channel_code like concat('%', #{channelCode}, '%')
|
||||
</if>
|
||||
<if test="channelName != null and channelName != ''">
|
||||
AND channel_name like concat('%', #{channelName}, '%')
|
||||
</if>
|
||||
<if test="serviceCode != null and serviceCode != ''">
|
||||
AND service_code = #{serviceCode}
|
||||
</if>
|
||||
<if test="serviceName != null and serviceName != ''">
|
||||
AND service_name like concat('%', #{serviceName}, '%')
|
||||
</if>
|
||||
<if test="blOpen != null and blOpen != ''">
|
||||
AND bl_open = #{blOpen}
|
||||
</if>
|
||||
</where>
|
||||
order by service_code, channel_code
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user