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

195 lines
11 KiB
XML
Raw Normal View History

2025-02-17 11:45:02 +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.EmisTmsCostFeeSplitMapper">
<resultMap type="EmisTmsCostFeeSplit" id="EmisTmsCostFeeSplitResult">
<result property="id" column="id" />
<result property="costNo" column="cost_no" />
<result property="feeItemId" column="fee_item_id" />
<result property="billCode" column="bill_code" />
<result property="feeType" column="fee_type" />
<result property="splitType" column="split_type" />
<result property="costFee" column="cost_fee" />
<result property="totalVolume" column="total_volume" />
<result property="billWeight" column="bill_weight" />
<result property="calcRemark" column="calc_remark" />
2025-02-23 11:26:05 +00:00
<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"
/>
2025-02-17 11:45:02 +00:00
</resultMap>
2025-02-23 11:26:05 +00:00
2025-02-17 11:45:02 +00:00
<sql id="selectEmisTmsCostFeeSplitVo">
select id, cost_no, fee_item_id, bill_code, fee_type, split_type, cost_fee, total_volume, bill_weight, calc_remark, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_cost_fee_split
</sql>
2025-02-23 13:32:38 +00:00
2025-02-17 11:45:02 +00:00
<select id="selectEmisTmsCostFeeSplitList" parameterType="EmisTmsCostFeeSplit" resultMap="EmisTmsCostFeeSplitResult">
<include refid="selectEmisTmsCostFeeSplitVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
2025-02-23 09:20:11 +00:00
<if test="costNo != null and costNo != ''"> and cost_no=#{costNo}</if>
2025-02-17 11:45:02 +00:00
<if test="feeItemId != null "> and fee_item_id = #{feeItemId}</if>
2025-02-23 09:20:11 +00:00
<if test="billCode != null and billCode != ''"> and bill_code=#{billCode}</if>
<if test="feeType != null and feeType != ''"> and fee_type=#{feeType}</if>
<if test="splitType != null and splitType != ''"> and split_type=#{splitType}</if>
2025-02-17 11:45:02 +00:00
<if test="costFee != null "> and cost_fee = #{costFee}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
<if test="calcRemark != null and calcRemark != ''"> and calc_remark like concat('%', #{calcRemark}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</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>
</where>
order by create_time desc
</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>
2025-02-23 08:10:23 +00:00
2025-02-23 13:32:38 +00:00
<select id="selectListByBillCode" parameterType="String" resultMap="EmisTmsCostFeeSplitResult">
select id, cost_no, fee_item_id, bill_code, fee_type, split_type, cost_fee, total_volume, bill_weight, calc_remark, 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.bill_code = #{billCode}
</select>
<select id="selectListByCostNo" parameterType="String" resultMap="EmisTmsCostFeeSplitResult">
select id, cost_no, fee_item_id, bill_code, fee_type, split_type, cost_fee, total_volume, bill_weight, calc_remark, 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>
2025-02-23 08:10:23 +00:00
2025-02-17 11:45:02 +00:00
<select id="selectEmisTmsCostFeeSplitById" parameterType="Long" resultMap="EmisTmsCostFeeSplitResult">
select id, cost_no, fee_item_id, bill_code, fee_type, split_type, cost_fee, total_volume, bill_weight, calc_remark, 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="id != null">id,</if>
<if test="costNo != null and costNo != ''">cost_no,</if>
<if test="feeItemId != null">fee_item_id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="feeType != null and feeType != ''">fee_type,</if>
<if test="splitType != null and splitType != ''">split_type,</if>
<if test="costFee != null">cost_fee,</if>
<if test="totalVolume != null">total_volume,</if>
<if test="billWeight != null">bill_weight,</if>
<if test="calcRemark != null and calcRemark != ''">calc_remark,</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="id != null">#{id},</if>
<if test="costNo != null and costNo != ''">#{costNo},</if>
<if test="feeItemId != null">#{feeItemId},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<if test="feeType != null and feeType != ''">#{feeType},</if>
<if test="splitType != null and splitType != ''">#{splitType},</if>
<if test="costFee != null">#{costFee},</if>
<if test="totalVolume != null">#{totalVolume},</if>
<if test="billWeight != null">#{billWeight},</if>
<if test="calcRemark != null and calcRemark != ''">#{calcRemark},</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="feeItemId != null">fee_item_id = #{feeItemId},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="feeType != null and feeType != ''">fee_type = #{feeType},</if>
<if test="splitType != null and splitType != ''">split_type = #{splitType},</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="calcRemark != null and calcRemark != ''">calc_remark = #{calcRemark},</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>
2025-02-17 12:20:23 +00:00
<select id="getCostFeeByBillCode" 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.bill_code = #{billCode}
</select>
2025-02-23 08:10:23 +00:00
<delete id="deleteEmisTmsCostFeeSplitByCostNo" parameterType="String">
update emis_tms_cost_fee_split set del_flag='1' where cost_no = #{costNo}
</delete>
2025-02-17 11:45:02 +00:00
<delete id="deleteEmisTmsCostFeeSplitById" parameterType="Long">
2025-02-17 12:20:23 +00:00
update emis_tms_cost_fee_split set del_flag='1' where id = #{id}
2025-02-17 11:45:02 +00:00
</delete>
<delete id="deleteEmisTmsCostFeeSplitByIds" parameterType="String">
2025-02-17 12:20:23 +00:00
update emis_tms_cost_fee_split set del_flag='1' where id in
2025-02-17 11:45:02 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>