375 lines
22 KiB
XML
375 lines
22 KiB
XML
<?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.EmisTmsCostFeeSplitMapper">
|
|
|
|
<resultMap type="EmisTmsCostFeeSplit" id="EmisTmsCostFeeSplitResult">
|
|
|
|
<result property="id" column="id" />
|
|
<result property="costNo" column="cost_no" />
|
|
<result property="batchNo" column="batch_no" />
|
|
<result property="billCode" column="bill_code" />
|
|
<result property="mainBillCode" column="main_bill_code" />
|
|
<result property="sendPlace" column="send_place" />
|
|
<result property="destPlace" column="dest_place" />
|
|
<result property="billMonth" column="bill_month" />
|
|
<result property="tradeDate" column="trade_date" />
|
|
<result property="transSignNo" column="trans_sign_no" />
|
|
<result property="supplierCode" column="supplier_code" />
|
|
<result property="feeType" column="fee_type" />
|
|
<result property="splitType" column="split_type" />
|
|
<result property="splitValue" column="split_value" />
|
|
<result property="costFee" column="cost_fee" />
|
|
<result property="totalVolume" column="total_volume" />
|
|
<result property="billWeight" column="bill_weight" />
|
|
<result property="transWeight" column="trans_weight" />
|
|
<result property="transVolume" column="trans_volume" />
|
|
<result property="transCostFee" column="trans_cost_fee" />
|
|
<result property="currency" column="currency" />
|
|
<result property="currecyToCnyRate" column="currecy_to_cny_rate" />
|
|
<result property="cnyFee" column="cny_fee" />
|
|
<result property="feeItemId" column="fee_item_id" />
|
|
<result property="price" column="price" />
|
|
<result property="calcExpr" column="calc_expr" />
|
|
<result property="calcRemark" column="calc_remark" />
|
|
<result property="blManual" column="bl_manual" />
|
|
<result property="blVirtual" column="bl_virtual" />
|
|
<result property="blSub" column="bl_sub" />
|
|
|
|
<association property="supplierName" column="supplier_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSupplierNameByCode"/>
|
|
|
|
<association property="feeItem"
|
|
column="fee_item_id"
|
|
select="com.xdadan.erp.emis.mapper.EmisTmsCostFeeFeeitemMapper.selectEmisTmsCostFeeFeeitemById"
|
|
fetchType="lazy"
|
|
/>
|
|
|
|
<association property="costFeeDetail"
|
|
column="cost_no"
|
|
select="com.xdadan.erp.emis.mapper.EmisTmsCostFeeMapper.selectEmisTmsCostFeeByCostNo"
|
|
fetchType="lazy"
|
|
/>
|
|
|
|
<association property="waybillDetail"
|
|
column="bill_code"
|
|
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
|
|
fetchType="lazy"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectEmisTmsCostFeeSplitVo">
|
|
select id, cost_no, batch_no, bill_code, main_bill_code, send_place, dest_place, bill_month, trade_date, trans_sign_no, supplier_code, fee_type, split_type, split_value, cost_fee, total_volume, bill_weight, trans_weight, trans_volume, trans_cost_fee, currency, currecy_to_cny_rate, cny_fee, fee_item_id, price, calc_expr, calc_remark, bl_manual, bl_virtual, bl_sub, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_cost_fee_split
|
|
</sql>
|
|
|
|
|
|
<select id="selectEmisTmsCostFeeSplitList" parameterType="EmisTmsCostFeeSplit" resultMap="EmisTmsCostFeeSplitResult">
|
|
|
|
SELECT
|
|
a.id,
|
|
a.cost_no,
|
|
a.batch_no,
|
|
a.bill_code,
|
|
a.main_bill_code,
|
|
a.send_place,
|
|
a.dest_place,
|
|
a.bill_month,
|
|
a.trade_date,
|
|
a.trans_sign_no,
|
|
a.supplier_code,
|
|
a.fee_type,
|
|
a.split_type,
|
|
a.split_value,
|
|
a.cost_fee,
|
|
a.total_volume,
|
|
a.bill_weight,
|
|
a.trans_weight,
|
|
a.trans_volume,
|
|
a.trans_cost_fee,
|
|
a.currency,
|
|
a.currecy_to_cny_rate,
|
|
a.cny_fee,
|
|
a.fee_item_id,
|
|
a.price,
|
|
a.calc_expr,
|
|
a.calc_remark,
|
|
a.bl_manual,
|
|
a.bl_virtual,
|
|
a.bl_sub,
|
|
a.remark,
|
|
a.del_flag,
|
|
a.create_by,
|
|
a.create_time,
|
|
a.update_by,
|
|
a.update_time,
|
|
a.create_site,
|
|
a.update_site
|
|
FROM
|
|
emis_tms_cost_fee_split a,
|
|
emis_waybill b
|
|
<where>
|
|
a.del_flag='0' and b.del_flag='0' and a.bill_code=b.bill_code
|
|
<if test="id != null "> and a.id = #{id}</if>
|
|
<if test="costNo != null and costNo != ''"> and a.cost_no=#{costNo}</if>
|
|
<if test="batchNo != null and batchNo != ''"> and a.batch_no=#{batchNo}</if>
|
|
<if test="feeItemId != null "> and a.fee_item_id = #{feeItemId}</if>
|
|
<if test="billCode != null and billCode != ''">
|
|
and ( FIND_IN_SET(a.bill_code,#{billCode}) or a.bill_code like concat('%', #{billCode}, '%') )
|
|
</if>
|
|
<if test="mainBillCode != null and mainBillCode != ''">
|
|
and ( FIND_IN_SET(a.main_bill_code,#{mainBillCode}) or a.main_bill_code like concat('%', #{mainBillCode}, '%') )
|
|
</if>
|
|
<if test="sendPlace != null and sendPlace != ''"> and a.send_place=#{sendPlace}</if>
|
|
<if test="destPlace != null and destPlace != ''"> and a.dest_place=#{destPlace}</if>
|
|
<if test="billMonth != null and billMonth != ''"> and a.bill_month=#{billMonth}</if>
|
|
<if test="tradeDate != null "> and a.trade_date = #{tradeDate}</if>
|
|
<if test="transSignNo != null and transSignNo != ''"> and a.trans_sign_no=#{transSignNo}</if>
|
|
<if test="supplierCode != null and supplierCode != ''"> and a.supplier_code=#{supplierCode}</if>
|
|
<if test="feeType != null and feeType != ''"> and a.fee_type=#{feeType}</if>
|
|
<if test="splitType != null and splitType != ''"> and a.split_type=#{splitType}</if>
|
|
<if test="splitValue != null "> and a.split_value = #{splitValue}</if>
|
|
<if test="costFee != null "> and a.cost_fee = #{costFee}</if>
|
|
<if test="totalVolume != null "> and a.total_volume = #{totalVolume}</if>
|
|
<if test="billWeight != null "> and a.bill_weight = #{billWeight}</if>
|
|
<if test="transWeight != null "> and a.trans_weight = #{transWeight}</if>
|
|
<if test="transVolume != null "> and a.trans_volume = #{transVolume}</if>
|
|
<if test="transCostFee != null "> and a.trans_cost_fee = #{transCostFee}</if>
|
|
<if test="currency != null and currency != ''"> and a.currency=#{currency}</if>
|
|
<if test="currecyToCnyRate != null "> and a.currecy_to_cny_rate = #{currecyToCnyRate}</if>
|
|
<if test="cnyFee != null "> and a.cny_fee = #{cnyFee}</if>
|
|
<if test="feeItemId != null "> and a.fee_item_id = #{feeItemId}</if>
|
|
<if test="price != null "> and a.price = #{price}</if>
|
|
<if test="calcExpr != null and calcExpr != ''"> and a.calc_expr like concat('%', #{calcExpr}, '%')</if>
|
|
<if test="calcRemark != null and calcRemark != ''"> and a.calc_remark like concat('%', #{calcRemark}, '%')</if>
|
|
<if test="blManual != null and blManual != ''"> and a.bl_manual=#{blManual}</if>
|
|
<if test="blVirtual != null and blVirtual != ''"> and a.bl_virtual=#{blVirtual}</if>
|
|
<if test="blSub != null and blSub != ''"> and a.bl_sub=#{blSub}</if>
|
|
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
|
|
|
|
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
|
and b.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
|
</if>
|
|
<if test="params.endSendDate != null and params.endSendDate != ''">
|
|
and b.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
|
</if>
|
|
|
|
</where>
|
|
<if test="params.blTradeTimeAsc != null and params.blTradeTimeAsc==1 ">
|
|
order by bill_code asc,trade_date asc
|
|
</if>
|
|
<if test="params.blTradeTimeAsc==null or (params.blTradeTimeAsc != null and params.blTradeTimeAsc!=1) ">
|
|
order by create_time desc
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisTmsCostFeeSplit" resultType="int">
|
|
select count(1) from emis_tms_cost_fee_split
|
|
where del_flag='0'
|
|
and id = #{id}
|
|
and cost_no = #{costNo}
|
|
and fee_item_id = #{feeItemId}
|
|
and bill_code = #{billCode}
|
|
and fee_type = #{feeType}
|
|
and split_type = #{splitType}
|
|
and cost_fee = #{costFee}
|
|
and total_volume = #{totalVolume}
|
|
and bill_weight = #{billWeight}
|
|
and calc_remark = #{calcRemark}
|
|
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="selectListByBillCode" parameterType="String" resultMap="EmisTmsCostFeeSplitResult">
|
|
select id, cost_no, batch_no, bill_code, main_bill_code, send_place, dest_place, bill_month, trade_date, trans_sign_no, supplier_code, fee_type, split_type, split_value, cost_fee, total_volume, bill_weight, trans_weight, trans_volume, trans_cost_fee, currency, currecy_to_cny_rate, cny_fee, fee_item_id, price, calc_expr, calc_remark, bl_manual, bl_virtual, bl_sub, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_tms_cost_fee_split a
|
|
where a.del_flag='0'
|
|
and a.main_bill_code = #{billCode}
|
|
order by bill_code asc,trade_date asc
|
|
</select>
|
|
|
|
<select id="selectListByCostNo" parameterType="String" resultMap="EmisTmsCostFeeSplitResult">
|
|
select id, cost_no, batch_no, bill_code, main_bill_code, send_place, dest_place, bill_month, trade_date, trans_sign_no, supplier_code, fee_type, split_type, split_value, cost_fee, total_volume, bill_weight, trans_weight, trans_volume, trans_cost_fee, currency, currecy_to_cny_rate, cny_fee, fee_item_id, price, calc_expr, calc_remark, bl_manual, bl_virtual, bl_sub, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_tms_cost_fee_split a
|
|
where a.del_flag='0' and a.cost_no = #{costNo}
|
|
</select>
|
|
|
|
<select id="selectEmisTmsCostFeeSplitById" parameterType="Long" resultMap="EmisTmsCostFeeSplitResult">
|
|
select id, cost_no, batch_no, bill_code, main_bill_code, send_place, dest_place, bill_month, trade_date, trans_sign_no, supplier_code, fee_type, split_type, split_value, cost_fee, total_volume, bill_weight, trans_weight, trans_volume, trans_cost_fee, currency, currecy_to_cny_rate, cny_fee, fee_item_id, price, calc_expr, calc_remark, bl_manual, bl_virtual, bl_sub, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_tms_cost_fee_split a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmisTmsCostFeeSplit" parameterType="EmisTmsCostFeeSplit" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_tms_cost_fee_split
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="costNo != null and costNo != ''">cost_no,</if>
|
|
<if test="batchNo != null and batchNo != ''">batch_no,</if>
|
|
<if test="billCode != null and billCode != ''">bill_code,</if>
|
|
<if test="mainBillCode != null and mainBillCode != ''">main_bill_code,</if>
|
|
<if test="sendPlace != null and sendPlace != ''">send_place,</if>
|
|
<if test="destPlace != null and destPlace != ''">dest_place,</if>
|
|
<if test="billMonth != null and billMonth != ''">bill_month,</if>
|
|
<if test="tradeDate != null">trade_date,</if>
|
|
<if test="transSignNo != null and transSignNo != ''">trans_sign_no,</if>
|
|
<if test="supplierCode != null and supplierCode != ''">supplier_code,</if>
|
|
<if test="feeType != null and feeType != ''">fee_type,</if>
|
|
<if test="splitType != null and splitType != ''">split_type,</if>
|
|
<if test="splitValue != null">split_value,</if>
|
|
<if test="costFee != null">cost_fee,</if>
|
|
<if test="totalVolume != null">total_volume,</if>
|
|
<if test="billWeight != null">bill_weight,</if>
|
|
<if test="transWeight != null">trans_weight,</if>
|
|
<if test="transVolume != null">trans_volume,</if>
|
|
<if test="transCostFee != null">trans_cost_fee,</if>
|
|
<if test="currency != null and currency != ''">currency,</if>
|
|
<if test="currecyToCnyRate != null">currecy_to_cny_rate,</if>
|
|
<if test="cnyFee != null">cny_fee,</if>
|
|
<if test="feeItemId != null">fee_item_id,</if>
|
|
<if test="price != null">price,</if>
|
|
<if test="calcExpr != null and calcExpr != ''">calc_expr,</if>
|
|
<if test="calcRemark != null and calcRemark != ''">calc_remark,</if>
|
|
<if test="blManual != null and blManual != ''">bl_manual,</if>
|
|
<if test="blVirtual != null and blVirtual != ''">bl_virtual,</if>
|
|
<if test="blSub != null and blSub != ''">bl_sub,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="costNo != null and costNo != ''">#{costNo},</if>
|
|
<if test="batchNo != null and batchNo != ''">#{batchNo},</if>
|
|
<if test="billCode != null and billCode != ''">#{billCode},</if>
|
|
<if test="mainBillCode != null and mainBillCode != ''">#{mainBillCode},</if>
|
|
<if test="sendPlace != null and sendPlace != ''">#{sendPlace},</if>
|
|
<if test="destPlace != null and destPlace != ''">#{destPlace},</if>
|
|
<if test="billMonth != null and billMonth != ''">#{billMonth},</if>
|
|
<if test="tradeDate != null">#{tradeDate},</if>
|
|
<if test="transSignNo != null and transSignNo != ''">#{transSignNo},</if>
|
|
<if test="supplierCode != null and supplierCode != ''">#{supplierCode},</if>
|
|
<if test="feeType != null and feeType != ''">#{feeType},</if>
|
|
<if test="splitType != null and splitType != ''">#{splitType},</if>
|
|
<if test="splitValue != null">#{splitValue},</if>
|
|
<if test="costFee != null">#{costFee},</if>
|
|
<if test="totalVolume != null">#{totalVolume},</if>
|
|
<if test="billWeight != null">#{billWeight},</if>
|
|
<if test="transWeight != null">#{transWeight},</if>
|
|
<if test="transVolume != null">#{transVolume},</if>
|
|
<if test="transCostFee != null">#{transCostFee},</if>
|
|
<if test="currency != null and currency != ''">#{currency},</if>
|
|
<if test="currecyToCnyRate != null">#{currecyToCnyRate},</if>
|
|
<if test="cnyFee != null">#{cnyFee},</if>
|
|
<if test="feeItemId != null">#{feeItemId},</if>
|
|
<if test="price != null">#{price},</if>
|
|
<if test="calcExpr != null and calcExpr != ''">#{calcExpr},</if>
|
|
<if test="calcRemark != null and calcRemark != ''">#{calcRemark},</if>
|
|
<if test="blManual != null and blManual != ''">#{blManual},</if>
|
|
<if test="blVirtual != null and blVirtual != ''">#{blVirtual},</if>
|
|
<if test="blSub != null and blSub != ''">#{blSub},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisTmsCostFeeSplit" parameterType="EmisTmsCostFeeSplit">
|
|
update emis_tms_cost_fee_split
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="costNo != null and costNo != ''">cost_no = #{costNo},</if>
|
|
<if test="batchNo != null and batchNo != ''">batch_no = #{batchNo},</if>
|
|
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
|
|
<if test="mainBillCode != null and mainBillCode != ''">main_bill_code = #{mainBillCode},</if>
|
|
<if test="sendPlace != null and sendPlace != ''">send_place = #{sendPlace},</if>
|
|
<if test="destPlace != null and destPlace != ''">dest_place = #{destPlace},</if>
|
|
<if test="billMonth != null and billMonth != ''">bill_month = #{billMonth},</if>
|
|
<if test="tradeDate != null">trade_date = #{tradeDate},</if>
|
|
<if test="transSignNo != null and transSignNo != ''">trans_sign_no = #{transSignNo},</if>
|
|
<if test="supplierCode != null and supplierCode != ''">supplier_code = #{supplierCode},</if>
|
|
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
|
|
<if test="splitType != null and splitType != ''">split_type = #{splitType},</if>
|
|
<if test="splitValue != null">split_value = #{splitValue},</if>
|
|
<if test="costFee != null">cost_fee = #{costFee},</if>
|
|
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
|
|
<if test="billWeight != null">bill_weight = #{billWeight},</if>
|
|
<if test="transWeight != null">trans_weight = #{transWeight},</if>
|
|
<if test="transVolume != null">trans_volume = #{transVolume},</if>
|
|
<if test="transCostFee != null">trans_cost_fee = #{transCostFee},</if>
|
|
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
|
<if test="currecyToCnyRate != null">currecy_to_cny_rate = #{currecyToCnyRate},</if>
|
|
<if test="cnyFee != null">cny_fee = #{cnyFee},</if>
|
|
<if test="feeItemId != null">fee_item_id = #{feeItemId},</if>
|
|
<if test="price != null">price = #{price},</if>
|
|
<if test="calcExpr != null and calcExpr != ''">calc_expr = #{calcExpr},</if>
|
|
<if test="calcRemark != null and calcRemark != ''">calc_remark = #{calcRemark},</if>
|
|
<if test="blManual != null and blManual != ''">bl_manual = #{blManual},</if>
|
|
<if test="blVirtual != null and blVirtual != ''">bl_virtual = #{blVirtual},</if>
|
|
<if test="blSub != null and blSub != ''">bl_sub = #{blSub},</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>
|
|
|
|
<select id="getCostFeeByMainBillCode" parameterType="String" resultType="double">
|
|
select IFNULL(sum(cost_fee),0) as costFee
|
|
from emis_tms_cost_fee_split a
|
|
where del_flag='0' and a.main_bill_code = #{mainBillCode}
|
|
</select>
|
|
|
|
<delete id="deleteEmisTmsCostFeeSplitByBillCode" parameterType="String">
|
|
update emis_tms_cost_fee_split set del_flag='1' where del_flag='0' and bill_code = #{billCode}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsCostFeeSplitByCostNo" parameterType="String">
|
|
update emis_tms_cost_fee_split set del_flag='1' where del_flag='0' and cost_no = #{costNo}
|
|
</delete>
|
|
|
|
<delete id="deleteByBillCodeAndFeeType" >
|
|
update emis_tms_cost_fee_split set del_flag='1'
|
|
where del_flag='0'
|
|
and bill_code = #{billCode}
|
|
and fee_type = #{feeType}
|
|
</delete>
|
|
|
|
<delete id="deleteByCostNoAndBillCode" >
|
|
update emis_tms_cost_fee_split set del_flag='1'
|
|
where del_flag='0'
|
|
and cost_no = #{costNo}
|
|
and bill_code = #{billCode}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsCostFeeSplitById" parameterType="Long">
|
|
update emis_tms_cost_fee_split set del_flag='1' where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisTmsCostFeeSplitByIds" parameterType="String">
|
|
update emis_tms_cost_fee_split set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |