统一修改ruoyi->bms
This commit is contained in:
@@ -0,0 +1,231 @@
|
||||
<?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.price.mapper.BmsProductCountryMapper">
|
||||
|
||||
<resultMap type="BmsProductCountry" id="BmsProductCountryResult">
|
||||
<id property="detailId" column="detail_id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="zoneCode" column="zone_code" />
|
||||
<result property="zoneName" column="zone_name" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="freightPrice" column="freight_price" />
|
||||
<result property="registrationFee" column="registration_fee" />
|
||||
<result property="sizeLimit" column="size_limit" />
|
||||
<result property="lastMile" column="last_mile" />
|
||||
<result property="leadTime" column="lead_time" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="effectStatus" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select detail_id, product_id, product_code, country_name, country_code, zone_id, zone_code, zone_name,
|
||||
weight_min, weight_max,
|
||||
freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
effective_date, expire_date, status, create_time, update_time
|
||||
from bms_product_country
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsProductCountryList" parameterType="BmsProductCountry" resultMap="BmsProductCountryResult">
|
||||
<include refid="selectVo"/>
|
||||
<where>
|
||||
<if test="productId != null">
|
||||
AND product_id = #{productId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code = #{productCode}
|
||||
</if>
|
||||
<if test="countryName != null and countryName != ''">
|
||||
AND country_name like concat('%', #{countryName}, '%')
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="zoneId != null">
|
||||
AND zone_id = #{zoneId}
|
||||
</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">
|
||||
AND zone_code = #{zoneCode}
|
||||
</if>
|
||||
<if test="weightMin != null">
|
||||
AND weight_min = #{weightMin}
|
||||
</if>
|
||||
<if test="weightMax != null">
|
||||
AND weight_max = #{weightMax}
|
||||
</if>
|
||||
<if test="effectiveDate != null">
|
||||
AND effective_date = #{effectiveDate}
|
||||
</if>
|
||||
<if test="openOnly != null and openOnly">
|
||||
AND expire_date is null
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
AND status = #{effectStatus}
|
||||
</if>
|
||||
</where>
|
||||
order by effective_date desc, country_name asc, zone_code asc, weight_min asc, detail_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsProductCountry" parameterType="BmsProductCountry" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into bms_product_country (
|
||||
product_id, product_code, country_name, country_code, zone_id, zone_code, zone_name,
|
||||
weight_min, weight_max,
|
||||
freight_price, registration_fee, size_limit, last_mile, lead_time,
|
||||
effective_date, expire_date, status, create_time
|
||||
) values (
|
||||
#{productId}, #{productCode}, #{countryName}, #{countryCode}, #{zoneId}, #{zoneCode}, #{zoneName},
|
||||
#{weightMin}, #{weightMax},
|
||||
#{freightPrice}, #{registrationFee}, #{sizeLimit}, #{lastMile}, #{leadTime},
|
||||
#{effectiveDate}, #{expireDate}, IFNULL(#{status}, '0'), sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 仅服务于明细编辑弹窗:前端每次提交全量可编辑字段,
|
||||
重量上限/失效日期允许写 null(= 不封顶 / 长期),故不用 <if> 守卫 -->
|
||||
<update id="updateBmsProductCountry" parameterType="BmsProductCountry">
|
||||
update bms_product_country
|
||||
set weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
freight_price = #{freightPrice},
|
||||
registration_fee = #{registrationFee},
|
||||
size_limit = #{sizeLimit},
|
||||
last_mile = #{lastMile},
|
||||
lead_time = #{leadTime},
|
||||
effective_date = #{effectiveDate},
|
||||
expire_date = #{expireDate},
|
||||
update_time = sysdate()
|
||||
where detail_id = #{detailId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByProductId" parameterType="Long">
|
||||
delete from bms_product_country where product_id = #{productId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCode" parameterType="String">
|
||||
delete from bms_product_country where product_code = #{productCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCodes">
|
||||
delete from bms_product_country where product_code in
|
||||
<foreach item="code" collection="array" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByProductCodeAndEffectiveDate">
|
||||
delete from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
and (
|
||||
(#{effectiveDate} is null and effective_date is null)
|
||||
or effective_date = #{effectiveDate}
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="selectMaxOpenEffectiveDate" resultType="java.util.Date">
|
||||
select max(effective_date) from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
</select>
|
||||
|
||||
<update id="expireOpenByProductCode">
|
||||
update bms_product_country
|
||||
set expire_date = #{newEffectiveDate},
|
||||
update_time = sysdate()
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
</update>
|
||||
|
||||
<update id="refreshStatusByDates">
|
||||
update bms_product_country
|
||||
set status = case
|
||||
when expire_date is not null and expire_date <= curdate() then '2'
|
||||
when effective_date is null or effective_date > curdate() then '0'
|
||||
else '1'
|
||||
end
|
||||
</update>
|
||||
|
||||
<delete id="deleteOpenByProductCodeAndEffectiveDate">
|
||||
delete from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (
|
||||
(#{effectiveDate} is null and effective_date is null)
|
||||
or effective_date = #{effectiveDate}
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="selectMatchByProductCountryWeight" resultMap="BmsProductCountryResult">
|
||||
<include refid="selectVo"/>
|
||||
where product_code = #{productCode}
|
||||
and weight_min <= #{weight}
|
||||
and weight_max >= #{weight}
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(country_code) = upper(#{countryCode})
|
||||
</when>
|
||||
<when test="countryName != null and countryName != ''">
|
||||
and country_name = #{countryName}
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1 = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="zoneCode != null and zoneCode != ''">
|
||||
and upper(ifnull(zone_code,'')) = upper(#{zoneCode})
|
||||
</when>
|
||||
<otherwise>
|
||||
and (zone_code is null or zone_code = '')
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="bizDate != null">
|
||||
and (effective_date is null or effective_date <= #{bizDate})
|
||||
and (expire_date is null or expire_date > #{bizDate})
|
||||
</if>
|
||||
<if test="bizDate == null">
|
||||
and expire_date is null
|
||||
</if>
|
||||
order by effective_date desc, weight_min asc, detail_id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="countZonedByProductCountry" resultType="int">
|
||||
select count(1)
|
||||
from bms_product_country
|
||||
where product_code = #{productCode}
|
||||
and zone_code is not null and zone_code <> ''
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
and upper(country_code) = upper(#{countryCode})
|
||||
</when>
|
||||
<when test="countryName != null and countryName != ''">
|
||||
and country_name = #{countryName}
|
||||
</when>
|
||||
<otherwise>
|
||||
and 1 = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="bizDate != null">
|
||||
and (effective_date is null or effective_date <= #{bizDate})
|
||||
and (expire_date is null or expire_date > #{bizDate})
|
||||
</if>
|
||||
<if test="bizDate == null">
|
||||
and expire_date is null
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,196 @@
|
||||
<?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.price.mapper.BmsProductMapper">
|
||||
|
||||
<resultMap type="BmsProduct" id="BmsProductResult">
|
||||
<id property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="serviceLevel" column="service_level" />
|
||||
<result property="cargoAttr" column="cargo_attr" />
|
||||
<result property="destRegion" column="dest_region" />
|
||||
<result property="updateNote" column="update_note" />
|
||||
<result property="taxMode" column="tax_mode" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="sourceSheet" column="source_sheet" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="countryCount" column="country_count" />
|
||||
<result property="surchargeCount" column="surcharge_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmsProductVo">
|
||||
select p.product_id, p.product_code, p.product_name, p.service_level, p.cargo_attr,
|
||||
p.dest_region, p.update_note, p.tax_mode, p.effective_date, p.expire_date, p.status,
|
||||
p.source_sheet, p.remark, p.tms_id, p.created_by, p.create_time, p.updated_by, p.update_time,
|
||||
(select count(distinct c.country_name) from bms_product_country c
|
||||
where c.product_id = p.product_id
|
||||
or (c.product_id is null and c.product_code = p.product_code
|
||||
and (
|
||||
(p.effective_date is null and c.effective_date is null)
|
||||
or c.effective_date = p.effective_date
|
||||
))
|
||||
) as country_count,
|
||||
(select count(*) from prc_surcharge_rel r where r.product_id = p.product_id) as surcharge_count
|
||||
from bms_product p
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsProductById" parameterType="Long" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_id = #{productId}
|
||||
</select>
|
||||
|
||||
<select id="selectBmsProductByCode" parameterType="String" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
order by p.effective_date desc, p.product_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBmsProductByCodeAndDate" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
<choose>
|
||||
<when test="effectiveDate != null">
|
||||
AND p.effective_date = #{effectiveDate}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND p.effective_date is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectEffectiveBmsProductByCode" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
where p.product_code = #{productCode}
|
||||
and (p.effective_date is null or #{bizDate} is null or p.effective_date <= #{bizDate})
|
||||
and (p.expire_date is null or #{bizDate} is null or p.expire_date > #{bizDate})
|
||||
order by p.effective_date desc, p.product_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectBmsProductList" parameterType="BmsProduct" resultMap="BmsProductResult">
|
||||
<include refid="selectBmsProductVo"/>
|
||||
<where>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND p.product_code like concat('%', #{productCode}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND p.product_name like concat('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="taxMode != null and taxMode != ''">
|
||||
AND p.tax_mode = #{taxMode}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND p.status = #{status}
|
||||
</if>
|
||||
<if test="effectStatus != null and effectStatus != ''">
|
||||
AND p.status = #{effectStatus}
|
||||
</if>
|
||||
<if test="cargoAttr != null and cargoAttr != ''">
|
||||
AND p.cargo_attr like concat('%', #{cargoAttr}, '%')
|
||||
</if>
|
||||
<if test="params != null and params.keyword != null and params.keyword != ''">
|
||||
AND (p.product_code like concat('%', #{params.keyword}, '%')
|
||||
OR p.product_name like concat('%', #{params.keyword}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
order by p.product_code asc, p.effective_date desc, p.product_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsProduct" parameterType="BmsProduct" useGeneratedKeys="true" keyProperty="productId">
|
||||
insert into bms_product (
|
||||
<if test="productCode != null and productCode != ''">product_code,</if>
|
||||
<if test="productName != null and productName != ''">product_name,</if>
|
||||
<if test="serviceLevel != null">service_level,</if>
|
||||
<if test="cargoAttr != null">cargo_attr,</if>
|
||||
<if test="destRegion != null">dest_region,</if>
|
||||
<if test="updateNote != null">update_note,</if>
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode,</if>
|
||||
<if test="effectiveDate != null">effective_date,</if>
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="sourceSheet != null">source_sheet,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="productCode != null and productCode != ''">#{productCode},</if>
|
||||
<if test="productName != null and productName != ''">#{productName},</if>
|
||||
<if test="serviceLevel != null">#{serviceLevel},</if>
|
||||
<if test="cargoAttr != null">#{cargoAttr},</if>
|
||||
<if test="destRegion != null">#{destRegion},</if>
|
||||
<if test="updateNote != null">#{updateNote},</if>
|
||||
<if test="taxMode != null and taxMode != ''">#{taxMode},</if>
|
||||
<if test="effectiveDate != null">#{effectiveDate},</if>
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="sourceSheet != null">#{sourceSheet},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateBmsProduct" parameterType="BmsProduct">
|
||||
update bms_product
|
||||
<set>
|
||||
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
|
||||
<if test="productName != null and productName != ''">product_name = #{productName},</if>
|
||||
<if test="serviceLevel != null">service_level = #{serviceLevel},</if>
|
||||
<if test="cargoAttr != null">cargo_attr = #{cargoAttr},</if>
|
||||
<if test="destRegion != null">dest_region = #{destRegion},</if>
|
||||
<if test="updateNote != null">update_note = #{updateNote},</if>
|
||||
<if test="taxMode != null and taxMode != ''">tax_mode = #{taxMode},</if>
|
||||
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
|
||||
expire_date = #{expireDate},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="tmsId != null">tms_id = #{tmsId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where product_id = #{productId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmsProductByIds" parameterType="Long">
|
||||
delete from bms_product where product_id in
|
||||
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
||||
#{productId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="expireOpenByProductCode">
|
||||
update bms_product
|
||||
set expire_date = #{newEffectiveDate},
|
||||
update_time = sysdate()
|
||||
where product_code = #{productCode}
|
||||
and expire_date is null
|
||||
and (effective_date is null or effective_date < #{newEffectiveDate})
|
||||
<if test="excludeId != null">
|
||||
and product_id <> #{excludeId}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="refreshStatusByDates">
|
||||
update bms_product
|
||||
set status = case
|
||||
when expire_date is not null and expire_date <= curdate() then '2'
|
||||
when effective_date is null or effective_date > curdate() then '0'
|
||||
else '1'
|
||||
end
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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.price.mapper.OracleUpstreamOrderMapper">
|
||||
|
||||
<!--
|
||||
Exact-match lookups only (no multi-column OR).
|
||||
Nested ROWNUM form helps Oracle use indexes on large TAB_ORDER.
|
||||
-->
|
||||
|
||||
<select id="selectByTransferNo" resultType="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${orderTable} WHERE TRANSFER_ORDER_ID = #{transferNo}
|
||||
) WHERE ROWNUM <= 1
|
||||
</select>
|
||||
|
||||
<select id="selectByOrderId" resultType="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${orderTable} WHERE ORDER_ID = #{orderNo}
|
||||
) WHERE ROWNUM <= 1
|
||||
</select>
|
||||
|
||||
<select id="selectByOrgOrderId" resultType="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${orderTable} WHERE ORG_ORDER_ID = #{orderNo}
|
||||
) WHERE ROWNUM <= 1
|
||||
</select>
|
||||
|
||||
<select id="selectByTrackId" resultType="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${orderTable} WHERE TRACK_ID = #{trackingNo}
|
||||
) WHERE ROWNUM <= 1
|
||||
</select>
|
||||
|
||||
<select id="selectByBarcode" resultType="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${orderTable} WHERE BARCODE_NUMBER = #{trackingNo}
|
||||
) WHERE ROWNUM <= 1
|
||||
</select>
|
||||
|
||||
<select id="selectByCustomerTrackId" resultType="java.util.HashMap">
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${orderTable} WHERE CUSTOMER_TRACK_ID = #{trackingNo}
|
||||
) WHERE ROWNUM <= 1
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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.price.mapper.PrcBillingTaskMapper">
|
||||
|
||||
<resultMap type="PrcBillingTask" id="PrcBillingTaskResult">
|
||||
<id property="taskId" column="task_id" />
|
||||
<result property="transferNo" column="transfer_no" />
|
||||
<result property="trackingNo" column="tracking_no" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="billType" column="bill_type" />
|
||||
<result property="successStatus" column="success_status" />
|
||||
<result property="billTime" column="bill_time" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="errorMessage" column="error_message" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcBillingTaskVo">
|
||||
select task_id, transfer_no, tracking_no, order_no, bill_type, success_status,
|
||||
bill_time, bill_id, error_message, create_by, create_time, update_by, update_time
|
||||
from prc_billing_task
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcBillingTaskById" parameterType="Long" resultMap="PrcBillingTaskResult">
|
||||
<include refid="selectPrcBillingTaskVo"/>
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcBillingTaskList" parameterType="PrcBillingTask" resultMap="PrcBillingTaskResult">
|
||||
<include refid="selectPrcBillingTaskVo"/>
|
||||
<where>
|
||||
<if test="transferNo != null and transferNo != ''">
|
||||
AND transfer_no like concat('%', #{transferNo}, '%')
|
||||
</if>
|
||||
<if test="trackingNo != null and trackingNo != ''">
|
||||
AND tracking_no like concat('%', #{trackingNo}, '%')
|
||||
</if>
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
AND order_no like concat('%', #{orderNo}, '%')
|
||||
</if>
|
||||
<if test="billType != null and billType != ''">
|
||||
AND bill_type = #{billType}
|
||||
</if>
|
||||
<if test="successStatus != null and successStatus != ''">
|
||||
AND success_status = #{successStatus}
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
AND create_time >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND create_time <= #{params.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by task_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcBillingTask" parameterType="PrcBillingTask" useGeneratedKeys="true" keyProperty="taskId">
|
||||
insert into prc_billing_task (
|
||||
transfer_no, tracking_no, order_no, bill_type, success_status,
|
||||
bill_time, bill_id, error_message, create_by, create_time
|
||||
) values (
|
||||
#{transferNo}, #{trackingNo}, #{orderNo}, #{billType}, #{successStatus},
|
||||
#{billTime}, #{billId}, #{errorMessage}, #{createBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcBillingTask" parameterType="PrcBillingTask">
|
||||
update prc_billing_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="transferNo != null">transfer_no = #{transferNo},</if>
|
||||
<if test="trackingNo != null">tracking_no = #{trackingNo},</if>
|
||||
<if test="orderNo != null">order_no = #{orderNo},</if>
|
||||
<if test="billType != null">bill_type = #{billType},</if>
|
||||
<if test="successStatus != null">success_status = #{successStatus},</if>
|
||||
<if test="billTime != null">bill_time = #{billTime},</if>
|
||||
<if test="billId != null">bill_id = #{billId},</if>
|
||||
<if test="errorMessage != null">error_message = #{errorMessage},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</trim>
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<!-- Keep inbound transfer/tracking/order/bill_time; only write status result. -->
|
||||
<update id="updateBillingResult" parameterType="PrcBillingTask">
|
||||
update prc_billing_task
|
||||
set success_status = #{successStatus},
|
||||
bill_id = #{billId},
|
||||
error_message = #{errorMessage},
|
||||
update_time = sysdate()
|
||||
where task_id = #{taskId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,172 @@
|
||||
<?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.price.mapper.PrcCustomerPriceSetMapper">
|
||||
|
||||
<resultMap type="PrcCustomerPriceSet" id="PrcCustomerPriceSetResult">
|
||||
<id property="customerPricesetId" column="customer_priceset_id" />
|
||||
<result property="priceSetId" column="price_set_id" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="bindPriority" column="bind_priority" />
|
||||
<result property="prBegindate" column="pr_begindate" />
|
||||
<result property="prEnddate" column="pr_enddate" />
|
||||
<result property="priceSetNote" column="price_set_note" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcCustomerPriceSetVo">
|
||||
select customer_priceset_id, price_set_id, customer_id, customer_code, customer_name, bind_priority,
|
||||
pr_begindate, pr_enddate, price_set_note,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_customer_price_set
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcCustomerPriceSetById" parameterType="Long" resultMap="PrcCustomerPriceSetResult">
|
||||
<include refid="selectPrcCustomerPriceSetVo"/>
|
||||
where customer_priceset_id = #{customerPricesetId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcCustomerPriceSetList" parameterType="PrcCustomerPriceSet" resultMap="PrcCustomerPriceSetResult">
|
||||
<include refid="selectPrcCustomerPriceSetVo"/>
|
||||
<where>
|
||||
<if test="priceSetId != null">
|
||||
AND price_set_id = #{priceSetId}
|
||||
</if>
|
||||
<if test="customerId != null">
|
||||
AND customer_id = #{customerId}
|
||||
</if>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
AND customer_code = #{customerCode}
|
||||
</if>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
AND customer_name like concat('%', #{customerName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by bind_priority asc, customer_priceset_id asc
|
||||
</select>
|
||||
|
||||
<select id="countByPriceSetId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_customer_price_set where price_set_id = #{priceSetId}
|
||||
</select>
|
||||
|
||||
<select id="countByCustomerId" resultType="int">
|
||||
select count(1) from prc_customer_price_set
|
||||
where customer_id = #{customerId}
|
||||
<if test="excludeId != null">
|
||||
AND customer_priceset_id <> #{excludeId}
|
||||
</if>
|
||||
<if test="excludePriceSetId != null">
|
||||
AND price_set_id <> #{excludePriceSetId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countByCustomerCode" resultType="int">
|
||||
select count(1) from prc_customer_price_set
|
||||
where customer_code = #{customerCode}
|
||||
<if test="excludeId != null">
|
||||
AND customer_priceset_id <> #{excludeId}
|
||||
</if>
|
||||
<if test="excludePriceSetId != null">
|
||||
AND price_set_id <> #{excludePriceSetId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="countOverlap" resultType="int">
|
||||
select count(1)
|
||||
from prc_customer_price_set c
|
||||
inner join prc_price_set s on s.price_set_id = c.price_set_id
|
||||
where c.customer_id = #{customerId}
|
||||
and s.status = 'E'
|
||||
<if test="priceSetId != null">
|
||||
AND c.price_set_id <> #{priceSetId}
|
||||
</if>
|
||||
and c.pr_begindate <= ifnull(#{endDate}, '9999-12-31')
|
||||
and ifnull(c.pr_enddate, '9999-12-31') >= #{beginDate}
|
||||
</select>
|
||||
|
||||
<select id="selectEffectiveByCustomer" resultMap="PrcCustomerPriceSetResult">
|
||||
select c.customer_priceset_id, c.price_set_id, c.customer_id, c.customer_code, c.customer_name, c.bind_priority,
|
||||
c.pr_begindate, c.pr_enddate, c.price_set_note,
|
||||
c.created_by, c.create_time, c.updated_by, c.update_time
|
||||
from prc_customer_price_set c
|
||||
inner join prc_price_set s on s.price_set_id = c.price_set_id
|
||||
where c.customer_id = #{customerId}
|
||||
and ifnull(s.status, 'D') <> 'S'
|
||||
and (c.pr_begindate is null or c.pr_begindate <= #{bizDate})
|
||||
and ifnull(c.pr_enddate, '9999-12-31') >= #{bizDate}
|
||||
order by c.bind_priority asc, c.pr_begindate desc, c.customer_priceset_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectEffectiveByCustomerCode" resultMap="PrcCustomerPriceSetResult">
|
||||
select c.customer_priceset_id, c.price_set_id, c.customer_id, c.customer_code, c.customer_name, c.bind_priority,
|
||||
c.pr_begindate, c.pr_enddate, c.price_set_note,
|
||||
c.created_by, c.create_time, c.updated_by, c.update_time
|
||||
from prc_customer_price_set c
|
||||
inner join prc_price_set s on s.price_set_id = c.price_set_id
|
||||
where c.customer_code = #{customerCode}
|
||||
and ifnull(s.status, 'D') <> 'S'
|
||||
and (c.pr_begindate is null or c.pr_begindate <= #{bizDate})
|
||||
and ifnull(c.pr_enddate, '9999-12-31') >= #{bizDate}
|
||||
order by c.bind_priority asc, c.pr_begindate desc, c.customer_priceset_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcCustomerPriceSet" parameterType="PrcCustomerPriceSet" useGeneratedKeys="true" keyProperty="customerPricesetId">
|
||||
insert into prc_customer_price_set (
|
||||
<if test="priceSetId != null">price_set_id,</if>
|
||||
<if test="customerId != null">customer_id,</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code,</if>
|
||||
<if test="customerName != null">customer_name,</if>
|
||||
<if test="bindPriority != null">bind_priority,</if>
|
||||
<if test="prBegindate != null">pr_begindate,</if>
|
||||
<if test="prEnddate != null">pr_enddate,</if>
|
||||
<if test="priceSetNote != null">price_set_note,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="priceSetId != null">#{priceSetId},</if>
|
||||
<if test="customerId != null">#{customerId},</if>
|
||||
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
|
||||
<if test="customerName != null">#{customerName},</if>
|
||||
<if test="bindPriority != null">#{bindPriority},</if>
|
||||
<if test="prBegindate != null">#{prBegindate},</if>
|
||||
<if test="prEnddate != null">#{prEnddate},</if>
|
||||
<if test="priceSetNote != null">#{priceSetNote},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcCustomerPriceSet" parameterType="PrcCustomerPriceSet">
|
||||
update prc_customer_price_set
|
||||
<set>
|
||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||
<if test="customerCode != null">customer_code = #{customerCode},</if>
|
||||
<if test="customerName != null">customer_name = #{customerName},</if>
|
||||
<if test="bindPriority != null">bind_priority = #{bindPriority},</if>
|
||||
<if test="prBegindate != null">pr_begindate = #{prBegindate},</if>
|
||||
pr_enddate = #{prEnddate},
|
||||
<if test="priceSetNote != null">price_set_note = #{priceSetNote},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where customer_priceset_id = #{customerPricesetId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcCustomerPriceSetByIds" parameterType="Long">
|
||||
delete from prc_customer_price_set where customer_priceset_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcCustomerPriceSetByPriceSetId" parameterType="Long">
|
||||
delete from prc_customer_price_set where price_set_id = #{priceSetId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,166 @@
|
||||
<?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.price.mapper.PrcIncomeBillFeeMapper">
|
||||
|
||||
<resultMap type="PrcIncomeBillFee" id="PrcIncomeBillFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="incomeBillId" column="income_bill_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="feeName" column="fee_name" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="arBillStatus" column="ar_bill_status" />
|
||||
<result property="manualFlag" column="manual_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
||||
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
from prc_income_bill_fee
|
||||
where bill_id = #{billId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<select id="selectByBillIds" resultMap="PrcIncomeBillFeeResult">
|
||||
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
from prc_income_bill_fee
|
||||
where bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
order by bill_id, field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<select id="selectUnbilledByBillIds" resultMap="PrcIncomeBillFeeResult">
|
||||
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
from prc_income_bill_fee
|
||||
where ar_bill_status = #{arBillStatus}
|
||||
and bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
order by bill_id, field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<select id="selectByFeeId" parameterType="String" resultMap="PrcIncomeBillFeeResult">
|
||||
select fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
from prc_income_bill_fee
|
||||
where fee_id = #{feeId}
|
||||
</select>
|
||||
|
||||
<select id="countByBillIdAndArBillStatusAndFeeType" resultType="int">
|
||||
select count(1)
|
||||
from prc_income_bill_fee
|
||||
where bill_id = #{billId}
|
||||
and ar_bill_status = #{arBillStatus}
|
||||
and fee_type = #{feeType}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcIncomeBillFee" parameterType="PrcIncomeBillFee">
|
||||
insert into prc_income_bill_fee (
|
||||
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
) values (
|
||||
#{feeId}, #{billId}, #{incomeBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark},
|
||||
#{arBillStatus}, #{manualFlag}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
insert into prc_income_bill_fee (
|
||||
fee_id, bill_id, income_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark,
|
||||
ar_bill_status, manual_flag, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.feeId}, #{item.billId}, #{item.incomeBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
#{item.currency}, #{item.roundMode}, #{item.remark},
|
||||
#{item.arBillStatus}, #{item.manualFlag}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcIncomeBillFee" parameterType="PrcIncomeBillFee">
|
||||
update prc_income_bill_fee
|
||||
set fee_type = #{feeType},
|
||||
fee_name = #{feeName},
|
||||
sc_id = #{scId},
|
||||
amount = #{amount},
|
||||
currency = #{currency},
|
||||
round_mode = #{roundMode},
|
||||
remark = #{remark}
|
||||
where fee_id = #{feeId}
|
||||
</update>
|
||||
|
||||
<update id="updateArBillStatusByBillIds">
|
||||
update prc_income_bill_fee
|
||||
set ar_bill_status = #{toStatus}
|
||||
where ar_bill_status = #{fromStatus}
|
||||
and bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateArBillStatusByFeeIds">
|
||||
update prc_income_bill_fee
|
||||
set ar_bill_status = #{toStatus}
|
||||
where ar_bill_status = #{fromStatus}
|
||||
and fee_id in
|
||||
<foreach collection="feeIds" item="feeId" open="(" separator="," close=")">
|
||||
#{feeId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="restoreUnbilledIfNoActiveArBill">
|
||||
update prc_income_bill_fee f
|
||||
set f.ar_bill_status = 'UNBILLED'
|
||||
where f.ar_bill_status = 'BILLED'
|
||||
and f.fee_id in
|
||||
<foreach collection="feeIds" item="feeId" open="(" separator="," close=")">
|
||||
#{feeId}
|
||||
</foreach>
|
||||
and not exists (
|
||||
select 1
|
||||
from ar_bill_detail_fee df
|
||||
inner join ar_bill_detail d on d.detail_id = df.detail_id
|
||||
inner join ar_bill b on b.ar_bill_id = d.ar_bill_id
|
||||
where df.prc_income_bill_fee_id = f.fee_id
|
||||
and b.status <> 'VOID'
|
||||
)
|
||||
</update>
|
||||
|
||||
<update id="restoreUnbilledIfNoActiveArBillByArBillId">
|
||||
update prc_income_bill_fee f
|
||||
inner join ar_bill_detail_fee current_df on current_df.prc_income_bill_fee_id = f.fee_id
|
||||
inner join ar_bill_detail current_d on current_d.detail_id = current_df.detail_id
|
||||
and current_d.ar_bill_id = #{arBillId}
|
||||
set f.ar_bill_status = 'UNBILLED'
|
||||
where f.ar_bill_status = 'BILLED'
|
||||
and not exists (
|
||||
select 1
|
||||
from ar_bill_detail_fee other_df
|
||||
inner join ar_bill_detail other_d on other_d.detail_id = other_df.detail_id
|
||||
inner join ar_bill other_b on other_b.ar_bill_id = other_d.ar_bill_id
|
||||
where other_df.prc_income_bill_fee_id = f.fee_id
|
||||
and other_b.status <> 'VOID'
|
||||
and other_b.ar_bill_id <> #{arBillId}
|
||||
)
|
||||
</update>
|
||||
|
||||
<delete id="deleteByFeeId" parameterType="String">
|
||||
delete from prc_income_bill_fee where fee_id = #{feeId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_income_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?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.price.mapper.PrcIncomeBillMapper">
|
||||
|
||||
<resultMap type="PrcIncomeBill" id="PrcIncomeBillResult">
|
||||
<id property="incomeBillId" column="income_bill_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="productAmount" column="product_amount" />
|
||||
<result property="redlineAmount" column="redline_amount" />
|
||||
<result property="salesAmount" column="sales_amount" />
|
||||
<result property="incomeTotal" column="income_total" />
|
||||
<result property="belongSaler" column="belong_saler" />
|
||||
<result property="belongSalerCode" column="belong_saler_code" />
|
||||
<result property="settlementMan" column="settlement_man" />
|
||||
<result property="settlementManCode" column="settlement_man_code" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcIncomeBillVo">
|
||||
select income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
sales_amount, income_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time, update_by, update_time
|
||||
from prc_income_bill
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||
<include refid="selectPrcIncomeBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
<select id="selectByIncomeBillId" parameterType="String" resultMap="PrcIncomeBillResult">
|
||||
<include refid="selectPrcIncomeBillVo"/>
|
||||
where income_bill_id = #{incomeBillId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||
insert into prc_income_bill (
|
||||
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
sales_amount, income_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{salesAmount}, #{incomeTotal},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcIncomeBill" parameterType="PrcIncomeBill">
|
||||
update prc_income_bill
|
||||
set currency = #{currency},
|
||||
product_amount = #{productAmount},
|
||||
redline_amount = #{redlineAmount},
|
||||
sales_amount = #{salesAmount},
|
||||
income_total = #{incomeTotal},
|
||||
belong_saler = #{belongSaler},
|
||||
belong_saler_code = #{belongSalerCode},
|
||||
settlement_man = #{settlementMan},
|
||||
settlement_man_code = #{settlementManCode},
|
||||
update_by = #{updateBy},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<insert id="upsertPrcIncomeBill" parameterType="PrcIncomeBill">
|
||||
insert into prc_income_bill (
|
||||
income_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
sales_amount, income_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{incomeBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{salesAmount}, #{incomeTotal},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
)
|
||||
on duplicate key update
|
||||
currency = values(currency),
|
||||
product_amount = values(product_amount),
|
||||
redline_amount = values(redline_amount),
|
||||
sales_amount = values(sales_amount),
|
||||
income_total = values(income_total),
|
||||
belong_saler = values(belong_saler),
|
||||
belong_saler_code = values(belong_saler_code),
|
||||
settlement_man = values(settlement_man),
|
||||
settlement_man_code = values(settlement_man_code),
|
||||
update_by = values(update_by),
|
||||
update_time = sysdate()
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_income_bill where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,732 @@
|
||||
<?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.price.mapper.PrcOrderBillExtMapper">
|
||||
|
||||
<resultMap type="PrcOrderBillExt" id="PrcOrderBillExtResult">
|
||||
<id property="billId" column="bill_id" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="upstreamId" column="upstream_id" />
|
||||
<result property="lineNo" column="line_no" />
|
||||
<result property="packageNum" column="package_num" />
|
||||
<result property="actualVolume" column="actual_volume" />
|
||||
<result property="cpType" column="cp_type" />
|
||||
<result property="consigneeMobile" column="consignee_mobile" />
|
||||
<result property="orderReturnsign" column="order_returnsign" />
|
||||
<result property="tradeType" column="trade_type" />
|
||||
<result property="dutyType" column="duty_type" />
|
||||
<result property="batteryType" column="battery_type" />
|
||||
<result property="consigneeCompanyname" column="consignee_companyname" />
|
||||
<result property="consigneeAddress" column="consignee_address" />
|
||||
<result property="consigneeTelephone" column="consignee_telephone" />
|
||||
<result property="consigneeState" column="consignee_state" />
|
||||
<result property="consigneeCity" column="consignee_city" />
|
||||
<result property="consigneeSuburb" column="consignee_suburb" />
|
||||
<result property="consigneePassportno" column="consignee_passportno" />
|
||||
<result property="consigneeEmail" column="consignee_email" />
|
||||
<result property="consigneeTaxno" column="consignee_taxno" />
|
||||
<result property="consigneeTaxnotype" column="consignee_taxnotype" />
|
||||
<result property="consigneeTaxnocountry" column="consignee_taxnocountry" />
|
||||
<result property="consigneeStreetno" column="consignee_streetno" />
|
||||
<result property="consigneeDoorno" column="consignee_doorno" />
|
||||
<result property="shipperTaxnotype" column="shipper_taxnotype" />
|
||||
<result property="shipperTaxno" column="shipper_taxno" />
|
||||
<result property="shipperTaxnocountry" column="shipper_taxnocountry" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="productImagepath" column="product_imagepath" />
|
||||
<result property="orderTransactionurl" column="order_transactionurl" />
|
||||
<result property="orderCargoamount" column="order_cargoamount" />
|
||||
<result property="cargoType" column="cargo_type" />
|
||||
<result property="shipperCompanyname" column="shipper_companyname" />
|
||||
<result property="shipperAddress1" column="shipper_address1" />
|
||||
<result property="shipperAddress2" column="shipper_address2" />
|
||||
<result property="shipperAddress3" column="shipper_address3" />
|
||||
<result property="shipperCity" column="shipper_city" />
|
||||
<result property="shipperState" column="shipper_state" />
|
||||
<result property="shipperPostcode" column="shipper_postcode" />
|
||||
<result property="shipperCountry" column="shipper_country" />
|
||||
<result property="shipperTelephone" column="shipper_telephone" />
|
||||
<result property="shipperSuburb" column="shipper_suburb" />
|
||||
<result property="shipperEmail" column="shipper_email" />
|
||||
<result property="shipperPassportno" column="shipper_passportno" />
|
||||
<result property="importCode" column="import_code" />
|
||||
<result property="importName" column="import_name" />
|
||||
<result property="importCompanyname" column="import_companyname" />
|
||||
<result property="importAddress" column="import_address" />
|
||||
<result property="importAddress2" column="import_address2" />
|
||||
<result property="importAddress3" column="import_address3" />
|
||||
<result property="importTelephone" column="import_telephone" />
|
||||
<result property="importEmail" column="import_email" />
|
||||
<result property="importPostcode" column="import_postcode" />
|
||||
<result property="importCity" column="import_city" />
|
||||
<result property="importState" column="import_state" />
|
||||
<result property="importCountry" column="import_country" />
|
||||
<result property="buyerid" column="buyerid" />
|
||||
<result property="orderStatus" column="order_status" />
|
||||
<result property="createAt" column="create_at" />
|
||||
<result property="payType" column="pay_type" />
|
||||
<result property="lineCode" column="line_code" />
|
||||
<result property="lineName" column="line_name" />
|
||||
<result property="productType" column="product_type" />
|
||||
<result property="lineType" column="line_type" />
|
||||
<result property="cargoName" column="cargo_name" />
|
||||
<result property="productFloorCode" column="product_floor_code" />
|
||||
<result property="orderInsurance" column="order_insurance" />
|
||||
<result property="productSumPrice" column="product_sum_price" />
|
||||
<result property="productSum" column="product_sum" />
|
||||
<result property="shipperDoorno" column="shipper_doorno" />
|
||||
<result property="tariffPaymentAccount" column="tariff_payment_account" />
|
||||
<result property="topayment" column="topayment" />
|
||||
<result property="productFloor" column="product_floor" />
|
||||
<result property="latestTrajectory" column="latest_trajectory" />
|
||||
<result property="wayBill" column="way_bill" />
|
||||
<result property="pickupDate" column="pickup_date" />
|
||||
<result property="blBaging" column="bl_baging" />
|
||||
<result property="blPickup" column="bl_pickup" />
|
||||
<result property="bagDate" column="bag_date" />
|
||||
<result property="orgOrderStatus" column="org_order_status" />
|
||||
<result property="statusDescription" column="status_description" />
|
||||
<result property="zzDate" column="zz_date" />
|
||||
<result property="shippingDate" column="shipping_date" />
|
||||
<result property="orderType" column="order_type" />
|
||||
<result property="receivingPhoto" column="receiving_photo" />
|
||||
<result property="freight" column="freight" />
|
||||
<result property="isReceivable" column="is_receivable" />
|
||||
<result property="isMeet" column="is_meet" />
|
||||
<result property="billNoReceivable" column="bill_no_receivable" />
|
||||
<result property="billNoMeet" column="bill_no_meet" />
|
||||
<result property="countryEingthName" column="country_eingth_name" />
|
||||
<result property="isReceivableFee" column="is_receivable_fee" />
|
||||
<result property="settlementFee" column="settlement_fee" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="serviceFreight" column="service_freight" />
|
||||
<result property="isPayFee" column="is_pay_fee" />
|
||||
<result property="hasAddedSurcharge" column="has_added_surcharge" />
|
||||
<result property="yfFee" column="yf_fee" />
|
||||
<result property="yfTotailFee" column="yf_totail_fee" />
|
||||
<result property="trajectoryStatus" column="trajectory_status" />
|
||||
<result property="cargoTypeName" column="cargo_type_name" />
|
||||
<result property="serviceCode" column="service_code" />
|
||||
<result property="threeCode" column="three_code" />
|
||||
<result property="volumeHeightOld" column="volume_height_old" />
|
||||
<result property="volumeLengthOld" column="volume_length_old" />
|
||||
<result property="volumeWidthOld" column="volume_width_old" />
|
||||
<result property="registerManOld" column="register_man_old" />
|
||||
<result property="bagNoOld" column="bag_no_old" />
|
||||
<result property="airNoOld" column="air_no_old" />
|
||||
<result property="boxSiziOld" column="box_sizi_old" />
|
||||
<result property="bagingManOld" column="baging_man_old" />
|
||||
<result property="retrievalManOld" column="retrieval_man_old" />
|
||||
<result property="invoiceAmountOld" column="invoice_amount_old" />
|
||||
<result property="invoiceTitleOld" column="invoice_title_old" />
|
||||
<result property="invoiceWeightOld" column="invoice_weight_old" />
|
||||
<result property="skuOld" column="sku_old" />
|
||||
<result property="hsCodeOld" column="hs_code_old" />
|
||||
<result property="registerDateOld" column="register_date_old" />
|
||||
<result property="invoiceCurrencyOld" column="invoice_currency_old" />
|
||||
<result property="trajectorySubState" column="trajectory_sub_state" />
|
||||
<result property="signInTime" column="sign_in_time" />
|
||||
<result property="warehouseTime" column="warehouse_time" />
|
||||
<result property="declarationTime" column="declaration_time" />
|
||||
<result property="releaseTime" column="release_time" />
|
||||
<result property="stationTime" column="station_time" />
|
||||
<result property="takeoffTime" column="takeoff_time" />
|
||||
<result property="landingTime" column="landing_time" />
|
||||
<result property="clearanceAndDeliveryTime" column="clearance_and_delivery_time" />
|
||||
<result property="supplierName" column="supplier_name" />
|
||||
<result property="creditCode" column="credit_code" />
|
||||
<result property="otherId" column="other_id" />
|
||||
<result property="platformCode" column="platform_code" />
|
||||
<result property="syncShipmentStatus" column="sync_shipment_status" />
|
||||
<result property="updateWeight" column="update_weight" />
|
||||
<result property="otherBagNo" column="other_bag_no" />
|
||||
<result property="bagFlag" column="bag_flag" />
|
||||
<result property="onlineTime" column="online_time" />
|
||||
<result property="outboundTime" column="outbound_time" />
|
||||
<result property="airConfirmDate" column="air_confirm_date" />
|
||||
<result property="shipmentType" column="shipment_type" />
|
||||
<result property="trackQueryTime" column="track_query_time" />
|
||||
<result property="airConfirmTime" column="air_confirm_time" />
|
||||
<result property="packageType" column="package_type" />
|
||||
<result property="dimensionalWeightFactor" column="dimensional_weight_factor" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="customerPickupSite" column="customer_pickup_site" />
|
||||
<result property="barcodeNumber" column="barcode_number" />
|
||||
<result property="trackingReflectStatus" column="tracking_reflect_status" />
|
||||
<result property="remotePostcode" column="remote_postcode" />
|
||||
<result property="clearanceTime" column="clearance_time" />
|
||||
<result property="arriveStockTime" column="arrive_stock_time" />
|
||||
<result property="departureTime" column="departure_time" />
|
||||
<result property="firstDeliverTime" column="first_deliver_time" />
|
||||
<result property="hsCodeTaxCount" column="hs_code_tax_count" />
|
||||
<result property="hsCodeTaxAmount" column="hs_code_tax_amount" />
|
||||
<result property="hsCodeTaxCurrency" column="hs_code_tax_currency" />
|
||||
<result property="invoiceUrl" column="invoice_url" />
|
||||
<result property="clearanceNo" column="clearance_no" />
|
||||
<result property="pushWeight" column="push_weight" />
|
||||
<result property="internalCheckTime" column="internal_check_time" />
|
||||
<result property="airDelayTime" column="air_delay_time" />
|
||||
<result property="firstLandingTime" column="first_landing_time" />
|
||||
<result property="secondTakeoffTime" column="second_takeoff_time" />
|
||||
<result property="desPortCheckTime" column="des_port_check_time" />
|
||||
<result property="stayRemark" column="stay_remark" />
|
||||
<result property="missBoxRemark" column="miss_box_remark" />
|
||||
<result property="productChannelId" column="product_channel_id" />
|
||||
<result property="customerTrackId" column="customer_track_id" />
|
||||
<result property="registerSite" column="register_site" />
|
||||
<result property="packageTypeFinancial" column="package_type_financial" />
|
||||
<result property="mrn" column="mrn" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcOrderBillExtVo">
|
||||
select bill_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, order_status, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, product_floor_code, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, pickup_date, bl_baging, bl_pickup, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, dimensional_weight_factor, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time, update_time
|
||||
from prc_order_bill_ext
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcOrderBillExtResult">
|
||||
<include refid="selectPrcOrderBillExtVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
<select id="selectByOrderNo" parameterType="String" resultMap="PrcOrderBillExtResult">
|
||||
<include refid="selectPrcOrderBillExtVo"/>
|
||||
where order_no = #{orderNo}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcOrderBillExt" parameterType="PrcOrderBillExt">
|
||||
insert into prc_order_bill_ext (
|
||||
bill_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, order_status, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, product_floor_code, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, pickup_date, bl_baging, bl_pickup, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, dimensional_weight_factor, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time
|
||||
) values (
|
||||
#{billId},
|
||||
#{orderNo},
|
||||
#{upstreamId},
|
||||
#{lineNo},
|
||||
#{packageNum},
|
||||
#{actualVolume},
|
||||
#{cpType},
|
||||
#{consigneeMobile},
|
||||
#{orderReturnsign},
|
||||
#{tradeType},
|
||||
#{dutyType},
|
||||
#{batteryType},
|
||||
#{consigneeCompanyname},
|
||||
#{consigneeAddress},
|
||||
#{consigneeTelephone},
|
||||
#{consigneeState},
|
||||
#{consigneeCity},
|
||||
#{consigneeSuburb},
|
||||
#{consigneePassportno},
|
||||
#{consigneeEmail},
|
||||
#{consigneeTaxno},
|
||||
#{consigneeTaxnotype},
|
||||
#{consigneeTaxnocountry},
|
||||
#{consigneeStreetno},
|
||||
#{consigneeDoorno},
|
||||
#{shipperTaxnotype},
|
||||
#{shipperTaxno},
|
||||
#{shipperTaxnocountry},
|
||||
#{customerId},
|
||||
#{productImagepath},
|
||||
#{orderTransactionurl},
|
||||
#{orderCargoamount},
|
||||
#{cargoType},
|
||||
#{shipperCompanyname},
|
||||
#{shipperAddress1},
|
||||
#{shipperAddress2},
|
||||
#{shipperAddress3},
|
||||
#{shipperCity},
|
||||
#{shipperState},
|
||||
#{shipperPostcode},
|
||||
#{shipperCountry},
|
||||
#{shipperTelephone},
|
||||
#{shipperSuburb},
|
||||
#{shipperEmail},
|
||||
#{shipperPassportno},
|
||||
#{importCode},
|
||||
#{importName},
|
||||
#{importCompanyname},
|
||||
#{importAddress},
|
||||
#{importAddress2},
|
||||
#{importAddress3},
|
||||
#{importTelephone},
|
||||
#{importEmail},
|
||||
#{importPostcode},
|
||||
#{importCity},
|
||||
#{importState},
|
||||
#{importCountry},
|
||||
#{buyerid},
|
||||
#{orderStatus},
|
||||
#{createAt},
|
||||
#{payType},
|
||||
#{lineCode},
|
||||
#{lineName},
|
||||
#{productType},
|
||||
#{lineType},
|
||||
#{cargoName},
|
||||
#{productFloorCode},
|
||||
#{orderInsurance},
|
||||
#{productSumPrice},
|
||||
#{productSum},
|
||||
#{shipperDoorno},
|
||||
#{tariffPaymentAccount},
|
||||
#{topayment},
|
||||
#{productFloor},
|
||||
#{latestTrajectory},
|
||||
#{wayBill},
|
||||
#{pickupDate},
|
||||
#{blBaging},
|
||||
#{blPickup},
|
||||
#{bagDate},
|
||||
#{orgOrderStatus},
|
||||
#{statusDescription},
|
||||
#{zzDate},
|
||||
#{shippingDate},
|
||||
#{orderType},
|
||||
#{receivingPhoto},
|
||||
#{freight},
|
||||
#{isReceivable},
|
||||
#{isMeet},
|
||||
#{billNoReceivable},
|
||||
#{billNoMeet},
|
||||
#{countryEingthName},
|
||||
#{isReceivableFee},
|
||||
#{settlementFee},
|
||||
#{productId},
|
||||
#{serviceFreight},
|
||||
#{isPayFee},
|
||||
#{hasAddedSurcharge},
|
||||
#{yfFee},
|
||||
#{yfTotailFee},
|
||||
#{trajectoryStatus},
|
||||
#{cargoTypeName},
|
||||
#{serviceCode},
|
||||
#{threeCode},
|
||||
#{volumeHeightOld},
|
||||
#{volumeLengthOld},
|
||||
#{volumeWidthOld},
|
||||
#{registerManOld},
|
||||
#{bagNoOld},
|
||||
#{airNoOld},
|
||||
#{boxSiziOld},
|
||||
#{bagingManOld},
|
||||
#{retrievalManOld},
|
||||
#{invoiceAmountOld},
|
||||
#{invoiceTitleOld},
|
||||
#{invoiceWeightOld},
|
||||
#{skuOld},
|
||||
#{hsCodeOld},
|
||||
#{registerDateOld},
|
||||
#{invoiceCurrencyOld},
|
||||
#{trajectorySubState},
|
||||
#{signInTime},
|
||||
#{warehouseTime},
|
||||
#{declarationTime},
|
||||
#{releaseTime},
|
||||
#{stationTime},
|
||||
#{takeoffTime},
|
||||
#{landingTime},
|
||||
#{clearanceAndDeliveryTime},
|
||||
#{supplierName},
|
||||
#{creditCode},
|
||||
#{otherId},
|
||||
#{platformCode},
|
||||
#{syncShipmentStatus},
|
||||
#{updateWeight},
|
||||
#{otherBagNo},
|
||||
#{bagFlag},
|
||||
#{onlineTime},
|
||||
#{outboundTime},
|
||||
#{airConfirmDate},
|
||||
#{shipmentType},
|
||||
#{trackQueryTime},
|
||||
#{airConfirmTime},
|
||||
#{packageType},
|
||||
#{dimensionalWeightFactor},
|
||||
#{updateBy},
|
||||
#{customerPickupSite},
|
||||
#{barcodeNumber},
|
||||
#{trackingReflectStatus},
|
||||
#{remotePostcode},
|
||||
#{clearanceTime},
|
||||
#{arriveStockTime},
|
||||
#{departureTime},
|
||||
#{firstDeliverTime},
|
||||
#{hsCodeTaxCount},
|
||||
#{hsCodeTaxAmount},
|
||||
#{hsCodeTaxCurrency},
|
||||
#{invoiceUrl},
|
||||
#{clearanceNo},
|
||||
#{pushWeight},
|
||||
#{internalCheckTime},
|
||||
#{airDelayTime},
|
||||
#{firstLandingTime},
|
||||
#{secondTakeoffTime},
|
||||
#{desPortCheckTime},
|
||||
#{stayRemark},
|
||||
#{missBoxRemark},
|
||||
#{productChannelId},
|
||||
#{customerTrackId},
|
||||
#{registerSite},
|
||||
#{packageTypeFinancial},
|
||||
#{mrn},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="upsertPrcOrderBillExt" parameterType="PrcOrderBillExt">
|
||||
insert into prc_order_bill_ext (
|
||||
bill_id, order_no, upstream_id, line_no, package_num, actual_volume, cp_type, consignee_mobile, order_returnsign, trade_type, duty_type, battery_type, consignee_companyname, consignee_address, consignee_telephone, consignee_state, consignee_city, consignee_suburb, consignee_passportno, consignee_email, consignee_taxno, consignee_taxnotype, consignee_taxnocountry, consignee_streetno, consignee_doorno, shipper_taxnotype, shipper_taxno, shipper_taxnocountry, customer_id, product_imagepath, order_transactionurl, order_cargoamount, cargo_type, shipper_companyname, shipper_address1, shipper_address2, shipper_address3, shipper_city, shipper_state, shipper_postcode, shipper_country, shipper_telephone, shipper_suburb, shipper_email, shipper_passportno, import_code, import_name, import_companyname, import_address, import_address2, import_address3, import_telephone, import_email, import_postcode, import_city, import_state, import_country, buyerid, order_status, create_at, pay_type, line_code, line_name, product_type, line_type, cargo_name, product_floor_code, order_insurance, product_sum_price, product_sum, shipper_doorno, tariff_payment_account, topayment, product_floor, latest_trajectory, way_bill, pickup_date, bl_baging, bl_pickup, bag_date, org_order_status, status_description, zz_date, shipping_date, order_type, receiving_photo, freight, is_receivable, is_meet, bill_no_receivable, bill_no_meet, country_eingth_name, is_receivable_fee, settlement_fee, product_id, service_freight, is_pay_fee, has_added_surcharge, yf_fee, yf_totail_fee, trajectory_status, cargo_type_name, service_code, three_code, volume_height_old, volume_length_old, volume_width_old, register_man_old, bag_no_old, air_no_old, box_sizi_old, baging_man_old, retrieval_man_old, invoice_amount_old, invoice_title_old, invoice_weight_old, sku_old, hs_code_old, register_date_old, invoice_currency_old, trajectory_sub_state, sign_in_time, warehouse_time, declaration_time, release_time, station_time, takeoff_time, landing_time, clearance_and_delivery_time, supplier_name, credit_code, other_id, platform_code, sync_shipment_status, update_weight, other_bag_no, bag_flag, online_time, outbound_time, air_confirm_date, shipment_type, track_query_time, air_confirm_time, package_type, dimensional_weight_factor, update_by, customer_pickup_site, barcode_number, tracking_reflect_status, remote_postcode, clearance_time, arrive_stock_time, departure_time, first_deliver_time, hs_code_tax_count, hs_code_tax_amount, hs_code_tax_currency, invoice_url, clearance_no, push_weight, internal_check_time, air_delay_time, first_landing_time, second_takeoff_time, des_port_check_time, stay_remark, miss_box_remark, product_channel_id, customer_track_id, register_site, package_type_financial, mrn, create_time
|
||||
) values (
|
||||
#{billId},
|
||||
#{orderNo},
|
||||
#{upstreamId},
|
||||
#{lineNo},
|
||||
#{packageNum},
|
||||
#{actualVolume},
|
||||
#{cpType},
|
||||
#{consigneeMobile},
|
||||
#{orderReturnsign},
|
||||
#{tradeType},
|
||||
#{dutyType},
|
||||
#{batteryType},
|
||||
#{consigneeCompanyname},
|
||||
#{consigneeAddress},
|
||||
#{consigneeTelephone},
|
||||
#{consigneeState},
|
||||
#{consigneeCity},
|
||||
#{consigneeSuburb},
|
||||
#{consigneePassportno},
|
||||
#{consigneeEmail},
|
||||
#{consigneeTaxno},
|
||||
#{consigneeTaxnotype},
|
||||
#{consigneeTaxnocountry},
|
||||
#{consigneeStreetno},
|
||||
#{consigneeDoorno},
|
||||
#{shipperTaxnotype},
|
||||
#{shipperTaxno},
|
||||
#{shipperTaxnocountry},
|
||||
#{customerId},
|
||||
#{productImagepath},
|
||||
#{orderTransactionurl},
|
||||
#{orderCargoamount},
|
||||
#{cargoType},
|
||||
#{shipperCompanyname},
|
||||
#{shipperAddress1},
|
||||
#{shipperAddress2},
|
||||
#{shipperAddress3},
|
||||
#{shipperCity},
|
||||
#{shipperState},
|
||||
#{shipperPostcode},
|
||||
#{shipperCountry},
|
||||
#{shipperTelephone},
|
||||
#{shipperSuburb},
|
||||
#{shipperEmail},
|
||||
#{shipperPassportno},
|
||||
#{importCode},
|
||||
#{importName},
|
||||
#{importCompanyname},
|
||||
#{importAddress},
|
||||
#{importAddress2},
|
||||
#{importAddress3},
|
||||
#{importTelephone},
|
||||
#{importEmail},
|
||||
#{importPostcode},
|
||||
#{importCity},
|
||||
#{importState},
|
||||
#{importCountry},
|
||||
#{buyerid},
|
||||
#{orderStatus},
|
||||
#{createAt},
|
||||
#{payType},
|
||||
#{lineCode},
|
||||
#{lineName},
|
||||
#{productType},
|
||||
#{lineType},
|
||||
#{cargoName},
|
||||
#{productFloorCode},
|
||||
#{orderInsurance},
|
||||
#{productSumPrice},
|
||||
#{productSum},
|
||||
#{shipperDoorno},
|
||||
#{tariffPaymentAccount},
|
||||
#{topayment},
|
||||
#{productFloor},
|
||||
#{latestTrajectory},
|
||||
#{wayBill},
|
||||
#{pickupDate},
|
||||
#{blBaging},
|
||||
#{blPickup},
|
||||
#{bagDate},
|
||||
#{orgOrderStatus},
|
||||
#{statusDescription},
|
||||
#{zzDate},
|
||||
#{shippingDate},
|
||||
#{orderType},
|
||||
#{receivingPhoto},
|
||||
#{freight},
|
||||
#{isReceivable},
|
||||
#{isMeet},
|
||||
#{billNoReceivable},
|
||||
#{billNoMeet},
|
||||
#{countryEingthName},
|
||||
#{isReceivableFee},
|
||||
#{settlementFee},
|
||||
#{productId},
|
||||
#{serviceFreight},
|
||||
#{isPayFee},
|
||||
#{hasAddedSurcharge},
|
||||
#{yfFee},
|
||||
#{yfTotailFee},
|
||||
#{trajectoryStatus},
|
||||
#{cargoTypeName},
|
||||
#{serviceCode},
|
||||
#{threeCode},
|
||||
#{volumeHeightOld},
|
||||
#{volumeLengthOld},
|
||||
#{volumeWidthOld},
|
||||
#{registerManOld},
|
||||
#{bagNoOld},
|
||||
#{airNoOld},
|
||||
#{boxSiziOld},
|
||||
#{bagingManOld},
|
||||
#{retrievalManOld},
|
||||
#{invoiceAmountOld},
|
||||
#{invoiceTitleOld},
|
||||
#{invoiceWeightOld},
|
||||
#{skuOld},
|
||||
#{hsCodeOld},
|
||||
#{registerDateOld},
|
||||
#{invoiceCurrencyOld},
|
||||
#{trajectorySubState},
|
||||
#{signInTime},
|
||||
#{warehouseTime},
|
||||
#{declarationTime},
|
||||
#{releaseTime},
|
||||
#{stationTime},
|
||||
#{takeoffTime},
|
||||
#{landingTime},
|
||||
#{clearanceAndDeliveryTime},
|
||||
#{supplierName},
|
||||
#{creditCode},
|
||||
#{otherId},
|
||||
#{platformCode},
|
||||
#{syncShipmentStatus},
|
||||
#{updateWeight},
|
||||
#{otherBagNo},
|
||||
#{bagFlag},
|
||||
#{onlineTime},
|
||||
#{outboundTime},
|
||||
#{airConfirmDate},
|
||||
#{shipmentType},
|
||||
#{trackQueryTime},
|
||||
#{airConfirmTime},
|
||||
#{packageType},
|
||||
#{dimensionalWeightFactor},
|
||||
#{updateBy},
|
||||
#{customerPickupSite},
|
||||
#{barcodeNumber},
|
||||
#{trackingReflectStatus},
|
||||
#{remotePostcode},
|
||||
#{clearanceTime},
|
||||
#{arriveStockTime},
|
||||
#{departureTime},
|
||||
#{firstDeliverTime},
|
||||
#{hsCodeTaxCount},
|
||||
#{hsCodeTaxAmount},
|
||||
#{hsCodeTaxCurrency},
|
||||
#{invoiceUrl},
|
||||
#{clearanceNo},
|
||||
#{pushWeight},
|
||||
#{internalCheckTime},
|
||||
#{airDelayTime},
|
||||
#{firstLandingTime},
|
||||
#{secondTakeoffTime},
|
||||
#{desPortCheckTime},
|
||||
#{stayRemark},
|
||||
#{missBoxRemark},
|
||||
#{productChannelId},
|
||||
#{customerTrackId},
|
||||
#{registerSite},
|
||||
#{packageTypeFinancial},
|
||||
#{mrn},
|
||||
sysdate()
|
||||
)
|
||||
on duplicate key update
|
||||
order_no = values(order_no),
|
||||
upstream_id = values(upstream_id),
|
||||
line_no = values(line_no),
|
||||
package_num = values(package_num),
|
||||
actual_volume = values(actual_volume),
|
||||
cp_type = values(cp_type),
|
||||
consignee_mobile = values(consignee_mobile),
|
||||
order_returnsign = values(order_returnsign),
|
||||
trade_type = values(trade_type),
|
||||
duty_type = values(duty_type),
|
||||
battery_type = values(battery_type),
|
||||
consignee_companyname = values(consignee_companyname),
|
||||
consignee_address = values(consignee_address),
|
||||
consignee_telephone = values(consignee_telephone),
|
||||
consignee_state = values(consignee_state),
|
||||
consignee_city = values(consignee_city),
|
||||
consignee_suburb = values(consignee_suburb),
|
||||
consignee_passportno = values(consignee_passportno),
|
||||
consignee_email = values(consignee_email),
|
||||
consignee_taxno = values(consignee_taxno),
|
||||
consignee_taxnotype = values(consignee_taxnotype),
|
||||
consignee_taxnocountry = values(consignee_taxnocountry),
|
||||
consignee_streetno = values(consignee_streetno),
|
||||
consignee_doorno = values(consignee_doorno),
|
||||
shipper_taxnotype = values(shipper_taxnotype),
|
||||
shipper_taxno = values(shipper_taxno),
|
||||
shipper_taxnocountry = values(shipper_taxnocountry),
|
||||
customer_id = values(customer_id),
|
||||
product_imagepath = values(product_imagepath),
|
||||
order_transactionurl = values(order_transactionurl),
|
||||
order_cargoamount = values(order_cargoamount),
|
||||
cargo_type = values(cargo_type),
|
||||
shipper_companyname = values(shipper_companyname),
|
||||
shipper_address1 = values(shipper_address1),
|
||||
shipper_address2 = values(shipper_address2),
|
||||
shipper_address3 = values(shipper_address3),
|
||||
shipper_city = values(shipper_city),
|
||||
shipper_state = values(shipper_state),
|
||||
shipper_postcode = values(shipper_postcode),
|
||||
shipper_country = values(shipper_country),
|
||||
shipper_telephone = values(shipper_telephone),
|
||||
shipper_suburb = values(shipper_suburb),
|
||||
shipper_email = values(shipper_email),
|
||||
shipper_passportno = values(shipper_passportno),
|
||||
import_code = values(import_code),
|
||||
import_name = values(import_name),
|
||||
import_companyname = values(import_companyname),
|
||||
import_address = values(import_address),
|
||||
import_address2 = values(import_address2),
|
||||
import_address3 = values(import_address3),
|
||||
import_telephone = values(import_telephone),
|
||||
import_email = values(import_email),
|
||||
import_postcode = values(import_postcode),
|
||||
import_city = values(import_city),
|
||||
import_state = values(import_state),
|
||||
import_country = values(import_country),
|
||||
buyerid = values(buyerid),
|
||||
order_status = values(order_status),
|
||||
create_at = values(create_at),
|
||||
pay_type = values(pay_type),
|
||||
line_code = values(line_code),
|
||||
line_name = values(line_name),
|
||||
product_type = values(product_type),
|
||||
line_type = values(line_type),
|
||||
cargo_name = values(cargo_name),
|
||||
product_floor_code = values(product_floor_code),
|
||||
order_insurance = values(order_insurance),
|
||||
product_sum_price = values(product_sum_price),
|
||||
product_sum = values(product_sum),
|
||||
shipper_doorno = values(shipper_doorno),
|
||||
tariff_payment_account = values(tariff_payment_account),
|
||||
topayment = values(topayment),
|
||||
product_floor = values(product_floor),
|
||||
latest_trajectory = values(latest_trajectory),
|
||||
way_bill = values(way_bill),
|
||||
pickup_date = values(pickup_date),
|
||||
bl_baging = values(bl_baging),
|
||||
bl_pickup = values(bl_pickup),
|
||||
bag_date = values(bag_date),
|
||||
org_order_status = values(org_order_status),
|
||||
status_description = values(status_description),
|
||||
zz_date = values(zz_date),
|
||||
shipping_date = values(shipping_date),
|
||||
order_type = values(order_type),
|
||||
receiving_photo = values(receiving_photo),
|
||||
freight = values(freight),
|
||||
is_receivable = values(is_receivable),
|
||||
is_meet = values(is_meet),
|
||||
bill_no_receivable = values(bill_no_receivable),
|
||||
bill_no_meet = values(bill_no_meet),
|
||||
country_eingth_name = values(country_eingth_name),
|
||||
is_receivable_fee = values(is_receivable_fee),
|
||||
settlement_fee = values(settlement_fee),
|
||||
product_id = values(product_id),
|
||||
service_freight = values(service_freight),
|
||||
is_pay_fee = values(is_pay_fee),
|
||||
has_added_surcharge = values(has_added_surcharge),
|
||||
yf_fee = values(yf_fee),
|
||||
yf_totail_fee = values(yf_totail_fee),
|
||||
trajectory_status = values(trajectory_status),
|
||||
cargo_type_name = values(cargo_type_name),
|
||||
service_code = values(service_code),
|
||||
three_code = values(three_code),
|
||||
volume_height_old = values(volume_height_old),
|
||||
volume_length_old = values(volume_length_old),
|
||||
volume_width_old = values(volume_width_old),
|
||||
register_man_old = values(register_man_old),
|
||||
bag_no_old = values(bag_no_old),
|
||||
air_no_old = values(air_no_old),
|
||||
box_sizi_old = values(box_sizi_old),
|
||||
baging_man_old = values(baging_man_old),
|
||||
retrieval_man_old = values(retrieval_man_old),
|
||||
invoice_amount_old = values(invoice_amount_old),
|
||||
invoice_title_old = values(invoice_title_old),
|
||||
invoice_weight_old = values(invoice_weight_old),
|
||||
sku_old = values(sku_old),
|
||||
hs_code_old = values(hs_code_old),
|
||||
register_date_old = values(register_date_old),
|
||||
invoice_currency_old = values(invoice_currency_old),
|
||||
trajectory_sub_state = values(trajectory_sub_state),
|
||||
sign_in_time = values(sign_in_time),
|
||||
warehouse_time = values(warehouse_time),
|
||||
declaration_time = values(declaration_time),
|
||||
release_time = values(release_time),
|
||||
station_time = values(station_time),
|
||||
takeoff_time = values(takeoff_time),
|
||||
landing_time = values(landing_time),
|
||||
clearance_and_delivery_time = values(clearance_and_delivery_time),
|
||||
supplier_name = values(supplier_name),
|
||||
credit_code = values(credit_code),
|
||||
other_id = values(other_id),
|
||||
platform_code = values(platform_code),
|
||||
sync_shipment_status = values(sync_shipment_status),
|
||||
update_weight = values(update_weight),
|
||||
other_bag_no = values(other_bag_no),
|
||||
bag_flag = values(bag_flag),
|
||||
online_time = values(online_time),
|
||||
outbound_time = values(outbound_time),
|
||||
air_confirm_date = values(air_confirm_date),
|
||||
shipment_type = values(shipment_type),
|
||||
track_query_time = values(track_query_time),
|
||||
air_confirm_time = values(air_confirm_time),
|
||||
package_type = values(package_type),
|
||||
dimensional_weight_factor = values(dimensional_weight_factor),
|
||||
update_by = values(update_by),
|
||||
customer_pickup_site = values(customer_pickup_site),
|
||||
barcode_number = values(barcode_number),
|
||||
tracking_reflect_status = values(tracking_reflect_status),
|
||||
remote_postcode = values(remote_postcode),
|
||||
clearance_time = values(clearance_time),
|
||||
arrive_stock_time = values(arrive_stock_time),
|
||||
departure_time = values(departure_time),
|
||||
first_deliver_time = values(first_deliver_time),
|
||||
hs_code_tax_count = values(hs_code_tax_count),
|
||||
hs_code_tax_amount = values(hs_code_tax_amount),
|
||||
hs_code_tax_currency = values(hs_code_tax_currency),
|
||||
invoice_url = values(invoice_url),
|
||||
clearance_no = values(clearance_no),
|
||||
push_weight = values(push_weight),
|
||||
internal_check_time = values(internal_check_time),
|
||||
air_delay_time = values(air_delay_time),
|
||||
first_landing_time = values(first_landing_time),
|
||||
second_takeoff_time = values(second_takeoff_time),
|
||||
des_port_check_time = values(des_port_check_time),
|
||||
stay_remark = values(stay_remark),
|
||||
miss_box_remark = values(miss_box_remark),
|
||||
product_channel_id = values(product_channel_id),
|
||||
customer_track_id = values(customer_track_id),
|
||||
register_site = values(register_site),
|
||||
package_type_financial = values(package_type_financial),
|
||||
mrn = values(mrn),
|
||||
update_time = sysdate()
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,663 @@
|
||||
<?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.price.mapper.PrcOrderBillMapper">
|
||||
|
||||
<!-- 应收账单生成依赖的来源计费订单查询;本项目的 prc_bill 需求表映射为 prc_order_bill。 -->
|
||||
|
||||
<resultMap type="PrcOrderBill" id="PrcOrderBillResult">
|
||||
<id property="billId" column="bill_id" />
|
||||
<result property="billKey" column="bill_key" />
|
||||
<result property="orderNo" column="order_no" />
|
||||
<result property="trackingNo" column="tracking_no" />
|
||||
<result property="transferNo" column="transfer_no" />
|
||||
<result property="belongSaler" column="belong_saler" />
|
||||
<result property="belongSalerCode" column="belong_saler_code" />
|
||||
<result property="settlementMan" column="settlement_man" />
|
||||
<result property="settlementManCode" column="settlement_man_code" />
|
||||
<result property="serviceMan" column="service_man" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="pieces" column="pieces" />
|
||||
<result property="actualWeight" column="actual_weight" />
|
||||
<result property="volume" column="volume" />
|
||||
<result property="volumeWeight" column="volume_weight" />
|
||||
<result property="pkgLength" column="pkg_length" />
|
||||
<result property="pkgWidth" column="pkg_width" />
|
||||
<result property="pkgHeight" column="pkg_height" />
|
||||
<result property="shipperName" column="shipper_name" />
|
||||
<result property="consigneeName" column="consignee_name" />
|
||||
<result property="destPostcode" column="dest_postcode" />
|
||||
<result property="warehouseCode" column="warehouse_code" />
|
||||
<result property="orderTime" column="order_time" />
|
||||
<result property="orderRemark" column="order_remark" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="weight" column="weight" />
|
||||
<result property="bizDate" column="biz_date" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="matchSource" column="match_source" />
|
||||
<result property="matchMessage" column="match_message" />
|
||||
<result property="priceSetId" column="price_set_id" />
|
||||
<result property="priceSetCode" column="price_set_code" />
|
||||
<result property="priceSetName" column="price_set_name" />
|
||||
<result property="setType" column="set_type" />
|
||||
<result property="bindPriority" column="bind_priority" />
|
||||
<result property="customerPricesetId" column="customer_priceset_id" />
|
||||
<result property="psvId" column="psv_id" />
|
||||
<result property="psdId" column="psd_id" />
|
||||
<result property="productCountryId" column="product_country_id" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="weightLabel" column="weight_label" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="chargeWeight" column="charge_weight" />
|
||||
<result property="freightRate" column="freight_rate" />
|
||||
<result property="baseFreightRate" column="base_freight_rate" />
|
||||
<result property="discountPercent" column="discount_percent" />
|
||||
<result property="registrationFee" column="registration_fee" />
|
||||
<result property="freightAmount" column="freight_amount" />
|
||||
<result property="surchargeAmount" column="surcharge_amount" />
|
||||
<result property="incomeTotal" column="income_total" />
|
||||
<result property="payTotal" column="pay_total" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="arBillStatus" column="ar_bill_status" />
|
||||
<result property="customerActiveStatus" column="customer_active_status" />
|
||||
<result property="creditArrearsStatus" column="credit_arrears_status" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcOrderBillVo">
|
||||
select bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man,
|
||||
customer_id, customer_code, customer_name,
|
||||
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
||||
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
|
||||
match_source, match_message, price_set_id, price_set_code, price_set_name,
|
||||
set_type, bind_priority, customer_priceset_id, psv_id, psd_id, product_country_id,
|
||||
weight_min, weight_max, weight_label, effective_date, charge_weight,
|
||||
freight_rate, base_freight_rate, discount_percent, registration_fee,
|
||||
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status,
|
||||
customer_active_status, credit_arrears_status, round_mode,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_order_bill
|
||||
</sql>
|
||||
|
||||
<!-- 应收生成专用来源快照:income_total 只汇总当前仍未出账的费用。 -->
|
||||
<sql id="selectArBillSourceVo">
|
||||
select p.bill_id, p.bill_key, p.order_no, p.tracking_no, p.transfer_no,
|
||||
p.belong_saler, p.belong_saler_code, p.settlement_man, p.settlement_man_code, p.service_man,
|
||||
p.customer_id, p.customer_code, p.customer_name,
|
||||
p.pieces, p.actual_weight, p.volume, p.volume_weight, p.pkg_length, p.pkg_width, p.pkg_height,
|
||||
p.shipper_name, p.consignee_name, p.dest_postcode, p.warehouse_code, p.order_time, p.order_remark,
|
||||
p.product_code, p.product_name, p.country_code, p.country_name, p.weight, p.biz_date, p.tms_id,
|
||||
p.match_source, p.match_message, p.price_set_id, p.price_set_code, p.price_set_name,
|
||||
p.set_type, p.bind_priority, p.customer_priceset_id, p.psv_id, p.psd_id, p.product_country_id,
|
||||
p.weight_min, p.weight_max, p.weight_label, p.effective_date, p.charge_weight,
|
||||
p.freight_rate, p.base_freight_rate, p.discount_percent, p.registration_fee,
|
||||
p.freight_amount, p.surcharge_amount,
|
||||
(select coalesce(sum(f.amount), 0)
|
||||
from prc_income_bill_fee f
|
||||
where f.bill_id = p.bill_id
|
||||
and f.ar_bill_status = #{feeArBillStatus}) as income_total,
|
||||
p.pay_total, p.currency, p.ar_bill_status,
|
||||
p.customer_active_status, p.credit_arrears_status, p.round_mode,
|
||||
p.created_by, p.create_time, p.updated_by, p.update_time
|
||||
from prc_order_bill p
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcOrderBillByOrderNo" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where order_no = #{orderNo}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillByTransferNo" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where transfer_no = #{transferNo}
|
||||
order by create_time desc, bill_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- TMS 状态查询使用精确匹配,避免模糊查询把多个订单误判为同一条。 -->
|
||||
<select id="selectPrcOrderBillByTmsIdentifier" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where order_no = #{identifier}
|
||||
or tracking_no = #{identifier}
|
||||
or transfer_no = #{identifier}
|
||||
order by
|
||||
case
|
||||
when order_no = #{identifier} then 1
|
||||
when tracking_no = #{identifier} then 2
|
||||
when transfer_no = #{identifier} then 3
|
||||
else 4
|
||||
end,
|
||||
create_time desc,
|
||||
bill_id desc
|
||||
limit 2
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillById" parameterType="String" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
<select id="selectOrderNoOptions" resultType="String">
|
||||
select order_no
|
||||
from prc_order_bill
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
order_no like concat('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by order_no
|
||||
order by max(create_time) desc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectTrackingNoOptions" resultType="String">
|
||||
select tracking_no
|
||||
from prc_order_bill
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
tracking_no like concat('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by tracking_no
|
||||
order by max(create_time) desc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectTransferNoOptions" resultType="String">
|
||||
select transfer_no
|
||||
from prc_order_bill
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
transfer_no like concat('%', #{keyword}, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by transfer_no
|
||||
order by max(create_time) desc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillList" parameterType="PrcOrderBill" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
<where>
|
||||
<if test="orderNo != null and orderNo != ''">
|
||||
AND order_no like concat('%', #{orderNo}, '%')
|
||||
</if>
|
||||
<if test="orderNos != null and orderNos.size() > 0">
|
||||
AND order_no IN
|
||||
<foreach collection="orderNos" item="ono" open="(" separator="," close=")">
|
||||
#{ono}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="trackingNo != null and trackingNo != ''">
|
||||
AND tracking_no like concat('%', #{trackingNo}, '%')
|
||||
</if>
|
||||
<if test="trackingNos != null and trackingNos.size() > 0">
|
||||
AND tracking_no IN
|
||||
<foreach collection="trackingNos" item="tno" open="(" separator="," close=")">
|
||||
#{tno}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="transferNo != null and transferNo != ''">
|
||||
AND transfer_no like concat('%', #{transferNo}, '%')
|
||||
</if>
|
||||
<if test="transferNos != null and transferNos.size() > 0">
|
||||
AND transfer_no IN
|
||||
<foreach collection="transferNos" item="rno" open="(" separator="," close=")">
|
||||
#{rno}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="customerActiveStatus != null and customerActiveStatus != ''">
|
||||
AND customer_active_status = #{customerActiveStatus}
|
||||
</if>
|
||||
<if test="creditArrearsStatus != null and creditArrearsStatus != ''">
|
||||
AND credit_arrears_status = #{creditArrearsStatus}
|
||||
</if>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
AND customer_code like concat('%', #{customerCode}, '%')
|
||||
</if>
|
||||
<if test="customerCodes != null and customerCodes.size() > 0">
|
||||
AND customer_code IN
|
||||
<foreach collection="customerCodes" item="ccode" open="(" separator="," close=")">
|
||||
#{ccode}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
AND customer_name like concat('%', #{customerName}, '%')
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code like concat('%', #{productCode}, '%')
|
||||
</if>
|
||||
<if test="productCodes != null and productCodes.size() > 0">
|
||||
AND product_code IN
|
||||
<foreach collection="productCodes" item="pcode" open="(" separator="," close=")">
|
||||
#{pcode}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="matchSource != null and matchSource != ''">
|
||||
AND match_source = #{matchSource}
|
||||
</if>
|
||||
<if test="bizDate != null">
|
||||
AND biz_date = #{bizDate}
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc, bill_id desc
|
||||
</select>
|
||||
|
||||
<!-- rename_bill_tables.sql 已将需求文档中的 prc_bill 映射为本项目的 prc_order_bill。 -->
|
||||
<!-- 生成弹窗预览:按客户、截止日、币种和订单号/运单号/转单号 OR 条件分页查询未入账订单。 -->
|
||||
<sql id="orderIdentifierCondition">
|
||||
<if test="orderIdentifiers != null and orderIdentifiers.size() > 0">
|
||||
and (
|
||||
p.order_no in
|
||||
<foreach collection="orderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
or p.tracking_no in
|
||||
<foreach collection="orderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
or p.transfer_no in
|
||||
<foreach collection="orderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcOrderBillByCustomerPeriod" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
where p.customer_id = #{customerId}
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
and p.customer_code like concat('%', #{customerCode}, '%')
|
||||
</if>
|
||||
<include refid="orderIdentifierCondition"/>
|
||||
<if test="excludeOrderIdentifiers != null and excludeOrderIdentifiers.size() > 0">
|
||||
and (p.order_no in
|
||||
<foreach collection="excludeOrderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
or p.tracking_no in
|
||||
<foreach collection="excludeOrderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
or p.transfer_no in
|
||||
<foreach collection="excludeOrderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and p.biz_date <= #{cutoffDate}
|
||||
and p.ar_bill_status in
|
||||
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
and exists (
|
||||
select 1 from prc_income_bill_fee f
|
||||
where f.bill_id = p.bill_id
|
||||
and f.ar_bill_status = #{feeArBillStatus}
|
||||
)
|
||||
<if test="currency != null and currency != ''">
|
||||
and p.currency = #{currency}
|
||||
</if>
|
||||
<if test="excludedBillIds != null and excludedBillIds.size() > 0">
|
||||
and p.bill_id not in
|
||||
<foreach collection="excludedBillIds" item="excludedBillId" open="(" separator="," close=")">
|
||||
#{excludedBillId}
|
||||
</foreach>
|
||||
</if>
|
||||
order by p.biz_date, p.order_no, p.bill_id
|
||||
</select>
|
||||
|
||||
<select id="sumPrcOrderBillIncomeByCustomerPeriod" resultType="java.math.BigDecimal">
|
||||
select coalesce(sum(f.amount), 0)
|
||||
from prc_order_bill p
|
||||
inner join prc_income_bill_fee f on f.bill_id = p.bill_id
|
||||
and f.ar_bill_status = #{feeArBillStatus}
|
||||
where p.customer_id = #{customerId}
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
and p.customer_code like concat('%', #{customerCode}, '%')
|
||||
</if>
|
||||
<include refid="orderIdentifierCondition"/>
|
||||
<if test="excludeOrderIdentifiers != null and excludeOrderIdentifiers.size() > 0">
|
||||
and (p.order_no in
|
||||
<foreach collection="excludeOrderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
or p.tracking_no in
|
||||
<foreach collection="excludeOrderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
or p.transfer_no in
|
||||
<foreach collection="excludeOrderIdentifiers" item="identifier" open="(" separator="," close=")">
|
||||
#{identifier}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
and p.biz_date <= #{cutoffDate}
|
||||
and p.ar_bill_status in
|
||||
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
<if test="currency != null and currency != ''">
|
||||
and p.currency = #{currency}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<sql id="customerPeriodConditions">
|
||||
where p.customer_id = #{customerId}
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
and p.customer_code like concat('%', #{customerCode}, '%')
|
||||
</if>
|
||||
<include refid="orderIdentifierCondition"/>
|
||||
and p.biz_date <= #{cutoffDate}
|
||||
and p.ar_bill_status in
|
||||
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
and exists (
|
||||
select 1 from prc_income_bill_fee f
|
||||
where f.bill_id = p.bill_id
|
||||
and f.ar_bill_status = #{feeArBillStatus}
|
||||
)
|
||||
<if test="currency != null and currency != ''">
|
||||
and p.currency = #{currency}
|
||||
</if>
|
||||
<if test="snapshotCreateTime != null">
|
||||
and (p.create_time is null or p.create_time <= #{snapshotCreateTime})
|
||||
</if>
|
||||
<if test="billIds != null and billIds.size() > 0">
|
||||
and p.bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="excludedBillIds != null and excludedBillIds.size() > 0">
|
||||
and p.bill_id not in
|
||||
<foreach collection="excludedBillIds" item="excludedBillId" open="(" separator="," close=")">
|
||||
#{excludedBillId}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 异步生成使用 bill_id 游标批量读取,避免深分页和一次加载全量订单。 -->
|
||||
<select id="selectPrcOrderBillByCustomerPeriodCursor" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
<include refid="customerPeriodConditions"/>
|
||||
<if test="lastSourceBillId != null and lastSourceBillId != ''">
|
||||
and p.bill_id > #{lastSourceBillId}
|
||||
</if>
|
||||
order by p.bill_id
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<!-- 全选模式先统计总数,用于任务进度和空范围校验。 -->
|
||||
<select id="countPrcOrderBillByCustomerPeriod" resultType="int">
|
||||
select count(1)
|
||||
from prc_order_bill p
|
||||
<include refid="customerPeriodConditions"/>
|
||||
</select>
|
||||
|
||||
<select id="selectPrcOrderBillByCustomerCutoffAndIds" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectArBillSourceVo"/>
|
||||
where p.customer_id = #{customerId}
|
||||
and p.biz_date <= #{cutoffDate}
|
||||
and p.ar_bill_status in
|
||||
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
and exists (
|
||||
select 1 from prc_income_bill_fee f
|
||||
where f.bill_id = p.bill_id
|
||||
and f.ar_bill_status = #{feeArBillStatus}
|
||||
)
|
||||
and p.bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
and p.customer_code like concat('%', #{customerCode}, '%')
|
||||
</if>
|
||||
<include refid="orderIdentifierCondition"/>
|
||||
<if test="currency != null and currency != ''">
|
||||
and p.currency = #{currency}
|
||||
</if>
|
||||
order by p.biz_date, p.order_no, p.bill_id
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">
|
||||
insert into prc_order_bill (
|
||||
bill_id, bill_key, order_no, tracking_no, transfer_no,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code, service_man,
|
||||
customer_id, customer_code, customer_name,
|
||||
pieces, actual_weight, volume, volume_weight, pkg_length, pkg_width, pkg_height,
|
||||
shipper_name, consignee_name, dest_postcode, warehouse_code, order_time, order_remark,
|
||||
product_code, product_name, country_code, country_name, weight, biz_date, tms_id,
|
||||
match_source, match_message, price_set_id, price_set_code, price_set_name,
|
||||
set_type, bind_priority, customer_priceset_id, psv_id, psd_id, product_country_id,
|
||||
weight_min, weight_max, weight_label, effective_date, charge_weight,
|
||||
freight_rate, base_freight_rate, discount_percent, registration_fee,
|
||||
freight_amount, surcharge_amount, income_total, pay_total, currency, ar_bill_status,
|
||||
customer_active_status, credit_arrears_status, round_mode,
|
||||
create_time
|
||||
) values (
|
||||
#{billId}, #{billKey}, #{orderNo}, #{trackingNo}, #{transferNo},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode}, #{serviceMan},
|
||||
#{customerId}, #{customerCode}, #{customerName},
|
||||
#{pieces}, #{actualWeight}, #{volume}, #{volumeWeight}, #{pkgLength}, #{pkgWidth}, #{pkgHeight},
|
||||
#{shipperName}, #{consigneeName}, #{destPostcode}, #{warehouseCode}, #{orderTime}, #{orderRemark},
|
||||
#{productCode}, #{productName}, #{countryCode}, #{countryName}, #{weight}, #{bizDate}, #{tmsId},
|
||||
#{matchSource}, #{matchMessage}, #{priceSetId}, #{priceSetCode}, #{priceSetName},
|
||||
#{setType}, #{bindPriority}, #{customerPricesetId}, #{psvId}, #{psdId}, #{productCountryId},
|
||||
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
|
||||
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
|
||||
#{freightAmount}, #{surchargeAmount}, #{incomeTotal}, #{payTotal}, #{currency}, #{arBillStatus},
|
||||
#{customerActiveStatus}, #{creditArrearsStatus}, #{roundMode},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcOrderBill" parameterType="PrcOrderBill">
|
||||
update prc_order_bill
|
||||
set bill_key = #{billKey},
|
||||
tracking_no = #{trackingNo},
|
||||
transfer_no = #{transferNo},
|
||||
belong_saler = #{belongSaler},
|
||||
belong_saler_code = #{belongSalerCode},
|
||||
settlement_man = #{settlementMan},
|
||||
settlement_man_code = #{settlementManCode},
|
||||
service_man = #{serviceMan},
|
||||
customer_id = #{customerId},
|
||||
customer_code = #{customerCode},
|
||||
customer_name = #{customerName},
|
||||
pieces = #{pieces},
|
||||
actual_weight = #{actualWeight},
|
||||
volume = #{volume},
|
||||
volume_weight = #{volumeWeight},
|
||||
pkg_length = #{pkgLength},
|
||||
pkg_width = #{pkgWidth},
|
||||
pkg_height = #{pkgHeight},
|
||||
shipper_name = #{shipperName},
|
||||
consignee_name = #{consigneeName},
|
||||
dest_postcode = #{destPostcode},
|
||||
warehouse_code = #{warehouseCode},
|
||||
order_time = #{orderTime},
|
||||
order_remark = #{orderRemark},
|
||||
product_code = #{productCode},
|
||||
product_name = #{productName},
|
||||
country_code = #{countryCode},
|
||||
country_name = #{countryName},
|
||||
|
||||
|
||||
weight = #{weight},
|
||||
biz_date = #{bizDate},
|
||||
tms_id = #{tmsId},
|
||||
match_source = #{matchSource},
|
||||
match_message = #{matchMessage},
|
||||
price_set_id = #{priceSetId},
|
||||
price_set_code = #{priceSetCode},
|
||||
price_set_name = #{priceSetName},
|
||||
set_type = #{setType},
|
||||
bind_priority = #{bindPriority},
|
||||
customer_priceset_id = #{customerPricesetId},
|
||||
psv_id = #{psvId},
|
||||
psd_id = #{psdId},
|
||||
product_country_id = #{productCountryId},
|
||||
weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
weight_label = #{weightLabel},
|
||||
effective_date = #{effectiveDate},
|
||||
charge_weight = #{chargeWeight},
|
||||
freight_rate = #{freightRate},
|
||||
base_freight_rate = #{baseFreightRate},
|
||||
discount_percent = #{discountPercent},
|
||||
registration_fee = #{registrationFee},
|
||||
freight_amount = #{freightAmount},
|
||||
surcharge_amount = #{surchargeAmount},
|
||||
income_total = #{incomeTotal},
|
||||
pay_total = #{payTotal},
|
||||
currency = #{currency},
|
||||
customer_active_status = #{customerActiveStatus},
|
||||
credit_arrears_status = #{creditArrearsStatus},
|
||||
round_mode = #{roundMode},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<update id="updateOrderBillAmounts">
|
||||
update prc_order_bill
|
||||
set surcharge_amount = #{surchargeAmount},
|
||||
income_total = #{incomeTotal},
|
||||
pay_total = #{payTotal},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<!-- 抢占来源订单:未出账或部分出账订单均可进入本次生成事务。 -->
|
||||
<update id="claimArBillOrders">
|
||||
update prc_order_bill
|
||||
set ar_bill_status = #{toStatus}, updated_by = #{operator}, update_time = sysdate()
|
||||
where ar_bill_status in
|
||||
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
|
||||
#{status}
|
||||
</foreach>
|
||||
and bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="releaseArBillOrders">
|
||||
update prc_order_bill
|
||||
set ar_bill_status = #{toStatus}, updated_by = #{operator}, update_time = sysdate()
|
||||
where ar_bill_status = #{fromStatus}
|
||||
and bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="releaseArBillOrdersByArBillId">
|
||||
update prc_order_bill p
|
||||
inner join ar_bill_detail d on d.prc_order_bill_id = p.bill_id
|
||||
set p.ar_bill_status = #{toStatus}, p.updated_by = #{operator}, p.update_time = sysdate()
|
||||
where d.ar_bill_id = #{arBillId}
|
||||
and p.ar_bill_status = #{fromStatus}
|
||||
</update>
|
||||
|
||||
<!-- 订单状态由来源费用状态汇总,避免补录或删除费用后状态失真。 -->
|
||||
<update id="refreshArBillStatusByBillIds">
|
||||
update prc_order_bill o
|
||||
left join (
|
||||
select bill_id,
|
||||
count(1) as fee_count,
|
||||
sum(case when ar_bill_status = 'BILLED' then 1 else 0 end) as billed_count,
|
||||
sum(case when ar_bill_status = 'UNBILLED' then 1 else 0 end) as unbilled_count
|
||||
from prc_income_bill_fee
|
||||
where bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
group by bill_id
|
||||
) f on f.bill_id = o.bill_id
|
||||
set o.ar_bill_status = case
|
||||
when f.bill_id is null then 'UNBILLED'
|
||||
when f.unbilled_count > 0 and f.billed_count > 0 then 'PARTIAL'
|
||||
when f.unbilled_count > 0 then 'UNBILLED'
|
||||
when f.billed_count = f.fee_count then 'BILLED'
|
||||
else 'UNBILLED'
|
||||
end,
|
||||
o.update_time = sysdate()
|
||||
where o.bill_id in
|
||||
<foreach collection="billIds" item="billId" open="(" separator="," close=")">
|
||||
#{billId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="refreshArBillStatusByArBillId">
|
||||
update prc_order_bill o
|
||||
inner join (
|
||||
select distinct d.prc_order_bill_id
|
||||
from ar_bill_detail d
|
||||
where d.ar_bill_id = #{arBillId}
|
||||
) source_order on source_order.prc_order_bill_id = o.bill_id
|
||||
left join (
|
||||
select f.bill_id,
|
||||
count(1) as fee_count,
|
||||
sum(case when f.ar_bill_status = 'BILLED' then 1 else 0 end) as billed_count,
|
||||
sum(case when f.ar_bill_status = 'UNBILLED' then 1 else 0 end) as unbilled_count
|
||||
from prc_income_bill_fee f
|
||||
inner join (
|
||||
select distinct d2.prc_order_bill_id
|
||||
from ar_bill_detail d2
|
||||
where d2.ar_bill_id = #{arBillId}
|
||||
) source_order2 on source_order2.prc_order_bill_id = f.bill_id
|
||||
group by f.bill_id
|
||||
) fee_summary on fee_summary.bill_id = o.bill_id
|
||||
set o.ar_bill_status = case
|
||||
when fee_summary.bill_id is null then 'UNBILLED'
|
||||
when fee_summary.unbilled_count > 0 and fee_summary.billed_count > 0 then 'PARTIAL'
|
||||
when fee_summary.unbilled_count > 0 then 'UNBILLED'
|
||||
when fee_summary.billed_count = fee_summary.fee_count then 'BILLED'
|
||||
else 'UNBILLED'
|
||||
end,
|
||||
o.update_time = sysdate()
|
||||
</update>
|
||||
|
||||
<!-- 核销清欠:按客户代码+欠费状态查询,下单时间升序 -->
|
||||
<select id="selectArrearsByCustomerCode" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where customer_code = #{customerCode}
|
||||
and credit_arrears_status = #{creditArrearsStatus}
|
||||
order by (order_time is null), order_time asc, bill_id asc
|
||||
</select>
|
||||
|
||||
<update id="updateCreditArrearsStatus">
|
||||
update prc_order_bill
|
||||
set credit_arrears_status = #{creditArrearsStatus},
|
||||
updated_by = #{updateBy},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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.price.mapper.PrcPayBillFeeMapper">
|
||||
|
||||
<resultMap type="PrcPayBillFee" id="PrcPayBillFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="payBillId" column="pay_bill_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="feeName" column="fee_name" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillFeeResult">
|
||||
select fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||
from prc_pay_bill_fee
|
||||
where bill_id = #{billId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPayBillFee" parameterType="PrcPayBillFee">
|
||||
insert into prc_pay_bill_fee (
|
||||
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||
) values (
|
||||
#{feeId}, #{billId}, #{payBillId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
insert into prc_pay_bill_fee (
|
||||
fee_id, bill_id, pay_bill_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.feeId}, #{item.billId}, #{item.payBillId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_pay_bill_fee where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?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.price.mapper.PrcPayBillMapper">
|
||||
|
||||
<resultMap type="PrcPayBill" id="PrcPayBillResult">
|
||||
<id property="payBillId" column="pay_bill_id" />
|
||||
<result property="billId" column="bill_id" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="productAmount" column="product_amount" />
|
||||
<result property="redlineAmount" column="redline_amount" />
|
||||
<result property="costAmount" column="cost_amount" />
|
||||
<result property="payTotal" column="pay_total" />
|
||||
<result property="belongSaler" column="belong_saler" />
|
||||
<result property="belongSalerCode" column="belong_saler_code" />
|
||||
<result property="settlementMan" column="settlement_man" />
|
||||
<result property="settlementManCode" column="settlement_man_code" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcPayBillVo">
|
||||
select pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
cost_amount, pay_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time, update_by, update_time
|
||||
from prc_pay_bill
|
||||
</sql>
|
||||
|
||||
<select id="selectByBillId" parameterType="String" resultMap="PrcPayBillResult">
|
||||
<include refid="selectPrcPayBillVo"/>
|
||||
where bill_id = #{billId}
|
||||
</select>
|
||||
|
||||
<select id="selectByPayBillId" parameterType="String" resultMap="PrcPayBillResult">
|
||||
<include refid="selectPrcPayBillVo"/>
|
||||
where pay_bill_id = #{payBillId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPayBill" parameterType="PrcPayBill">
|
||||
insert into prc_pay_bill (
|
||||
pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
cost_amount, pay_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{costAmount}, #{payTotal},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPayBill" parameterType="PrcPayBill">
|
||||
update prc_pay_bill
|
||||
set currency = #{currency},
|
||||
product_amount = #{productAmount},
|
||||
redline_amount = #{redlineAmount},
|
||||
cost_amount = #{costAmount},
|
||||
pay_total = #{payTotal},
|
||||
belong_saler = #{belongSaler},
|
||||
belong_saler_code = #{belongSalerCode},
|
||||
settlement_man = #{settlementMan},
|
||||
settlement_man_code = #{settlementManCode},
|
||||
update_by = #{updateBy},
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<insert id="upsertPrcPayBill" parameterType="PrcPayBill">
|
||||
insert into prc_pay_bill (
|
||||
pay_bill_id, bill_id, currency, product_amount, redline_amount,
|
||||
cost_amount, pay_total,
|
||||
belong_saler, belong_saler_code, settlement_man, settlement_man_code,
|
||||
create_by, create_time
|
||||
) values (
|
||||
#{payBillId}, #{billId}, #{currency}, #{productAmount}, #{redlineAmount},
|
||||
#{costAmount}, #{payTotal},
|
||||
#{belongSaler}, #{belongSalerCode}, #{settlementMan}, #{settlementManCode},
|
||||
#{createBy}, sysdate()
|
||||
)
|
||||
on duplicate key update
|
||||
currency = values(currency),
|
||||
product_amount = values(product_amount),
|
||||
redline_amount = values(redline_amount),
|
||||
cost_amount = values(cost_amount),
|
||||
pay_total = values(pay_total),
|
||||
belong_saler = values(belong_saler),
|
||||
belong_saler_code = values(belong_saler_code),
|
||||
settlement_man = values(settlement_man),
|
||||
settlement_man_code = values(settlement_man_code),
|
||||
update_by = values(update_by),
|
||||
update_time = sysdate()
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByBillId" parameterType="String">
|
||||
delete from prc_pay_bill where bill_id = #{billId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,362 @@
|
||||
<?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.price.mapper.PrcPriceSetDetailMapper">
|
||||
|
||||
<resultMap type="PrcPriceSetDetail" id="PrcPriceSetDetailResult">
|
||||
<id property="psdId" column="psd_id" />
|
||||
<result property="priceSetId" column="price_set_id" />
|
||||
<result property="psvId" column="psv_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="zoneCode" column="zone_code" />
|
||||
<result property="zoneName" column="zone_name" />
|
||||
<result property="zdId" column="zd_id" />
|
||||
<result property="wsdId" column="wsd_id" />
|
||||
<result property="weightLabel" column="weight_label" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="productCountryId" column="product_country_id" />
|
||||
<result property="fvValue" column="fv_value" />
|
||||
<result property="fvRegistrationFee" column="fv_registration_fee" />
|
||||
<result property="discountValue" column="discount_value" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="prId" column="pr_id" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcPriceSetDetailVo">
|
||||
select psd_id, price_set_id, psv_id, product_code, product_name, country_code, country_name,
|
||||
zone_id, zone_code, zone_name,
|
||||
zd_id, wsd_id, weight_label, weight_min, weight_max, product_country_id, fv_value, fv_registration_fee,
|
||||
discount_value, round_mode, pr_id, effective_date, expire_date, create_time, update_time
|
||||
from prc_price_set_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcPriceSetDetailById" parameterType="Long" resultMap="PrcPriceSetDetailResult">
|
||||
<include refid="selectPrcPriceSetDetailVo"/>
|
||||
where psd_id = #{psdId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcPriceSetDetailList" parameterType="PrcPriceSetDetail" resultMap="PrcPriceSetDetailResult">
|
||||
<include refid="selectPrcPriceSetDetailVo"/>
|
||||
<where>
|
||||
<if test="priceSetId != null">
|
||||
AND price_set_id = #{priceSetId}
|
||||
</if>
|
||||
<if test="psvId != null">
|
||||
AND psv_id = #{psvId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code = #{productCode}
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">
|
||||
AND zone_code = #{zoneCode}
|
||||
</if>
|
||||
<if test="productKeyword != null and productKeyword != ''">
|
||||
AND (
|
||||
product_code like concat('%', #{productKeyword}, '%')
|
||||
or product_name like concat('%', #{productKeyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="countryKeyword != null and countryKeyword != ''">
|
||||
AND (
|
||||
country_code like concat('%', #{countryKeyword}, '%')
|
||||
or country_name like concat('%', #{countryKeyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="zoneKeyword != null and zoneKeyword != ''">
|
||||
AND (
|
||||
zone_code like concat('%', #{zoneKeyword}, '%')
|
||||
or zone_name like concat('%', #{zoneKeyword}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
product_code like concat('%', #{keyword}, '%')
|
||||
or product_name like concat('%', #{keyword}, '%')
|
||||
or country_code like concat('%', #{keyword}, '%')
|
||||
or country_name like concat('%', #{keyword}, '%')
|
||||
or zone_code like concat('%', #{keyword}, '%')
|
||||
or zone_name like concat('%', #{keyword}, '%')
|
||||
or weight_label like concat('%', #{keyword}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
order by psd_id asc
|
||||
</select>
|
||||
|
||||
<select id="countProductByPriceSetId" parameterType="Long" resultType="int">
|
||||
select count(distinct product_code) from prc_price_set_detail where price_set_id = #{priceSetId}
|
||||
</select>
|
||||
|
||||
<select id="countByPriceSetId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_price_set_detail where price_set_id = #{priceSetId}
|
||||
</select>
|
||||
|
||||
<select id="countByPsvId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_price_set_detail where psv_id = #{psvId}
|
||||
</select>
|
||||
|
||||
<select id="selectDetailOptionRows" resultMap="PrcPriceSetDetailResult">
|
||||
select distinct product_code, product_name, country_code, country_name, zone_code, zone_name
|
||||
from prc_price_set_detail
|
||||
where psv_id = #{psvId}
|
||||
order by product_code, country_name, zone_code
|
||||
</select>
|
||||
|
||||
<!-- FIXED: join active products + country by product_id only (avoid OR-join row explosion) -->
|
||||
<insert id="insertFixedDetailsFromLibrary">
|
||||
insert ignore into prc_price_set_detail (
|
||||
price_set_id, psv_id, product_code, product_name,
|
||||
country_code, country_name, zone_id, zone_code, zone_name,
|
||||
weight_label, weight_min, weight_max, product_country_id,
|
||||
fv_value, fv_registration_fee, round_mode,
|
||||
effective_date, expire_date, create_time
|
||||
)
|
||||
select
|
||||
#{priceSetId},
|
||||
#{psvId},
|
||||
p.product_code,
|
||||
p.product_name,
|
||||
c.country_code,
|
||||
c.country_name,
|
||||
c.zone_id,
|
||||
c.zone_code,
|
||||
c.zone_name,
|
||||
case
|
||||
when c.weight_min is null and c.weight_max is null then null
|
||||
else concat(
|
||||
ifnull(trim(trailing '0' from trim(trailing '.' from cast(c.weight_min as char))), ''),
|
||||
'<W≤',
|
||||
ifnull(trim(trailing '0' from trim(trailing '.' from cast(c.weight_max as char))), '')
|
||||
)
|
||||
end,
|
||||
c.weight_min,
|
||||
c.weight_max,
|
||||
c.detail_id,
|
||||
c.freight_price,
|
||||
c.registration_fee,
|
||||
'HALF_UP',
|
||||
c.effective_date,
|
||||
c.expire_date,
|
||||
sysdate()
|
||||
from bms_product p
|
||||
inner join bms_product_country c on c.product_id = p.product_id
|
||||
where p.status = '1'
|
||||
and p.product_id = (
|
||||
select max(p2.product_id) from bms_product p2
|
||||
where p2.product_code = p.product_code and p2.status = '1'
|
||||
)
|
||||
and ifnull(c.status, '1') <> '2'
|
||||
<choose>
|
||||
<when test="openOnly">
|
||||
and (c.expire_date is null or date(c.expire_date) > curdate())
|
||||
</when>
|
||||
<otherwise>
|
||||
and date(c.effective_date) <= date(#{asOf})
|
||||
and (c.expire_date is null or date(c.expire_date) > date(#{asOf}))
|
||||
</otherwise>
|
||||
</choose>
|
||||
order by p.product_code asc, c.country_name asc, c.zone_code asc, c.weight_min asc, c.detail_id asc
|
||||
</insert>
|
||||
|
||||
<insert id="insertDiscountDetailsFromLibrary">
|
||||
insert ignore into prc_price_set_detail (
|
||||
price_set_id, psv_id, product_code, product_name, round_mode, create_time
|
||||
)
|
||||
select
|
||||
#{priceSetId},
|
||||
#{psvId},
|
||||
p.product_code,
|
||||
p.product_name,
|
||||
'HALF_UP',
|
||||
sysdate()
|
||||
from bms_product p
|
||||
where p.status = '1'
|
||||
and p.product_id = (
|
||||
select max(p2.product_id) from bms_product p2
|
||||
where p2.product_code = p.product_code and p2.status = '1'
|
||||
)
|
||||
order by p.product_code asc
|
||||
</insert>
|
||||
|
||||
<insert id="insertPrcPriceSetDetail" parameterType="PrcPriceSetDetail" useGeneratedKeys="true" keyProperty="psdId">
|
||||
insert into prc_price_set_detail (
|
||||
<if test="priceSetId != null">price_set_id,</if>
|
||||
<if test="psvId != null">psv_id,</if>
|
||||
<if test="productCode != null and productCode != ''">product_code,</if>
|
||||
<if test="productName != null">product_name,</if>
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="countryName != null">country_name,</if>
|
||||
<if test="zoneId != null">zone_id,</if>
|
||||
<if test="zoneCode != null">zone_code,</if>
|
||||
<if test="zoneName != null">zone_name,</if>
|
||||
<if test="zdId != null">zd_id,</if>
|
||||
<if test="wsdId != null">wsd_id,</if>
|
||||
<if test="weightLabel != null">weight_label,</if>
|
||||
<if test="weightMin != null">weight_min,</if>
|
||||
<if test="weightMax != null">weight_max,</if>
|
||||
<if test="productCountryId != null">product_country_id,</if>
|
||||
<if test="fvValue != null">fv_value,</if>
|
||||
<if test="fvRegistrationFee != null">fv_registration_fee,</if>
|
||||
<if test="discountValue != null">discount_value,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="prId != null">pr_id,</if>
|
||||
<if test="effectiveDate != null">effective_date,</if>
|
||||
expire_date,
|
||||
create_time
|
||||
) values (
|
||||
<if test="priceSetId != null">#{priceSetId},</if>
|
||||
<if test="psvId != null">#{psvId},</if>
|
||||
<if test="productCode != null and productCode != ''">#{productCode},</if>
|
||||
<if test="productName != null">#{productName},</if>
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="countryName != null">#{countryName},</if>
|
||||
<if test="zoneId != null">#{zoneId},</if>
|
||||
<if test="zoneCode != null">#{zoneCode},</if>
|
||||
<if test="zoneName != null">#{zoneName},</if>
|
||||
<if test="zdId != null">#{zdId},</if>
|
||||
<if test="wsdId != null">#{wsdId},</if>
|
||||
<if test="weightLabel != null">#{weightLabel},</if>
|
||||
<if test="weightMin != null">#{weightMin},</if>
|
||||
<if test="weightMax != null">#{weightMax},</if>
|
||||
<if test="productCountryId != null">#{productCountryId},</if>
|
||||
<if test="fvValue != null">#{fvValue},</if>
|
||||
<if test="fvRegistrationFee != null">#{fvRegistrationFee},</if>
|
||||
<if test="discountValue != null">#{discountValue},</if>
|
||||
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
|
||||
<if test="prId != null">#{prId},</if>
|
||||
<if test="effectiveDate != null">#{effectiveDate},</if>
|
||||
#{expireDate},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPriceSetDetail" parameterType="PrcPriceSetDetail">
|
||||
update prc_price_set_detail
|
||||
<set>
|
||||
<if test="psvId != null">psv_id = #{psvId},</if>
|
||||
<if test="productCode != null and productCode != ''">product_code = #{productCode},</if>
|
||||
<if test="productName != null">product_name = #{productName},</if>
|
||||
country_code = #{countryCode},
|
||||
country_name = #{countryName},
|
||||
zone_id = #{zoneId},
|
||||
zone_code = #{zoneCode},
|
||||
zone_name = #{zoneName},
|
||||
zd_id = #{zdId},
|
||||
wsd_id = #{wsdId},
|
||||
weight_label = #{weightLabel},
|
||||
weight_min = #{weightMin},
|
||||
weight_max = #{weightMax},
|
||||
product_country_id = #{productCountryId},
|
||||
fv_value = #{fvValue},
|
||||
fv_registration_fee = #{fvRegistrationFee},
|
||||
discount_value = #{discountValue},
|
||||
<if test="roundMode != null and roundMode != ''">round_mode = #{roundMode},</if>
|
||||
pr_id = #{prId},
|
||||
effective_date = #{effectiveDate},
|
||||
expire_date = #{expireDate},
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where psd_id = #{psdId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcPriceSetDetailByIds" parameterType="Long">
|
||||
delete from prc_price_set_detail where psd_id in
|
||||
<foreach item="psdId" collection="array" open="(" separator="," close=")">
|
||||
#{psdId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcPriceSetDetailByPriceSetId" parameterType="Long">
|
||||
delete from prc_price_set_detail where price_set_id = #{priceSetId}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcPriceSetDetailByPsvId" parameterType="Long">
|
||||
delete from prc_price_set_detail where psv_id = #{psvId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteOrphanDetailsByPriceSetId" parameterType="Long">
|
||||
delete from prc_price_set_detail where price_set_id = #{priceSetId} and psv_id is null
|
||||
</delete>
|
||||
|
||||
<select id="selectFixedMatch" resultMap="PrcPriceSetDetailResult">
|
||||
<include refid="selectPrcPriceSetDetailVo"/>
|
||||
where price_set_id = #{priceSetId}
|
||||
<if test="psvId != null">
|
||||
and psv_id = #{psvId}
|
||||
</if>
|
||||
and product_code = #{productCode}
|
||||
and (
|
||||
<if test="productCountryId != null">
|
||||
product_country_id = #{productCountryId}
|
||||
or
|
||||
</if>
|
||||
(
|
||||
<choose>
|
||||
<when test="countryCode != null and countryCode != ''">
|
||||
upper(ifnull(country_code,'')) = upper(#{countryCode})
|
||||
</when>
|
||||
<when test="countryName != null and countryName != ''">
|
||||
country_name = #{countryName}
|
||||
</when>
|
||||
<otherwise>
|
||||
1 = 0
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="zoneCode != null and zoneCode != ''">
|
||||
and (zone_code is null or upper(zone_code) = upper(#{zoneCode}))
|
||||
</if>
|
||||
<if test="weightLabel != null and weightLabel != ''">
|
||||
and (weight_label is null or weight_label = #{weightLabel} or weight_label like concat('%', #{weightLabel}, '%'))
|
||||
</if>
|
||||
)
|
||||
)
|
||||
order by
|
||||
case when #{productCountryId} is not null and product_country_id = #{productCountryId} then 0 else 1 end,
|
||||
case when #{zoneCode} is not null and upper(ifnull(zone_code,'')) = upper(#{zoneCode}) then 0 else 1 end,
|
||||
case when zone_code is null then 1 else 0 end,
|
||||
psd_id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectDiscountMatch" resultMap="PrcPriceSetDetailResult">
|
||||
<include refid="selectPrcPriceSetDetailVo"/>
|
||||
where price_set_id = #{priceSetId}
|
||||
<if test="psvId != null">
|
||||
and psv_id = #{psvId}
|
||||
</if>
|
||||
and product_code = #{productCode}
|
||||
order by psd_id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="copyDetailsFromVersion">
|
||||
insert into prc_price_set_detail (
|
||||
price_set_id, psv_id, product_code, product_name, country_code, country_name,
|
||||
zone_id, zone_code, zone_name, zd_id, wsd_id, weight_label, weight_min, weight_max,
|
||||
product_country_id, fv_value, fv_registration_fee, discount_value, round_mode,
|
||||
pr_id, effective_date, expire_date, create_time
|
||||
)
|
||||
select
|
||||
price_set_id, #{newPsvId}, product_code, product_name, country_code, country_name,
|
||||
zone_id, zone_code, zone_name, zd_id, wsd_id, weight_label, weight_min, weight_max,
|
||||
product_country_id, fv_value, fv_registration_fee, discount_value, round_mode,
|
||||
pr_id, effective_date, expire_date, sysdate()
|
||||
from prc_price_set_detail
|
||||
where psv_id = #{srcPsvId}
|
||||
order by psd_id asc
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -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.price.mapper.PrcPriceSetMapper">
|
||||
|
||||
<resultMap type="PrcPriceSet" id="PrcPriceSetResult">
|
||||
<id property="priceSetId" column="price_set_id" />
|
||||
<result property="priceSetCode" column="price_set_code" />
|
||||
<result property="priceSetName" column="price_set_name" />
|
||||
<result property="priceSetNote" column="price_set_note" />
|
||||
<result property="setType" column="set_type" />
|
||||
<result property="defaultDiscount" column="default_discount" />
|
||||
<result property="defaultType" column="default_type" />
|
||||
<result property="calculateSign" column="calculate_sign" />
|
||||
<result property="status" column="status" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="productCount" column="product_count" />
|
||||
<result property="customerCount" column="customer_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcPriceSetVo">
|
||||
select s.price_set_id, s.price_set_code, s.price_set_name, s.price_set_note,
|
||||
s.set_type, s.default_discount, s.default_type, s.calculate_sign,
|
||||
s.status, s.tms_id,
|
||||
s.created_by, s.create_time, s.updated_by, s.update_time,
|
||||
(select count(distinct d.product_code) from prc_price_set_detail d where d.price_set_id = s.price_set_id) as product_count,
|
||||
(select count(1) from prc_customer_price_set c where c.price_set_id = s.price_set_id) as customer_count
|
||||
from prc_price_set s
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcPriceSetById" parameterType="Long" resultMap="PrcPriceSetResult">
|
||||
<include refid="selectPrcPriceSetVo"/>
|
||||
where s.price_set_id = #{priceSetId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcPriceSetList" parameterType="PrcPriceSet" resultMap="PrcPriceSetResult">
|
||||
<include refid="selectPrcPriceSetVo"/>
|
||||
<where>
|
||||
<if test="setType != null and setType != ''">
|
||||
AND s.set_type = #{setType}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND s.status = #{status}
|
||||
</if>
|
||||
<if test="tmsId != null">
|
||||
AND s.tms_id = #{tmsId}
|
||||
</if>
|
||||
<if test="priceSetName != null and priceSetName != ''">
|
||||
AND s.price_set_name like concat('%', #{priceSetName}, '%')
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (
|
||||
s.price_set_code like concat('%', #{keyword}, '%')
|
||||
OR s.price_set_name like concat('%', #{keyword}, '%')
|
||||
OR exists (
|
||||
select 1 from prc_customer_price_set c
|
||||
where c.price_set_id = s.price_set_id
|
||||
and (
|
||||
c.customer_name like concat('%', #{keyword}, '%')
|
||||
or concat(c.customer_id, '') like concat('%', #{keyword}, '%')
|
||||
)
|
||||
)
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
order by s.price_set_id desc
|
||||
</select>
|
||||
|
||||
<select id="countByName" parameterType="PrcPriceSet" resultType="int">
|
||||
select count(1) from prc_price_set
|
||||
where price_set_name = #{priceSetName}
|
||||
<if test="priceSetId != null">
|
||||
AND price_set_id <> #{priceSetId}
|
||||
</if>
|
||||
<if test="tmsId != null">
|
||||
AND tms_id = #{tmsId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPriceSet" parameterType="PrcPriceSet" useGeneratedKeys="true" keyProperty="priceSetId">
|
||||
insert into prc_price_set (
|
||||
<if test="priceSetCode != null and priceSetCode != ''">price_set_code,</if>
|
||||
<if test="priceSetName != null and priceSetName != ''">price_set_name,</if>
|
||||
<if test="priceSetNote != null">price_set_note,</if>
|
||||
<if test="setType != null and setType != ''">set_type,</if>
|
||||
<if test="defaultDiscount != null">default_discount,</if>
|
||||
<if test="defaultType != null">default_type,</if>
|
||||
<if test="calculateSign != null">calculate_sign,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="priceSetCode != null and priceSetCode != ''">#{priceSetCode},</if>
|
||||
<if test="priceSetName != null and priceSetName != ''">#{priceSetName},</if>
|
||||
<if test="priceSetNote != null">#{priceSetNote},</if>
|
||||
<if test="setType != null and setType != ''">#{setType},</if>
|
||||
<if test="defaultDiscount != null">#{defaultDiscount},</if>
|
||||
<if test="defaultType != null">#{defaultType},</if>
|
||||
<if test="calculateSign != null">#{calculateSign},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPriceSet" parameterType="PrcPriceSet">
|
||||
update prc_price_set
|
||||
<set>
|
||||
<if test="priceSetCode != null and priceSetCode != ''">price_set_code = #{priceSetCode},</if>
|
||||
<if test="priceSetName != null and priceSetName != ''">price_set_name = #{priceSetName},</if>
|
||||
<if test="priceSetNote != null">price_set_note = #{priceSetNote},</if>
|
||||
<if test="setType != null and setType != ''">set_type = #{setType},</if>
|
||||
default_discount = #{defaultDiscount},
|
||||
<if test="defaultType != null">default_type = #{defaultType},</if>
|
||||
<if test="calculateSign != null">calculate_sign = #{calculateSign},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="tmsId != null">tms_id = #{tmsId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where price_set_id = #{priceSetId}
|
||||
</update>
|
||||
|
||||
<update id="updatePrcPriceSetStatus" parameterType="PrcPriceSet">
|
||||
update prc_price_set
|
||||
<set>
|
||||
status = #{status},
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where price_set_id = #{priceSetId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcPriceSetByIds" parameterType="Long">
|
||||
delete from prc_price_set where price_set_id in
|
||||
<foreach item="priceSetId" collection="array" open="(" separator="," close=")">
|
||||
#{priceSetId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?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.price.mapper.PrcPriceSetVersionMapper">
|
||||
|
||||
<resultMap type="PrcPriceSetVersion" id="PrcPriceSetVersionResult">
|
||||
<id property="psvId" column="psv_id" />
|
||||
<result property="priceSetId" column="price_set_id" />
|
||||
<result property="versionNo" column="version_no" />
|
||||
<result property="versionSeq" column="version_seq" />
|
||||
<result property="effectiveTime" column="effective_time" />
|
||||
<result property="expireTime" column="expire_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcPriceSetVersionVo">
|
||||
select psv_id, price_set_id, version_no, version_seq, effective_time, expire_time, status,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_price_set_version
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcPriceSetVersionById" parameterType="Long" resultMap="PrcPriceSetVersionResult">
|
||||
<include refid="selectPrcPriceSetVersionVo"/>
|
||||
where psv_id = #{psvId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcPriceSetVersionList" parameterType="PrcPriceSetVersion" resultMap="PrcPriceSetVersionResult">
|
||||
<include refid="selectPrcPriceSetVersionVo"/>
|
||||
<where>
|
||||
<if test="priceSetId != null">
|
||||
AND price_set_id = #{priceSetId}
|
||||
</if>
|
||||
<if test="versionNo != null and versionNo != ''">
|
||||
AND version_no = #{versionNo}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by version_seq desc
|
||||
</select>
|
||||
|
||||
<select id="selectMaxVersionSeq" resultType="java.lang.Integer">
|
||||
select max(version_seq) from prc_price_set_version where price_set_id = #{priceSetId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPriceSetVersion" parameterType="PrcPriceSetVersion" useGeneratedKeys="true" keyProperty="psvId">
|
||||
insert into prc_price_set_version (
|
||||
<if test="priceSetId != null">price_set_id,</if>
|
||||
<if test="versionNo != null and versionNo != ''">version_no,</if>
|
||||
<if test="versionSeq != null">version_seq,</if>
|
||||
<if test="effectiveTime != null">effective_time,</if>
|
||||
<if test="expireTime != null">expire_time,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="priceSetId != null">#{priceSetId},</if>
|
||||
<if test="versionNo != null and versionNo != ''">#{versionNo},</if>
|
||||
<if test="versionSeq != null">#{versionSeq},</if>
|
||||
<if test="effectiveTime != null">#{effectiveTime},</if>
|
||||
<if test="expireTime != null">#{expireTime},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPriceSetVersion" parameterType="PrcPriceSetVersion">
|
||||
update prc_price_set_version
|
||||
<set>
|
||||
<if test="versionNo != null and versionNo != ''">version_no = #{versionNo},</if>
|
||||
<if test="versionSeq != null">version_seq = #{versionSeq},</if>
|
||||
<if test="effectiveTime != null">effective_time = #{effectiveTime},</if>
|
||||
expire_time = #{expireTime},
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where psv_id = #{psvId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcPriceSetVersionByIds" parameterType="Long">
|
||||
delete from prc_price_set_version where psv_id in
|
||||
<foreach item="psvId" collection="array" open="(" separator="," close=")">
|
||||
#{psvId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcPriceSetVersionByPriceSetId" parameterType="Long">
|
||||
delete from prc_price_set_version where price_set_id = #{priceSetId}
|
||||
</delete>
|
||||
|
||||
<select id="selectPriceSetIds" resultType="Long">
|
||||
select distinct price_set_id from prc_price_set_version
|
||||
</select>
|
||||
|
||||
<select id="selectActiveByPriceSetAt" resultMap="PrcPriceSetVersionResult">
|
||||
<include refid="selectPrcPriceSetVersionVo"/>
|
||||
where price_set_id = #{priceSetId}
|
||||
and effective_time is not null
|
||||
and effective_time <= #{asOf}
|
||||
and (expire_time is null or expire_time > #{asOf})
|
||||
order by effective_time desc, version_seq desc, psv_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
<?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.price.mapper.PrcPriceSetVersionSurchargeMapper">
|
||||
|
||||
<resultMap type="PrcPriceSetVersionSurcharge" id="PrcPriceSetVersionSurchargeResult">
|
||||
<id property="psvsId" column="psvs_id" />
|
||||
<result property="psvId" column="psv_id" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="psdId" column="psd_id" />
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
<result property="chargeValue" column="charge_value" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcPriceSetVersionSurchargeVo">
|
||||
select psvs_id, psv_id, sc_id, product_code, psd_id, sc_name, fee_type, charge_type,
|
||||
charge_value, currency, round_mode, country_code, sc_note,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_price_set_version_surcharge
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcPriceSetVersionSurchargeById" parameterType="Long" resultMap="PrcPriceSetVersionSurchargeResult">
|
||||
<include refid="selectPrcPriceSetVersionSurchargeVo"/>
|
||||
where psvs_id = #{psvsId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcPriceSetVersionSurchargeList" parameterType="PrcPriceSetVersionSurcharge" resultMap="PrcPriceSetVersionSurchargeResult">
|
||||
<include refid="selectPrcPriceSetVersionSurchargeVo"/>
|
||||
<where>
|
||||
<if test="psvId != null">
|
||||
AND psv_id = #{psvId}
|
||||
</if>
|
||||
<if test="scId != null">
|
||||
AND sc_id = #{scId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code = #{productCode}
|
||||
</if>
|
||||
<if test="psdId != null">
|
||||
AND psd_id = #{psdId}
|
||||
</if>
|
||||
</where>
|
||||
order by psvs_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcPriceSetVersionSurcharge" parameterType="PrcPriceSetVersionSurcharge" useGeneratedKeys="true" keyProperty="psvsId">
|
||||
insert into prc_price_set_version_surcharge (
|
||||
<if test="psvId != null">psv_id,</if>
|
||||
<if test="psdId != null">psd_id,</if>
|
||||
<if test="scId != null">sc_id,</if>
|
||||
<if test="productCode != null">product_code,</if>
|
||||
<if test="scName != null and scName != ''">sc_name,</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type,</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type,</if>
|
||||
<if test="chargeValue != null">charge_value,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="scNote != null">sc_note,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="psvId != null">#{psvId},</if>
|
||||
<if test="psdId != null">#{psdId},</if>
|
||||
<if test="scId != null">#{scId},</if>
|
||||
<if test="productCode != null">#{productCode},</if>
|
||||
<if test="scName != null and scName != ''">#{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
|
||||
<if test="chargeValue != null">#{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="scNote != null">#{scNote},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcPriceSetVersionSurcharge" parameterType="PrcPriceSetVersionSurcharge">
|
||||
update prc_price_set_version_surcharge
|
||||
<set>
|
||||
<if test="psdId != null">psd_id = #{psdId},</if>
|
||||
<if test="scId != null">sc_id = #{scId},</if>
|
||||
product_code = #{productCode},
|
||||
<if test="scName != null and scName != ''">sc_name = #{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type = #{chargeType},</if>
|
||||
<if test="chargeValue != null">charge_value = #{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode = #{roundMode},</if>
|
||||
country_code = #{countryCode},
|
||||
sc_note = #{scNote},
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where psvs_id = #{psvsId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcPriceSetVersionSurchargeByIds" parameterType="Long">
|
||||
delete from prc_price_set_version_surcharge where psvs_id in
|
||||
<foreach item="psvsId" collection="array" open="(" separator="," close=")">
|
||||
#{psvsId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByPsvId" parameterType="Long">
|
||||
delete from prc_price_set_version_surcharge where psv_id = #{psvId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByPsdId" parameterType="Long">
|
||||
delete from prc_price_set_version_surcharge where psd_id = #{psdId}
|
||||
</delete>
|
||||
|
||||
<select id="selectByPsdIds" resultMap="PrcPriceSetVersionSurchargeResult">
|
||||
<include refid="selectPrcPriceSetVersionSurchargeVo"/>
|
||||
where psd_id in
|
||||
<foreach item="id" collection="psdIds" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by psvs_id asc
|
||||
</select>
|
||||
|
||||
<!-- Join detail x surcharge_rel x surcharge; skip OF fuel; product-level or same detail_id -->
|
||||
<insert id="insertFromLibraryRels">
|
||||
insert into prc_price_set_version_surcharge (
|
||||
psv_id, psd_id, sc_id, product_code, sc_name, fee_type, charge_type,
|
||||
charge_value, currency, round_mode, country_code, sc_note,
|
||||
created_by, create_time
|
||||
)
|
||||
select
|
||||
d.psv_id,
|
||||
d.psd_id,
|
||||
r.sc_id,
|
||||
d.product_code,
|
||||
s.sc_name,
|
||||
ifnull(nullif(s.fee_type, ''), 'SURCHARGE'),
|
||||
ifnull(nullif(s.charge_type, ''), 'FIXED'),
|
||||
s.charge_value,
|
||||
ifnull(nullif(s.currency, ''), 'CNY'),
|
||||
ifnull(nullif(s.round_mode, ''), 'HALF_UP'),
|
||||
s.country_code,
|
||||
s.sc_note,
|
||||
#{createBy},
|
||||
sysdate()
|
||||
from prc_price_set_detail d
|
||||
inner join prc_surcharge_rel r on r.product_code = d.product_code
|
||||
inner join prc_surcharge s on s.sc_id = r.sc_id
|
||||
where d.psv_id = #{psvId}
|
||||
and ifnull(s.sc_name, '') <> ''
|
||||
and s.charge_value is not null
|
||||
and lower(ifnull(s.ss_code, '')) not in ('of', 'vd')
|
||||
and (r.detail_id is null or r.detail_id = d.product_country_id)
|
||||
and (
|
||||
s.country_code is null or s.country_code = ''
|
||||
or d.country_code is null or d.country_code = ''
|
||||
or upper(s.country_code) = upper(d.country_code)
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="copySurchargesFromVersion">
|
||||
insert into prc_price_set_version_surcharge (
|
||||
psv_id, psd_id, sc_id, product_code, sc_name, fee_type, charge_type,
|
||||
charge_value, currency, round_mode, country_code, sc_note,
|
||||
created_by, create_time
|
||||
)
|
||||
select
|
||||
#{newPsvId},
|
||||
nd.psd_id,
|
||||
sc.sc_id,
|
||||
sc.product_code,
|
||||
sc.sc_name,
|
||||
sc.fee_type,
|
||||
sc.charge_type,
|
||||
sc.charge_value,
|
||||
sc.currency,
|
||||
sc.round_mode,
|
||||
sc.country_code,
|
||||
sc.sc_note,
|
||||
#{createBy},
|
||||
sysdate()
|
||||
from prc_price_set_version_surcharge sc
|
||||
inner join prc_price_set_detail od
|
||||
on od.psd_id = sc.psd_id and od.psv_id = #{srcPsvId}
|
||||
inner join prc_price_set_detail nd
|
||||
on nd.psv_id = #{newPsvId}
|
||||
and nd.product_code = od.product_code
|
||||
and ifnull(nd.country_code, '') = ifnull(od.country_code, '')
|
||||
and ifnull(nd.zone_code, '') = ifnull(od.zone_code, '')
|
||||
and ifnull(nd.weight_label, '') = ifnull(od.weight_label, '')
|
||||
and ifnull(nd.product_country_id, 0) = ifnull(od.product_country_id, 0)
|
||||
and ifnull(nd.discount_value, -1) = ifnull(od.discount_value, -1)
|
||||
where sc.psv_id = #{srcPsvId}
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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.price.mapper.PrcQuoteFeeMapper">
|
||||
|
||||
<resultMap type="PrcQuoteFee" id="PrcQuoteFeeResult">
|
||||
<id property="feeId" column="fee_id" />
|
||||
<result property="quoteId" column="quote_id" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="feeName" column="fee_name" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="amount" column="amount" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByQuoteId" parameterType="String" resultMap="PrcQuoteFeeResult">
|
||||
select fee_id, quote_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||
from prc_quote_fee
|
||||
where quote_id = #{quoteId}
|
||||
order by field(fee_type, 'BASIC_FREIGHT', 'REGISTRATION_FEE', 'SURCHARGE', 'REFUND'), fee_id
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcQuoteFee" parameterType="PrcQuoteFee">
|
||||
insert into prc_quote_fee (
|
||||
fee_id, quote_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||
) values (
|
||||
#{feeId}, #{quoteId}, #{feeType}, #{feeName}, #{scId}, #{amount}, #{currency}, #{roundMode}, #{remark}, sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
insert into prc_quote_fee (
|
||||
fee_id, quote_id, fee_type, fee_name, sc_id, amount, currency, round_mode, remark, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.feeId}, #{item.quoteId}, #{item.feeType}, #{item.feeName}, #{item.scId}, #{item.amount},
|
||||
#{item.currency}, #{item.roundMode}, #{item.remark}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByQuoteId" parameterType="String">
|
||||
delete from prc_quote_fee where quote_id = #{quoteId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?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.price.mapper.PrcQuoteMapper">
|
||||
|
||||
<resultMap type="PrcQuote" id="PrcQuoteResult">
|
||||
<id property="quoteId" column="quote_id" />
|
||||
<result property="quoteKey" column="quote_key" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="destPostcode" column="dest_postcode" />
|
||||
<result property="weight" column="weight" />
|
||||
<result property="bizDate" column="biz_date" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="matchSource" column="match_source" />
|
||||
<result property="matchMessage" column="match_message" />
|
||||
<result property="priceSetId" column="price_set_id" />
|
||||
<result property="priceSetCode" column="price_set_code" />
|
||||
<result property="priceSetName" column="price_set_name" />
|
||||
<result property="setType" column="set_type" />
|
||||
<result property="bindPriority" column="bind_priority" />
|
||||
<result property="customerPricesetId" column="customer_priceset_id" />
|
||||
<result property="productCountryId" column="product_country_id" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="weightLabel" column="weight_label" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="chargeWeight" column="charge_weight" />
|
||||
<result property="freightRate" column="freight_rate" />
|
||||
<result property="baseFreightRate" column="base_freight_rate" />
|
||||
<result property="discountPercent" column="discount_percent" />
|
||||
<result property="registrationFee" column="registration_fee" />
|
||||
<result property="freightAmount" column="freight_amount" />
|
||||
<result property="surchargeAmount" column="surcharge_amount" />
|
||||
<result property="payableTotal" column="payable_total" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcQuoteVo">
|
||||
select quote_id, quote_key, customer_id, customer_code, product_code, product_name,
|
||||
country_code, country_name, dest_postcode, weight, biz_date, tms_id,
|
||||
match_source, match_message, price_set_id, price_set_code, price_set_name,
|
||||
set_type, bind_priority, customer_priceset_id, product_country_id,
|
||||
weight_min, weight_max, weight_label, effective_date, charge_weight,
|
||||
freight_rate, base_freight_rate, discount_percent, registration_fee,
|
||||
freight_amount, surcharge_amount, payable_total, currency, round_mode,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_quote
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcQuoteByKey" parameterType="String" resultMap="PrcQuoteResult">
|
||||
<include refid="selectPrcQuoteVo"/>
|
||||
where quote_key = #{quoteKey}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcQuoteById" parameterType="String" resultMap="PrcQuoteResult">
|
||||
<include refid="selectPrcQuoteVo"/>
|
||||
where quote_id = #{quoteId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcQuoteList" parameterType="PrcQuote" resultMap="PrcQuoteResult">
|
||||
<include refid="selectPrcQuoteVo"/>
|
||||
<where>
|
||||
<if test="customerId != null">
|
||||
AND customer_id = #{customerId}
|
||||
</if>
|
||||
<if test="customerCode != null and customerCode != ''">
|
||||
AND customer_code = #{customerCode}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND product_code like concat('%', #{productCode}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND product_name like concat('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="priceSetName != null and priceSetName != ''">
|
||||
AND price_set_name like concat('%', #{priceSetName}, '%')
|
||||
</if>
|
||||
<if test="matchSource != null and matchSource != ''">
|
||||
AND match_source = #{matchSource}
|
||||
</if>
|
||||
<if test="bizDate != null">
|
||||
AND biz_date = #{bizDate}
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''">
|
||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''">
|
||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
order by quote_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcQuote" parameterType="PrcQuote">
|
||||
insert into prc_quote (
|
||||
quote_id, quote_key, customer_id, customer_code, product_code, product_name,
|
||||
country_code, country_name, dest_postcode, weight, biz_date, tms_id,
|
||||
match_source, match_message, price_set_id, price_set_code, price_set_name,
|
||||
set_type, bind_priority, customer_priceset_id, product_country_id,
|
||||
weight_min, weight_max, weight_label, effective_date, charge_weight,
|
||||
freight_rate, base_freight_rate, discount_percent, registration_fee,
|
||||
freight_amount, surcharge_amount, payable_total, currency, round_mode,
|
||||
create_time
|
||||
) values (
|
||||
#{quoteId}, #{quoteKey}, #{customerId}, #{customerCode}, #{productCode}, #{productName},
|
||||
#{countryCode}, #{countryName}, #{destPostcode}, #{weight}, #{bizDate}, #{tmsId},
|
||||
#{matchSource}, #{matchMessage}, #{priceSetId}, #{priceSetCode}, #{priceSetName},
|
||||
#{setType}, #{bindPriority}, #{customerPricesetId}, #{productCountryId},
|
||||
#{weightMin}, #{weightMax}, #{weightLabel}, #{effectiveDate}, #{chargeWeight},
|
||||
#{freightRate}, #{baseFreightRate}, #{discountPercent}, #{registrationFee},
|
||||
#{freightAmount}, #{surchargeAmount}, #{payableTotal}, #{currency}, #{roundMode},
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateQuoteAmounts">
|
||||
update prc_quote
|
||||
set surcharge_amount = #{surchargeAmount},
|
||||
payable_total = #{payableTotal},
|
||||
update_time = sysdate()
|
||||
where quote_id = #{quoteId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?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.price.mapper.PrcSurchargeMapper">
|
||||
|
||||
<resultMap type="PrcSurcharge" id="PrcSurchargeResult">
|
||||
<id property="scId" column="sc_id" />
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
<result property="chargeValue" column="charge_value" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcSurchargeVo">
|
||||
select sc_id, sc_name, fee_type, charge_type, charge_value, currency, round_mode, ss_code,
|
||||
country_code, sc_note, tms_id, created_by, create_time, updated_by, update_time
|
||||
from prc_surcharge
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcSurchargeById" parameterType="Long" resultMap="PrcSurchargeResult">
|
||||
<include refid="selectPrcSurchargeVo"/>
|
||||
where sc_id = #{scId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcSurchargeList" parameterType="PrcSurcharge" resultMap="PrcSurchargeResult">
|
||||
<include refid="selectPrcSurchargeVo"/>
|
||||
<where>
|
||||
<if test="scName != null and scName != ''">
|
||||
AND sc_name like concat('%', #{scName}, '%')
|
||||
</if>
|
||||
<if test="feeType != null and feeType != ''">
|
||||
AND fee_type = #{feeType}
|
||||
</if>
|
||||
<if test="chargeType != null and chargeType != ''">
|
||||
AND charge_type = #{chargeType}
|
||||
</if>
|
||||
<if test="roundMode != null and roundMode != ''">
|
||||
AND round_mode = #{roundMode}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="ssCode != null and ssCode != ''">
|
||||
AND lower(ss_code) = lower(#{ssCode})
|
||||
</when>
|
||||
<otherwise>
|
||||
<!-- 默认排除已作废记录,可在状态筛选中选择作废查看历史 -->
|
||||
AND lower(ifnull(ss_code, '')) <> 'vd'
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="tmsId != null">
|
||||
AND tms_id = #{tmsId}
|
||||
</if>
|
||||
</where>
|
||||
order by sc_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcSurcharge" parameterType="PrcSurcharge" useGeneratedKeys="true" keyProperty="scId">
|
||||
insert into prc_surcharge (
|
||||
<if test="scName != null and scName != ''">sc_name,</if>
|
||||
<if test="feeType != null and feeType != ''">fee_type,</if>
|
||||
<if test="chargeType != null and chargeType != ''">charge_type,</if>
|
||||
<if test="chargeValue != null">charge_value,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="roundMode != null and roundMode != ''">round_mode,</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code,</if>
|
||||
<if test="countryCode != null">country_code,</if>
|
||||
<if test="scNote != null">sc_note,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="scName != null and scName != ''">#{scName},</if>
|
||||
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
||||
<if test="chargeType != null and chargeType != ''">#{chargeType},</if>
|
||||
<if test="chargeValue != null">#{chargeValue},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="roundMode != null and roundMode != ''">#{roundMode},</if>
|
||||
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
|
||||
<if test="countryCode != null">#{countryCode},</if>
|
||||
<if test="scNote != null">#{scNote},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 状态原地更新(不新增数据):停用置 of,版本化作废旧记录置 vd -->
|
||||
<update id="updateSsCodeByIds">
|
||||
update prc_surcharge
|
||||
set ss_code = #{ssCode}, updated_by = #{operator}, update_time = sysdate()
|
||||
where sc_id in
|
||||
<foreach item="scId" collection="scIds" open="(" separator="," close=")">
|
||||
#{scId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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.price.mapper.PrcSurchargeRelMapper">
|
||||
|
||||
<resultMap type="PrcSurchargeRel" id="PrcSurchargeRelResult">
|
||||
<id property="relId" column="rel_id" />
|
||||
<result property="scId" column="sc_id" />
|
||||
<result property="productId" column="product_id" />
|
||||
<result property="productCode" column="product_code" />
|
||||
<result property="detailId" column="detail_id" />
|
||||
<result property="scName" column="sc_name" />
|
||||
<result property="feeType" column="fee_type" />
|
||||
<result property="chargeType" column="charge_type" />
|
||||
<result property="chargeValue" column="charge_value" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="roundMode" column="round_mode" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="scNote" column="sc_note" />
|
||||
<result property="countryName" column="country_name" />
|
||||
<result property="weightMin" column="weight_min" />
|
||||
<result property="weightMax" column="weight_max" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcSurchargeRelVo">
|
||||
select r.rel_id, r.sc_id, r.product_id, r.product_code, r.detail_id,
|
||||
r.created_by, r.create_time, r.updated_by, r.update_time,
|
||||
s.sc_name, s.fee_type, s.charge_type, s.charge_value, s.currency,
|
||||
s.round_mode, s.ss_code, s.country_code, s.sc_note,
|
||||
c.country_name, c.weight_min, c.weight_max
|
||||
from prc_surcharge_rel r
|
||||
join prc_surcharge s on s.sc_id = r.sc_id
|
||||
left join bms_product_country c on c.detail_id = r.detail_id
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcSurchargeRelList" parameterType="PrcSurchargeRel" resultMap="PrcSurchargeRelResult">
|
||||
<include refid="selectPrcSurchargeRelVo"/>
|
||||
<where>
|
||||
<if test="productId != null">
|
||||
AND r.product_id = #{productId}
|
||||
</if>
|
||||
<if test="productCode != null and productCode != ''">
|
||||
AND r.product_code = #{productCode}
|
||||
</if>
|
||||
<if test="scId != null">
|
||||
AND r.sc_id = #{scId}
|
||||
</if>
|
||||
</where>
|
||||
order by r.detail_id is not null, r.rel_id asc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcSurchargeRel" parameterType="PrcSurchargeRel" useGeneratedKeys="true" keyProperty="relId">
|
||||
insert into prc_surcharge_rel (
|
||||
sc_id, product_id, product_code, detail_id,
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
#{scId}, #{productId}, #{productCode}, #{detailId},
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deletePrcSurchargeRelByIds" parameterType="Long">
|
||||
delete from prc_surcharge_rel where rel_id in
|
||||
<foreach item="relId" collection="array" open="(" separator="," close=")">
|
||||
#{relId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRelByProductCodes">
|
||||
delete from prc_surcharge_rel where product_code in
|
||||
<foreach item="code" collection="array" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 附加费版本化编辑后,产品关联重指向新记录 -->
|
||||
<update id="rebindRelScId">
|
||||
update prc_surcharge_rel
|
||||
set sc_id = #{newScId}, updated_by = #{operator}, update_time = sysdate()
|
||||
where sc_id = #{oldScId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,105 @@
|
||||
<?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.price.mapper.PrcWeightSectionDetailMapper">
|
||||
|
||||
<resultMap type="PrcWeightSectionDetail" id="PrcWeightSectionDetailResult">
|
||||
<id property="wsdId" column="wsd_id" />
|
||||
<result property="wstId" column="wst_id" />
|
||||
<result property="wlTitle" column="wl_title" />
|
||||
<result property="wlStartweight" column="wl_startweight" />
|
||||
<result property="wlEndweight" column="wl_endweight" />
|
||||
<result property="weightBillingCode" column="weight_billing_code" />
|
||||
<result property="fvUnitweight" column="fv_unitweight" />
|
||||
<result property="effectiveDate" column="effective_date" />
|
||||
<result property="expireDate" column="expire_date" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcWeightSectionDetailVo">
|
||||
select wsd_id, wst_id, wl_title, wl_startweight, wl_endweight, weight_billing_code,
|
||||
fv_unitweight, effective_date, expire_date, create_time, update_time
|
||||
from prc_weight_section_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcWeightSectionDetailById" parameterType="Long" resultMap="PrcWeightSectionDetailResult">
|
||||
<include refid="selectPrcWeightSectionDetailVo"/>
|
||||
where wsd_id = #{wsdId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcWeightSectionDetailListByWstId" parameterType="Long" resultMap="PrcWeightSectionDetailResult">
|
||||
<include refid="selectPrcWeightSectionDetailVo"/>
|
||||
where wst_id = #{wstId}
|
||||
order by wl_startweight asc, wsd_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectPrcWeightSectionDetailList" parameterType="PrcWeightSectionDetail" resultMap="PrcWeightSectionDetailResult">
|
||||
<include refid="selectPrcWeightSectionDetailVo"/>
|
||||
<where>
|
||||
<if test="wstId != null">
|
||||
AND wst_id = #{wstId}
|
||||
</if>
|
||||
<if test="wlTitle != null and wlTitle != ''">
|
||||
AND wl_title like concat('%', #{wlTitle}, '%')
|
||||
</if>
|
||||
<if test="weightBillingCode != null and weightBillingCode != ''">
|
||||
AND weight_billing_code = #{weightBillingCode}
|
||||
</if>
|
||||
</where>
|
||||
order by wl_startweight asc, wsd_id asc
|
||||
</select>
|
||||
|
||||
<select id="countByWstId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_weight_section_detail where wst_id = #{wstId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcWeightSectionDetail" parameterType="PrcWeightSectionDetail" useGeneratedKeys="true" keyProperty="wsdId">
|
||||
insert into prc_weight_section_detail (
|
||||
<if test="wstId != null">wst_id,</if>
|
||||
<if test="wlTitle != null">wl_title,</if>
|
||||
<if test="wlStartweight != null">wl_startweight,</if>
|
||||
<if test="wlEndweight != null">wl_endweight,</if>
|
||||
<if test="weightBillingCode != null">weight_billing_code,</if>
|
||||
<if test="fvUnitweight != null">fv_unitweight,</if>
|
||||
<if test="effectiveDate != null">effective_date,</if>
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="wstId != null">#{wstId},</if>
|
||||
<if test="wlTitle != null">#{wlTitle},</if>
|
||||
<if test="wlStartweight != null">#{wlStartweight},</if>
|
||||
<if test="wlEndweight != null">#{wlEndweight},</if>
|
||||
<if test="weightBillingCode != null">#{weightBillingCode},</if>
|
||||
<if test="fvUnitweight != null">#{fvUnitweight},</if>
|
||||
<if test="effectiveDate != null">#{effectiveDate},</if>
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcWeightSectionDetail" parameterType="PrcWeightSectionDetail">
|
||||
update prc_weight_section_detail
|
||||
<set>
|
||||
<if test="wstId != null">wst_id = #{wstId},</if>
|
||||
<if test="wlTitle != null">wl_title = #{wlTitle},</if>
|
||||
<if test="wlStartweight != null">wl_startweight = #{wlStartweight},</if>
|
||||
<if test="wlEndweight != null">wl_endweight = #{wlEndweight},</if>
|
||||
<if test="weightBillingCode != null">weight_billing_code = #{weightBillingCode},</if>
|
||||
<if test="fvUnitweight != null">fv_unitweight = #{fvUnitweight},</if>
|
||||
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
|
||||
<if test="expireDate != null">expire_date = #{expireDate},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where wsd_id = #{wsdId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcWeightSectionDetailByIds" parameterType="Long">
|
||||
delete from prc_weight_section_detail where wsd_id in
|
||||
<foreach item="wsdId" collection="array" open="(" separator="," close=")">
|
||||
#{wsdId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
<?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.price.mapper.PrcWeightSectionTemplateMapper">
|
||||
|
||||
<resultMap type="PrcWeightSectionTemplate" id="PrcWeightSectionTemplateResult">
|
||||
<id property="wstId" column="wst_id" />
|
||||
<result property="wstName" column="wst_name" />
|
||||
<result property="ssCode" column="ss_code" />
|
||||
<result property="pgCode" column="pg_code" />
|
||||
<result property="snId" column="sn_id" />
|
||||
<result property="ctCode" column="ct_code" />
|
||||
<result property="pmCode" column="pm_code" />
|
||||
<result property="wstNote" column="wst_note" />
|
||||
<result property="tmsId" column="tms_id" />
|
||||
<result property="createBy" column="created_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="updated_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="detailCount" column="detail_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcWeightSectionTemplateVo">
|
||||
select wst_id, wst_name, ss_code, pg_code, sn_id, ct_code, pm_code, wst_note, tms_id,
|
||||
created_by, create_time, updated_by, update_time
|
||||
from prc_weight_section_template
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcWeightSectionTemplateById" parameterType="Long" resultMap="PrcWeightSectionTemplateResult">
|
||||
<include refid="selectPrcWeightSectionTemplateVo"/>
|
||||
where wst_id = #{wstId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcWeightSectionTemplateList" parameterType="PrcWeightSectionTemplate" resultMap="PrcWeightSectionTemplateResult">
|
||||
<include refid="selectPrcWeightSectionTemplateVo"/>
|
||||
<where>
|
||||
<if test="wstName != null and wstName != ''">
|
||||
AND wst_name like concat('%', #{wstName}, '%')
|
||||
</if>
|
||||
<if test="ssCode != null and ssCode != ''">
|
||||
AND ss_code = #{ssCode}
|
||||
</if>
|
||||
<if test="pgCode != null and pgCode != ''">
|
||||
AND pg_code = #{pgCode}
|
||||
</if>
|
||||
<if test="snId != null">
|
||||
AND sn_id = #{snId}
|
||||
</if>
|
||||
<if test="ctCode != null and ctCode != ''">
|
||||
AND ct_code = #{ctCode}
|
||||
</if>
|
||||
<if test="pmCode != null and pmCode != ''">
|
||||
AND pm_code = #{pmCode}
|
||||
</if>
|
||||
<if test="tmsId != null">
|
||||
AND tms_id = #{tmsId}
|
||||
</if>
|
||||
</where>
|
||||
order by wst_id desc
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcWeightSectionTemplate" parameterType="PrcWeightSectionTemplate" useGeneratedKeys="true" keyProperty="wstId">
|
||||
insert into prc_weight_section_template (
|
||||
<if test="wstName != null and wstName != ''">wst_name,</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code,</if>
|
||||
<if test="pgCode != null">pg_code,</if>
|
||||
<if test="snId != null">sn_id,</if>
|
||||
<if test="ctCode != null">ct_code,</if>
|
||||
<if test="pmCode != null">pm_code,</if>
|
||||
<if test="wstNote != null">wst_note,</if>
|
||||
<if test="tmsId != null">tms_id,</if>
|
||||
<if test="createBy != null and createBy != ''">created_by,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="wstName != null and wstName != ''">#{wstName},</if>
|
||||
<if test="ssCode != null and ssCode != ''">#{ssCode},</if>
|
||||
<if test="pgCode != null">#{pgCode},</if>
|
||||
<if test="snId != null">#{snId},</if>
|
||||
<if test="ctCode != null">#{ctCode},</if>
|
||||
<if test="pmCode != null">#{pmCode},</if>
|
||||
<if test="wstNote != null">#{wstNote},</if>
|
||||
<if test="tmsId != null">#{tmsId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcWeightSectionTemplate" parameterType="PrcWeightSectionTemplate">
|
||||
update prc_weight_section_template
|
||||
<set>
|
||||
<if test="wstName != null and wstName != ''">wst_name = #{wstName},</if>
|
||||
<if test="ssCode != null and ssCode != ''">ss_code = #{ssCode},</if>
|
||||
<if test="pgCode != null">pg_code = #{pgCode},</if>
|
||||
<if test="snId != null">sn_id = #{snId},</if>
|
||||
<if test="ctCode != null">ct_code = #{ctCode},</if>
|
||||
<if test="pmCode != null">pm_code = #{pmCode},</if>
|
||||
<if test="wstNote != null">wst_note = #{wstNote},</if>
|
||||
<if test="tmsId != null">tms_id = #{tmsId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where wst_id = #{wstId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcWeightSectionTemplateByIds" parameterType="Long">
|
||||
delete from prc_weight_section_template where wst_id in
|
||||
<foreach item="wstId" collection="array" open="(" separator="," close=")">
|
||||
#{wstId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?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.price.mapper.PrcZoneDetailMapper">
|
||||
|
||||
<resultMap type="PrcZoneDetail" id="PrcZoneDetailResult">
|
||||
<id property="detailId" column="detail_id" />
|
||||
<result property="zoneId" column="zone_id" />
|
||||
<result property="postcode" column="postcode" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcZoneDetailVo">
|
||||
select detail_id, zone_id, postcode, create_time, update_time
|
||||
from prc_zone_detail
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcZoneDetailById" parameterType="Long" resultMap="PrcZoneDetailResult">
|
||||
<include refid="selectPrcZoneDetailVo"/>
|
||||
where detail_id = #{detailId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcZoneDetailList" parameterType="PrcZoneDetail" resultMap="PrcZoneDetailResult">
|
||||
<include refid="selectPrcZoneDetailVo"/>
|
||||
<where>
|
||||
<if test="zoneId != null">
|
||||
AND zone_id = #{zoneId}
|
||||
</if>
|
||||
<if test="postcode != null and postcode != ''">
|
||||
AND postcode like concat('%', #{postcode}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by postcode asc, detail_id asc
|
||||
</select>
|
||||
|
||||
<select id="countByZoneId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_zone_detail where zone_id = #{zoneId}
|
||||
</select>
|
||||
|
||||
<select id="countByRegionId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where z.region_id = #{regionId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcZoneDetail" parameterType="PrcZoneDetail" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into prc_zone_detail (
|
||||
<if test="zoneId != null">zone_id,</if>
|
||||
<if test="postcode != null and postcode != ''">postcode,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="zoneId != null">#{zoneId},</if>
|
||||
<if test="postcode != null and postcode != ''">#{postcode},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertPrcZoneDetailBatch">
|
||||
insert into prc_zone_detail (zone_id, postcode, create_time) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.zoneId}, #{item.postcode}, sysdate())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcZoneDetail" parameterType="PrcZoneDetail">
|
||||
update prc_zone_detail
|
||||
<set>
|
||||
<if test="zoneId != null">zone_id = #{zoneId},</if>
|
||||
<if test="postcode != null and postcode != ''">postcode = #{postcode},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where detail_id = #{detailId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcZoneDetailByIds" parameterType="Long">
|
||||
delete from prc_zone_detail where detail_id in
|
||||
<foreach item="detailId" collection="array" open="(" separator="," close=")">
|
||||
#{detailId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcZoneDetailByZoneId" parameterType="Long">
|
||||
delete from prc_zone_detail where zone_id = #{zoneId}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcZoneDetailByRegionId" parameterType="Long">
|
||||
delete d from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where z.region_id = #{regionId}
|
||||
</delete>
|
||||
|
||||
<select id="selectZoneByCountryPostcode" resultType="com.bms.price.domain.PrcZone">
|
||||
select z.zone_id as zoneId,
|
||||
z.region_id as regionId,
|
||||
z.country_code as countryCode,
|
||||
z.zone_code as zoneCode,
|
||||
z.zone_name as zoneName,
|
||||
z.zone_sort as zoneSort,
|
||||
z.remark as remark,
|
||||
z.create_time as createTime,
|
||||
z.update_time as updateTime
|
||||
from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where upper(ifnull(z.country_code,'')) = upper(#{countryCode})
|
||||
and (
|
||||
replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '')
|
||||
or replace(upper(#{postcode}), ' ', '') like concat(replace(upper(ifnull(d.postcode,'')), ' ', ''), '%')
|
||||
)
|
||||
order by
|
||||
case when replace(upper(ifnull(d.postcode,'')), ' ', '') = replace(upper(#{postcode}), ' ', '') then 0 else 1 end,
|
||||
char_length(replace(ifnull(d.postcode,''), ' ', '')) desc,
|
||||
d.detail_id asc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?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.price.mapper.PrcZoneMapper">
|
||||
|
||||
<resultMap type="PrcZone" id="PrcZoneResult">
|
||||
<id property="zoneId" column="zone_id" />
|
||||
<result property="regionId" column="region_id" />
|
||||
<result property="countryCode" column="country_code" />
|
||||
<result property="zoneCode" column="zone_code" />
|
||||
<result property="zoneName" column="zone_name" />
|
||||
<result property="zoneSort" column="zone_sort" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="detailCount" column="detail_count" />
|
||||
<result property="countryNameCn" column="country_name_cn" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="PrcZoneRegion" id="PrcZoneRegionResult">
|
||||
<id property="regionId" column="region_id" />
|
||||
<result property="countryNameCn" column="country_name_cn" />
|
||||
<result property="countryNameEn" column="country_name_en" />
|
||||
<result property="countryCode2" column="country_code_2" />
|
||||
<result property="status" column="status" />
|
||||
<result property="zoneCount" column="zone_count" />
|
||||
<result property="detailCount" column="detail_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPrcZoneVo">
|
||||
select zone_id, region_id, country_code, zone_code, zone_name, zone_sort, remark, create_time, update_time
|
||||
from prc_zone
|
||||
</sql>
|
||||
|
||||
<select id="selectPrcZoneById" parameterType="Long" resultMap="PrcZoneResult">
|
||||
<include refid="selectPrcZoneVo"/>
|
||||
where zone_id = #{zoneId}
|
||||
</select>
|
||||
|
||||
<select id="selectPrcZoneListByRegionId" parameterType="Long" resultMap="PrcZoneResult">
|
||||
select z.zone_id, z.region_id, z.country_code, z.zone_code, z.zone_name, z.zone_sort, z.remark,
|
||||
z.create_time, z.update_time,
|
||||
(select count(1) from prc_zone_detail d where d.zone_id = z.zone_id) as detail_count
|
||||
from prc_zone z
|
||||
where z.region_id = #{regionId}
|
||||
order by z.zone_sort asc, z.zone_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectPrcZoneList" parameterType="PrcZone" resultMap="PrcZoneResult">
|
||||
select z.zone_id, z.region_id, z.country_code, z.zone_code, z.zone_name, z.zone_sort, z.remark,
|
||||
z.create_time, z.update_time,
|
||||
r.country_name_cn,
|
||||
(select count(1) from prc_zone_detail d where d.zone_id = z.zone_id) as detail_count
|
||||
from prc_zone z
|
||||
left join bms_region r on r.region_id = z.region_id
|
||||
<where>
|
||||
<if test="regionId != null">
|
||||
AND z.region_id = #{regionId}
|
||||
</if>
|
||||
<if test="countryCode != null and countryCode != ''">
|
||||
AND z.country_code = #{countryCode}
|
||||
</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">
|
||||
AND z.zone_code like concat('%', #{zoneCode}, '%')
|
||||
</if>
|
||||
<if test="zoneName != null and zoneName != ''">
|
||||
AND z.zone_name like concat('%', #{zoneName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by z.zone_sort asc, z.zone_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectZoneRegionList" parameterType="PrcZoneRegion" resultMap="PrcZoneRegionResult">
|
||||
select r.region_id, r.country_name_cn, r.country_name_en, r.country_code_2, r.status,
|
||||
count(distinct z.zone_id) as zone_count,
|
||||
count(d.detail_id) as detail_count
|
||||
from prc_zone z
|
||||
inner join bms_region r on r.region_id = z.region_id
|
||||
left join prc_zone_detail d on d.zone_id = z.zone_id
|
||||
<where>
|
||||
<if test="countryNameCn != null and countryNameCn != ''">
|
||||
AND r.country_name_cn like concat('%', #{countryNameCn}, '%')
|
||||
</if>
|
||||
<if test="countryCode2 != null and countryCode2 != ''">
|
||||
AND (r.country_code_2 = #{countryCode2} OR z.country_code = #{countryCode2})
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND r.status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
group by r.region_id, r.country_name_cn, r.country_name_en, r.country_code_2, r.status
|
||||
order by r.country_name_cn asc, r.region_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectZoneRegionById" parameterType="Long" resultMap="PrcZoneRegionResult">
|
||||
select r.region_id, r.country_name_cn, r.country_name_en, r.country_code_2, r.status,
|
||||
(select count(1) from prc_zone z where z.region_id = r.region_id) as zone_count,
|
||||
(select count(1) from prc_zone_detail d
|
||||
inner join prc_zone z on z.zone_id = d.zone_id
|
||||
where z.region_id = r.region_id) as detail_count
|
||||
from bms_region r
|
||||
where r.region_id = #{regionId}
|
||||
</select>
|
||||
|
||||
<select id="countByRegionId" parameterType="Long" resultType="int">
|
||||
select count(1) from prc_zone where region_id = #{regionId}
|
||||
</select>
|
||||
|
||||
<insert id="insertPrcZone" parameterType="PrcZone" useGeneratedKeys="true" keyProperty="zoneId">
|
||||
insert into prc_zone (
|
||||
<if test="regionId != null">region_id,</if>
|
||||
<if test="countryCode != null and countryCode != ''">country_code,</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">zone_code,</if>
|
||||
<if test="zoneName != null">zone_name,</if>
|
||||
<if test="zoneSort != null">zone_sort,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
create_time
|
||||
) values (
|
||||
<if test="regionId != null">#{regionId},</if>
|
||||
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">#{zoneCode},</if>
|
||||
<if test="zoneName != null">#{zoneName},</if>
|
||||
<if test="zoneSort != null">#{zoneSort},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updatePrcZone" parameterType="PrcZone">
|
||||
update prc_zone
|
||||
<set>
|
||||
<if test="regionId != null">region_id = #{regionId},</if>
|
||||
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
|
||||
<if test="zoneCode != null and zoneCode != ''">zone_code = #{zoneCode},</if>
|
||||
<if test="zoneName != null">zone_name = #{zoneName},</if>
|
||||
<if test="zoneSort != null">zone_sort = #{zoneSort},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where zone_id = #{zoneId}
|
||||
</update>
|
||||
|
||||
<delete id="deletePrcZoneByIds" parameterType="Long">
|
||||
delete from prc_zone where zone_id in
|
||||
<foreach item="zoneId" collection="array" open="(" separator="," close=")">
|
||||
#{zoneId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcZoneByRegionId" parameterType="Long">
|
||||
delete from prc_zone where region_id = #{regionId}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePrcZoneByRegionIds" parameterType="Long">
|
||||
delete from prc_zone where region_id in
|
||||
<foreach item="regionId" collection="array" open="(" separator="," close=")">
|
||||
#{regionId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user