2024-10-10 02:18:56 +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.EmisTmsCostProfitMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="EmisTmsCostProfit" id="EmisTmsCostProfitResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="billCode" column="bill_code" />
|
2025-06-30 08:32:49 +00:00
|
|
|
<result property="billMonth" column="bill_month" />
|
2024-10-10 02:18:56 +00:00
|
|
|
<result property="standardFee" column="standard_fee" />
|
|
|
|
|
<result property="billFee" column="bill_fee" />
|
|
|
|
|
<result property="costFee" column="cost_fee" />
|
|
|
|
|
<result property="billProfit" column="bill_profit" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2024-10-13 12:32:26 +00:00
|
|
|
<resultMap id="EmisTmsCostProfitWithSubBillResult" type="EmisTmsCostProfit" extends="EmisTmsCostProfitResult" >
|
|
|
|
|
<association property="waybillDetail"
|
|
|
|
|
column="bill_code"
|
|
|
|
|
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
|
|
|
|
|
fetchType="lazy"
|
|
|
|
|
/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2024-10-10 02:18:56 +00:00
|
|
|
<sql id="selectEmisTmsCostProfitVo">
|
2025-06-30 08:32:49 +00:00
|
|
|
select id, bill_code,bill_month, standard_fee, bill_fee, cost_fee, bill_profit,
|
2025-02-23 12:05:08 +00:00
|
|
|
remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
|
|
|
|
|
|
|
|
from emis_tms_cost_profit
|
2024-10-10 02:18:56 +00:00
|
|
|
</sql>
|
|
|
|
|
|
2025-02-23 09:17:09 +00:00
|
|
|
<select id="selectEmisTmsCostProfitList" parameterType="EmisTmsCostProfit" resultMap="EmisTmsCostProfitWithSubBillResult">
|
2025-02-23 10:55:42 +00:00
|
|
|
select
|
2025-06-30 09:05:35 +00:00
|
|
|
b.id, b.bill_code,b.bill_month, b.standard_fee, b.bill_fee, b.cost_fee, b.bill_profit,
|
2025-02-23 12:05:08 +00:00
|
|
|
b.remark, b.del_flag, b.create_by, b.create_time, b.update_by, b.update_time, b.create_site, b.update_site
|
|
|
|
|
from emis_tms_cost_profit b,emis_waybill a
|
2025-02-23 10:55:42 +00:00
|
|
|
<where>
|
|
|
|
|
a.bill_code=b.bill_code and a.del_flag='0' and b.del_flag='0'
|
2025-02-23 11:52:38 +00:00
|
|
|
<if test="id != null "> and b.id = #{id}</if>
|
2025-02-23 10:55:42 +00:00
|
|
|
<if test="billCode != null and billCode != ''"> and FIND_IN_SET(b.`bill_code`,#{billCode})</if>
|
2025-02-23 11:52:38 +00:00
|
|
|
<if test="standardFee != null "> and b.standard_fee = #{standardFee}</if>
|
|
|
|
|
<if test="billFee != null "> and b.bill_fee = #{billFee}</if>
|
|
|
|
|
<if test="costFee != null "> and b.cost_fee = #{costFee}</if>
|
|
|
|
|
<if test="billProfit != null "> and b.bill_profit = #{billProfit}</if>
|
|
|
|
|
<if test="remark != null and remark != ''"> and b.remark like concat('%', #{remark}, '%')</if>
|
|
|
|
|
<if test="delFlag != null and delFlag != ''"> and b.del_flag like concat('%', #{delFlag}, '%')</if>
|
|
|
|
|
<if test="createBy != null and createBy != ''"> and b.create_by like concat('%', #{createBy}, '%')</if>
|
|
|
|
|
<if test="createTime != null "> and b.create_time = #{createTime}</if>
|
|
|
|
|
<if test="updateBy != null and updateBy != ''"> and b.update_by like concat('%', #{updateBy}, '%')</if>
|
|
|
|
|
<if test="updateTime != null "> and b.update_time = #{updateTime}</if>
|
|
|
|
|
<if test="createSite != null and createSite != ''"> and b.create_site like concat('%', #{createSite}, '%')</if>
|
|
|
|
|
<if test="updateSite != null and updateSite != ''"> and b.update_site like concat('%', #{updateSite}, '%')</if>
|
2025-02-23 10:55:42 +00:00
|
|
|
|
|
|
|
|
<if test="params.sendSiteCode != null and params.sendSiteCode != ''">
|
|
|
|
|
and a.send_site_code = #{params.sendSiteCode}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.dispatchUnderlingSiteCode != null and params.dispatchUnderlingSiteCode != ''">
|
|
|
|
|
and a.dispatch_underling_site_code = #{params.dispatchUnderlingSiteCode}
|
|
|
|
|
</if>
|
|
|
|
|
|
2025-02-23 11:01:31 +00:00
|
|
|
<if test="params.custNo != null and params.custNo != ''">
|
|
|
|
|
and a.cust_no=#{params.custNo}
|
|
|
|
|
</if>
|
2025-02-23 10:55:42 +00:00
|
|
|
|
|
|
|
|
<if test="params.receiveCompany != null and params.receiveCompany != ''">
|
|
|
|
|
and a.receive_company like concat('%', #{params.receiveCompany}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<if test="params.sendCompany != null and params.sendCompany != ''">
|
|
|
|
|
and a.send_company like concat('%', #{params.sendCompany}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.transLineType != null and params.transLineType != ''">
|
|
|
|
|
and a.trans_line_type = #{params.transLineType}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.productType != null and params.productType != ''">
|
|
|
|
|
and a.product_type = #{params.productType}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.payee != null and params.payee != ''">
|
|
|
|
|
and a.payee = #{params.payee}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.salesmen != null and params.salesmen != ''">
|
|
|
|
|
and a.salesmen = #{params.salesmen}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.paymentType != null and params.paymentType != ''">
|
|
|
|
|
and a.payment_type = #{params.paymentType}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.blSpecialQuote != null and params.blSpecialQuote != ''">
|
|
|
|
|
and a.bl_special_quote = #{params.blSpecialQuote}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.calcFeeType != null and params.calcFeeType != ''">
|
|
|
|
|
and a.calc_fee_type = #{params.calcFeeType}
|
|
|
|
|
</if>
|
|
|
|
|
|
2025-07-01 23:09:20 +00:00
|
|
|
<!-- 组批次完整: blIsBatchOk=1 blIsBatchOk=-1 不完整 -->
|
|
|
|
|
<if test="params.blIsBatchOk != null and params.blIsBatchOk == 1 ">
|
|
|
|
|
and exists (
|
|
|
|
|
select 1 from emis_waybill_batch_status ewbs where a.bill_code=ewbs.bill_code
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.blIsBatchOk != null and params.blIsBatchOk == -1 ">
|
|
|
|
|
and not exists (
|
|
|
|
|
select 1 from emis_waybill_batch_status ewbs where a.bill_code=ewbs.bill_code
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<!-- 费用是否录入完整: blIsCostFeeOk=1 blIsCostFeeOk=-1 不完整 -->
|
|
|
|
|
<if test="params.blIsCostFeeOk != null and params.blIsCostFeeOk == 1 ">
|
|
|
|
|
and exists (
|
|
|
|
|
select 1 from emis_waybill_batch_status ewbs where a.bill_code=ewbs.bill_code
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.blIsCostFeeOk != null and params.blIsCostFeeOk == -1 ">
|
|
|
|
|
and not exists (
|
|
|
|
|
select 1 from emis_waybill_batch_status ewbs where a.bill_code=ewbs.bill_code
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
2025-02-23 10:55:42 +00:00
|
|
|
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
|
|
|
|
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.endSendDate != null and params.endSendDate != ''">
|
|
|
|
|
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
|
|
|
|
</if>
|
2024-10-10 02:18:56 +00:00
|
|
|
</where>
|
2025-02-23 10:55:42 +00:00
|
|
|
order by b.create_time desc
|
2024-10-10 02:18:56 +00:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="checkUnique" parameterType="EmisTmsCostProfit" resultType="int">
|
|
|
|
|
select count(1) from emis_tms_cost_profit
|
|
|
|
|
where del_flag='0'
|
|
|
|
|
and id = #{id}
|
|
|
|
|
and bill_code = #{billCode}
|
|
|
|
|
and standard_fee = #{standardFee}
|
|
|
|
|
and bill_fee = #{billFee}
|
|
|
|
|
and cost_fee = #{costFee}
|
|
|
|
|
and bill_profit = #{billProfit}
|
|
|
|
|
and remark = #{remark}
|
|
|
|
|
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="selectEmisTmsCostProfitById" parameterType="Long" resultMap="EmisTmsCostProfitResult">
|
2025-06-30 08:32:49 +00:00
|
|
|
select id, bill_code,bill_month, standard_fee, bill_fee, cost_fee, bill_profit, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
2024-10-10 02:18:56 +00:00
|
|
|
from emis_tms_cost_profit a
|
|
|
|
|
where a.id = #{id}
|
|
|
|
|
</select>
|
2024-10-13 12:32:26 +00:00
|
|
|
|
|
|
|
|
<select id="selectEmisTmsCostProfitByBillCode" parameterType="String" resultMap="EmisTmsCostProfitWithSubBillResult">
|
2025-06-30 08:32:49 +00:00
|
|
|
select id, bill_code,bill_month, standard_fee, bill_fee, cost_fee, bill_profit, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
2024-10-13 12:32:26 +00:00
|
|
|
from emis_tms_cost_profit a
|
|
|
|
|
where a.bill_code = #{billCode}
|
|
|
|
|
</select>
|
2025-06-30 08:32:49 +00:00
|
|
|
|
2024-10-10 02:18:56 +00:00
|
|
|
<insert id="insertEmisTmsCostProfit" parameterType="EmisTmsCostProfit" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into emis_tms_cost_profit
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
|
<if test="billCode != null and billCode != ''">bill_code,</if>
|
2025-06-30 08:32:49 +00:00
|
|
|
<if test="billMonth != null and billMonth != ''">bill_month,</if>
|
2024-10-10 02:18:56 +00:00
|
|
|
<if test="standardFee != null">standard_fee,</if>
|
|
|
|
|
<if test="billFee != null">bill_fee,</if>
|
|
|
|
|
<if test="costFee != null">cost_fee,</if>
|
|
|
|
|
<if test="billProfit != null">bill_profit,</if>
|
|
|
|
|
<if test="remark != null and remark != ''">remark,</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-06-30 08:32:49 +00:00
|
|
|
</trim>
|
2024-10-10 02:18:56 +00:00
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
|
<if test="billCode != null and billCode != ''">#{billCode},</if>
|
2025-06-30 08:32:49 +00:00
|
|
|
<if test="billMonth != null and billMonth != ''">#{billMonth},</if>
|
2024-10-10 02:18:56 +00:00
|
|
|
<if test="standardFee != null">#{standardFee},</if>
|
|
|
|
|
<if test="billFee != null">#{billFee},</if>
|
|
|
|
|
<if test="costFee != null">#{costFee},</if>
|
|
|
|
|
<if test="billProfit != null">#{billProfit},</if>
|
|
|
|
|
<if test="remark != null and remark != ''">#{remark},</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-06-30 08:32:49 +00:00
|
|
|
</trim>
|
2024-10-10 02:18:56 +00:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateEmisTmsCostProfit" parameterType="EmisTmsCostProfit">
|
|
|
|
|
update emis_tms_cost_profit
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
|
2025-06-30 08:32:49 +00:00
|
|
|
<if test="billMonth != null and billMonth != ''">bill_month = #{billMonth},</if>
|
2024-10-10 02:18:56 +00:00
|
|
|
<if test="standardFee != null">standard_fee = #{standardFee},</if>
|
|
|
|
|
<if test="billFee != null">bill_fee = #{billFee},</if>
|
|
|
|
|
<if test="costFee != null">cost_fee = #{costFee},</if>
|
|
|
|
|
<if test="billProfit != null">bill_profit = #{billProfit},</if>
|
|
|
|
|
<if test="remark != null and remark != ''">remark = #{remark},</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="deleteEmisTmsCostProfitById" parameterType="Long">
|
|
|
|
|
delete from emis_tms_cost_profit where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmisTmsCostProfitByIds" parameterType="String">
|
|
|
|
|
delete from emis_tms_cost_profit where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|