emis-service/emis-biz/src/main/resources/mapper/EmisTmsCostQuotePriceMapper.xml

281 lines
17 KiB
XML
Raw Normal View History

2025-06-29 06:37:32 +00:00
<?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.xdadan.erp.emis.mapper.EmisTmsCostQuotePriceMapper">
<resultMap type="EmisTmsCostQuotePrice" id="EmisTmsCostQuotePriceResult">
<result property="id" column="id" />
<result property="startSiteCode" column="start_site_code" />
<result property="nextSiteCode" column="next_site_code" />
<result property="distance" column="distance" />
<result property="feeType" column="fee_type" />
2025-07-01 23:09:20 +00:00
<result property="fee" column="fee" />
2025-07-01 23:27:16 +00:00
<result property="leastPrice" column="least_price" />
<result property="priceType" column="price_type" />
2025-06-29 06:37:32 +00:00
<result property="price" column="price" />
<result property="currency" column="currency" />
2025-07-01 23:09:20 +00:00
<result property="startWeight" column="start_weight" />
<result property="endWeight" column="end_weight" />
<result property="initialWeight" column="initial_weight" />
<result property="additionalWeight" column="additional_weight" />
<result property="conditionExpression" column="condition_expression" />
<result property="calculateExpression" column="calculate_expression" />
2025-06-29 06:37:32 +00:00
<result property="billType" column="bill_type" />
<result property="supplierCode" column="supplier_code" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
2025-07-01 23:09:20 +00:00
<result property="blOpen" column="bl_open" />
2025-07-07 06:48:16 +00:00
<result property="blIgnoreZt" column="bl_ignore_zt" />
2025-06-29 08:04:51 +00:00
2025-06-30 08:32:49 +00:00
<result property="batchNo" column="batch_no" />
2025-06-30 16:05:16 +00:00
<result property="carNo" column="car_no" />
2025-06-30 08:32:49 +00:00
<result property="etd" column="etd" />
<result property="transWeight" column="trans_weight" />
<result property="totalVolume" column="total_volume" />
<result property="totalWeight" column="total_weight" />
2025-06-29 08:04:51 +00:00
<association property="startSiteName" column="start_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="supplierName" column="supplier_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSupplierNameByCode"/>
2025-06-29 06:37:32 +00:00
</resultMap>
<sql id="selectEmisTmsCostQuotePriceVo">
2025-07-07 06:48:16 +00:00
select id, start_site_code, next_site_code, distance, fee_type, fee, least_price, price_type, price, currency, start_weight, end_weight, initial_weight, additional_weight, condition_expression, calculate_expression, bill_type, supplier_code, start_date, end_date, bl_open, bl_ignore_zt, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_cost_quote_price
2025-06-29 06:37:32 +00:00
</sql>
<select id="selectEmisTmsCostQuotePriceList" parameterType="EmisTmsCostQuotePrice" resultMap="EmisTmsCostQuotePriceResult">
<include refid="selectEmisTmsCostQuotePriceVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="startSiteCode != null and startSiteCode != ''"> and start_site_code = #{startSiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code = #{nextSiteCode}</if>
<if test="distance != null "> and distance = #{distance}</if>
<if test="feeType != null and feeType != ''"> and fee_type = #{feeType}</if>
<if test="price != null "> and price = #{price}</if>
<if test="currency != null and currency != ''"> and currency = #{currency}</if>
<if test="billType != null and billType != ''"> and bill_type = #{billType}</if>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code = #{supplierCode}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
2025-07-07 08:52:08 +00:00
<if test="blOpen != null and blOpen != ''"> and bl_open=#{blOpen}</if>
<if test="blIgnoreZt != null and blIgnoreZt != ''"> and bl_ignore_zt=#{blIgnoreZt}</if>
2025-06-29 06:37:32 +00:00
</where>
order by create_time desc
</select>
2025-06-30 08:32:49 +00:00
2025-07-02 03:07:36 +00:00
<select id="matchBatchFixedQuotePriceByBillCode" resultMap="EmisTmsCostQuotePriceResult">
2025-07-01 23:27:16 +00:00
SELECT
DISTINCT
a.start_site_code,
a.next_site_code,
a.distance,
a.least_price,
a.price_type,
a.fee,
a.price,
a.fee_type,
a.currency,
a.bill_type,
a.supplier_code,
a.start_date,
a.end_date,
a.calculate_expression,
2025-07-07 06:57:15 +00:00
a.bl_ignore_zt,
2025-07-01 23:27:16 +00:00
b.batch_no,
b.car_no,
b.etd,
b.trans_weight,
b.total_weight
FROM
emis_tms_cost_quote_price a,
emis_tms_site_batch b,
emis_tms_site_batch_dtl c
WHERE
a.del_flag = '0'
AND b.del_flag = '0'
AND c.del_flag = '0'
AND a.start_site_code = b.start_site_code
AND a.next_site_code = b.next_site_code
2025-07-02 03:14:22 +00:00
<if test="blNeedMatchSupplier != null and blNeedMatchSupplier == 1 ">
2025-07-02 02:58:38 +00:00
AND a.supplier_code = b.supplier_code
</if>
2025-07-01 23:27:16 +00:00
AND b.batch_no = c.batch_no
and a.start_date <![CDATA[ <= ]]> b.etd and b.etd <![CDATA[ < ]]> a.end_date
2025-07-02 02:58:38 +00:00
and a.fee_type = #{feeType}
2025-07-01 23:27:16 +00:00
AND c.bill_code = #{billCode}
2025-06-30 08:32:49 +00:00
</select>
2025-06-29 06:37:32 +00:00
<select id="checkUnique" parameterType="EmisTmsCostQuotePrice" resultType="int">
select count(1) from emis_tms_cost_quote_price
where del_flag='0'
and id = #{id}
and start_site_code = #{startSiteCode}
and next_site_code = #{nextSiteCode}
and distance = #{distance}
and fee_type = #{feeType}
2025-07-01 23:09:20 +00:00
and fee = #{fee}
2025-06-29 06:37:32 +00:00
and price = #{price}
and currency = #{currency}
2025-07-01 23:09:20 +00:00
and start_weight = #{startWeight}
and end_weight = #{endWeight}
and initial_weight = #{initialWeight}
and additional_weight = #{additionalWeight}
and condition_expression = #{conditionExpression}
and calculate_expression = #{calculateExpression}
2025-06-29 06:37:32 +00:00
and bill_type = #{billType}
and supplier_code = #{supplierCode}
and start_date = #{startDate}
and end_date = #{endDate}
2025-07-01 23:09:20 +00:00
and bl_open = #{blOpen}
2025-06-29 06:37:32 +00:00
and remark = #{remark}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisTmsCostQuotePriceById" parameterType="Long" resultMap="EmisTmsCostQuotePriceResult">
2025-07-07 06:48:16 +00:00
select id, start_site_code, next_site_code, distance, fee_type, fee, least_price, price_type, price, currency, start_weight, end_weight, initial_weight, additional_weight, condition_expression, calculate_expression, bill_type, supplier_code, start_date, end_date, bl_open, bl_ignore_zt, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2025-06-29 06:37:32 +00:00
from emis_tms_cost_quote_price a
where a.id = #{id}
</select>
2025-07-01 23:09:20 +00:00
2025-06-29 06:37:32 +00:00
<insert id="insertEmisTmsCostQuotePrice" parameterType="EmisTmsCostQuotePrice" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_cost_quote_price
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code,</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code,</if>
<if test="distance != null">distance,</if>
<if test="feeType != null and feeType != ''">fee_type,</if>
2025-07-01 23:09:20 +00:00
<if test="fee != null">fee,</if>
2025-07-01 23:27:16 +00:00
<if test="leastPrice != null">least_price,</if>
<if test="priceType != null and priceType != ''">price_type,</if>
2025-06-29 06:37:32 +00:00
<if test="price != null">price,</if>
<if test="currency != null and currency != ''">currency,</if>
2025-07-01 23:09:20 +00:00
<if test="startWeight != null">start_weight,</if>
<if test="endWeight != null">end_weight,</if>
<if test="initialWeight != null">initial_weight,</if>
<if test="additionalWeight != null">additional_weight,</if>
<if test="conditionExpression != null and conditionExpression != ''">condition_expression,</if>
<if test="calculateExpression != null and calculateExpression != ''">calculate_expression,</if>
2025-06-29 06:37:32 +00:00
<if test="billType != null and billType != ''">bill_type,</if>
<if test="supplierCode != null and supplierCode != ''">supplier_code,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
2025-07-01 23:09:20 +00:00
<if test="blOpen != null and blOpen != ''">bl_open,</if>
2025-07-07 06:48:16 +00:00
<if test="blIgnoreZt != null and blIgnoreZt != ''">bl_ignore_zt,</if>
2025-06-29 06:37:32 +00:00
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
2025-07-01 23:09:20 +00:00
</trim>
2025-06-29 06:37:32 +00:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="startSiteCode != null and startSiteCode != ''">#{startSiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">#{nextSiteCode},</if>
<if test="distance != null">#{distance},</if>
<if test="feeType != null and feeType != ''">#{feeType},</if>
2025-07-01 23:09:20 +00:00
<if test="fee != null">#{fee},</if>
2025-07-01 23:27:16 +00:00
<if test="leastPrice != null">#{leastPrice},</if>
<if test="priceType != null and priceType != ''">#{priceType},</if>
2025-06-29 06:37:32 +00:00
<if test="price != null">#{price},</if>
<if test="currency != null and currency != ''">#{currency},</if>
2025-07-01 23:09:20 +00:00
<if test="startWeight != null">#{startWeight},</if>
<if test="endWeight != null">#{endWeight},</if>
<if test="initialWeight != null">#{initialWeight},</if>
<if test="additionalWeight != null">#{additionalWeight},</if>
<if test="conditionExpression != null and conditionExpression != ''">#{conditionExpression},</if>
<if test="calculateExpression != null and calculateExpression != ''">#{calculateExpression},</if>
2025-06-29 06:37:32 +00:00
<if test="billType != null and billType != ''">#{billType},</if>
<if test="supplierCode != null and supplierCode != ''">#{supplierCode},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
2025-07-01 23:09:20 +00:00
<if test="blOpen != null and blOpen != ''">#{blOpen},</if>
2025-07-07 06:48:16 +00:00
<if test="blIgnoreZt != null and blIgnoreZt != ''">#{blIgnoreZt},</if>
2025-06-29 06:37:32 +00:00
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
2025-07-01 23:09:20 +00:00
</trim>
2025-06-29 06:37:32 +00:00
</insert>
<update id="updateEmisTmsCostQuotePrice" parameterType="EmisTmsCostQuotePrice">
update emis_tms_cost_quote_price
<trim prefix="SET" suffixOverrides=",">
<if test="startSiteCode != null and startSiteCode != ''">start_site_code = #{startSiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="distance != null">distance = #{distance},</if>
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
2025-07-01 23:09:20 +00:00
<if test="fee != null">fee = #{fee},</if>
2025-07-01 23:27:16 +00:00
<if test="leastPrice != null">least_price = #{leastPrice},</if>
<if test="priceType != null and priceType != ''">price_type = #{priceType},</if>
2025-06-29 06:37:32 +00:00
<if test="price != null">price = #{price},</if>
<if test="currency != null and currency != ''">currency = #{currency},</if>
2025-07-01 23:09:20 +00:00
<if test="startWeight != null">start_weight = #{startWeight},</if>
<if test="endWeight != null">end_weight = #{endWeight},</if>
<if test="initialWeight != null">initial_weight = #{initialWeight},</if>
<if test="additionalWeight != null">additional_weight = #{additionalWeight},</if>
<if test="conditionExpression != null and conditionExpression != ''">condition_expression = #{conditionExpression},</if>
<if test="calculateExpression != null and calculateExpression != ''">calculate_expression = #{calculateExpression},</if>
2025-06-29 06:37:32 +00:00
<if test="billType != null and billType != ''">bill_type = #{billType},</if>
<if test="supplierCode != null and supplierCode != ''">supplier_code = #{supplierCode},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
2025-07-01 23:09:20 +00:00
<if test="blOpen != null and blOpen != ''">bl_open = #{blOpen},</if>
2025-07-07 06:48:16 +00:00
<if test="blIgnoreZt != null and blIgnoreZt != ''">bl_ignore_zt = #{blIgnoreZt},</if>
2025-06-29 06:37:32 +00:00
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisTmsCostQuotePriceById" parameterType="Long">
2025-07-01 23:09:20 +00:00
update emis_tms_cost_quote_price set del_flag='1' where id = #{id}
2025-06-29 06:37:32 +00:00
</delete>
<delete id="deleteEmisTmsCostQuotePriceByIds" parameterType="String">
2025-07-01 23:09:20 +00:00
update emis_tms_cost_quote_price set del_flag='1' where id in
2025-06-29 06:37:32 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>