应付账单初始化

This commit is contained in:
caojia
2026-11-04 16:04:38 +08:00
committed by liuminghui
parent 04be15deab
commit 51a89b18e1
90 changed files with 15661 additions and 6 deletions
@@ -0,0 +1,140 @@
<?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.PayPostcodeMapper">
<select id="selectGroupList" parameterType="com.bms.price.domain.PayPostcodeGroup" resultType="com.bms.price.domain.PayPostcodeGroup">
select group_id as groupId, source_file as sourceFile, file_md5 as fileMd5, sheet_name as sheetName,
block_title as blockTitle, config_kind as configKind, coverage, channel_name as channelName,
country_name as countryName, country_code as countryCode,
service_type as serviceType, catalog_country as catalogCountry, product_name as productName, quote_sheet as quoteSheet,
fee_name as feeName, fee_text as feeText, line_count as lineCount, create_by as createBy, create_time as createTime, remark
from pay_postcode_group
<where>
<if test="sourceFile != null and sourceFile != ''">and source_file like concat('%', #{sourceFile}, '%')</if>
<if test="sheetName != null and sheetName != ''">and sheet_name like concat('%', #{sheetName}, '%')</if>
<if test="countryName != null and countryName != ''">and (country_name like concat('%', #{countryName}, '%') or country_code like concat('%', #{countryName}, '%') or catalog_country like concat('%', #{countryName}, '%'))</if>
<if test="serviceType != null and serviceType != ''">and service_type like concat('%', #{serviceType}, '%')</if>
<if test="productName != null and productName != ''">and product_name like concat('%', #{productName}, '%')</if>
<if test="quoteSheet != null and quoteSheet != ''">and quote_sheet like concat('%', #{quoteSheet}, '%')</if>
<if test="configKind != null and configKind != ''">and config_kind = #{configKind}</if>
<if test="coverage != null and coverage != ''">and coverage = #{coverage}</if>
<if test="channelName != null and channelName != ''">and channel_name like concat('%', #{channelName}, '%')</if>
<if test="feeName != null and feeName != ''">and fee_name like concat('%', #{feeName}, '%')</if>
<if test="postcode != null and postcode != ''">
and exists (
select 1 from pay_postcode_line l
where l.group_id = pay_postcode_group.group_id and l.postcode like concat('%', #{postcode}, '%')
)
</if>
</where>
order by group_id desc
</select>
<select id="selectLineList" parameterType="com.bms.price.domain.PayPostcodeLine" resultType="com.bms.price.domain.PayPostcodeLine">
select line_id as lineId, group_id as groupId, country_name as countryName, country_code as countryCode,
region_name as regionName, region_name_cn as regionNameCn, city_name as cityName, region_code as regionCode,
zone_name as zoneName, postcode, postcode_raw as postcodeRaw, postcode_end as postcodeEnd,
extra_text as extraText, sort_no as sortNo
from pay_postcode_line
<where>
<if test="groupId != null">and group_id = #{groupId}</if>
<if test="postcode != null and postcode != ''">and postcode like concat('%', #{postcode}, '%')</if>
<if test="regionName != null and regionName != ''">and (region_name like concat('%', #{regionName}, '%') or region_name_cn like concat('%', #{regionName}, '%') or zone_name like concat('%', #{regionName}, '%'))</if>
</where>
order by sort_no asc, line_id asc
</select>
<insert id="insertGroup" parameterType="com.bms.price.domain.PayPostcodeGroup" useGeneratedKeys="true" keyProperty="groupId">
insert into pay_postcode_group (
source_file, file_md5, sheet_name, block_title, config_kind, coverage, channel_name, country_name, country_code,
service_type, catalog_country, product_name, quote_sheet,
fee_name, fee_text, line_count, create_by, create_time, remark
) values (
#{sourceFile}, #{fileMd5}, #{sheetName}, #{blockTitle}, #{configKind}, #{coverage}, #{channelName}, #{countryName}, #{countryCode},
#{serviceType}, #{catalogCountry}, #{productName}, #{quoteSheet},
#{feeName}, #{feeText}, #{lineCount}, #{createBy}, sysdate(), #{remark}
)
</insert>
<insert id="insertLines">
insert into pay_postcode_line (
group_id, country_name, country_code, region_name, region_name_cn, city_name, region_code,
zone_name, postcode, postcode_raw, postcode_end, extra_text, sort_no
) values
<foreach collection="list" item="item" separator=",">
(#{item.groupId}, #{item.countryName}, #{item.countryCode}, #{item.regionName}, #{item.regionNameCn},
#{item.cityName}, #{item.regionCode}, #{item.zoneName}, #{item.postcode}, #{item.postcodeRaw},
#{item.postcodeEnd}, #{item.extraText}, #{item.sortNo})
</foreach>
</insert>
<select id="selectGroupById" resultType="com.bms.price.domain.PayPostcodeGroup">
select group_id as groupId, source_file as sourceFile, file_md5 as fileMd5, sheet_name as sheetName,
block_title as blockTitle, config_kind as configKind, coverage, channel_name as channelName,
country_name as countryName, country_code as countryCode,
service_type as serviceType, catalog_country as catalogCountry, product_name as productName, quote_sheet as quoteSheet,
fee_name as feeName, fee_text as feeText, line_count as lineCount, create_by as createBy, create_time as createTime, remark
from pay_postcode_group
where group_id = #{groupId}
</select>
<update id="updateGroup" parameterType="com.bms.price.domain.PayPostcodeGroup">
update pay_postcode_group
set coverage = #{coverage},
channel_name = #{channelName},
country_name = #{countryName},
country_code = #{countryCode},
service_type = #{serviceType},
catalog_country = #{catalogCountry},
product_name = #{productName},
quote_sheet = #{quoteSheet},
config_kind = #{configKind},
fee_name = #{feeName},
fee_text = #{feeText},
block_title = #{blockTitle},
remark = #{remark}
where group_id = #{groupId}
</update>
<select id="selectGroupIds" resultType="long">
select group_id from pay_postcode_group where file_md5 = #{fileMd5} and sheet_name = #{sheetName}
</select>
<select id="selectGroupsByTokens" resultType="com.bms.price.domain.PayPostcodeGroup">
select group_id as groupId, block_title as blockTitle, channel_name as channelName,
product_name as productName, quote_sheet as quoteSheet, sheet_name as sheetName,
config_kind as configKind, fee_name as feeName, country_name as countryName, country_code as countryCode
from pay_postcode_group
where
<foreach collection="tokens" item="token" separator=" or ">
lower(concat_ws(' ', ifnull(channel_name, ''), ifnull(block_title, ''), ifnull(product_name, ''),
ifnull(quote_sheet, ''), ifnull(sheet_name, ''))) like concat('%', #{token}, '%')
</foreach>
</select>
<select id="selectRegionKeys" resultType="com.bms.price.domain.PayPostcodeLine">
select group_id as groupId, region_name as regionName, zone_name as zoneName
from pay_postcode_line
where group_id in
<foreach collection="groupIds" item="id" open="(" separator="," close=")">#{id}</foreach>
group by group_id, region_name, zone_name
</select>
<select id="selectLinesByGroups" resultType="com.bms.price.domain.PayPostcodeLine">
select line_id as lineId, group_id as groupId, region_name as regionName, zone_name as zoneName,
postcode, postcode_end as postcodeEnd
from pay_postcode_line
where group_id in
<foreach collection="groupIds" item="id" open="(" separator="," close=")">#{id}</foreach>
</select>
<delete id="deleteLines">
delete from pay_postcode_line where group_id in
<foreach collection="groupIds" item="id" open="(" separator="," close=")">#{id}</foreach>
</delete>
<delete id="deleteGroups">
delete from pay_postcode_group where group_id in
<foreach collection="groupIds" item="id" open="(" separator="," close=")">#{id}</foreach>
</delete>
</mapper>