emis-service/emis-biz/src/main/resources/mapper/EmisTmsCostFeeRelMapper.xml
2025-02-17 22:00:42 +08:00

139 lines
7.4 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.EmisTmsCostFeeRelMapper">
<resultMap type="EmisTmsCostFeeRel" id="EmisTmsCostFeeRelResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="costNo" column="cost_no" />
<result property="billCode" column="bill_code" />
</resultMap>
<resultMap id="EmisTmsCostFeeRelWithSubBillResult" type="EmisTmsCostFeeRel" extends="EmisTmsCostFeeRelResult" >
<association property="waybillDetail"
column="bill_code"
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
fetchType="lazy"
/>
</resultMap>
<sql id="selectEmisTmsCostFeeRelVo">
select id, cost_no, bill_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_cost_fee_rel
</sql>
<select id="selectEmisTmsCostFeeRelList" parameterType="EmisTmsCostFeeRel" resultMap="EmisTmsCostFeeRelResult">
<include refid="selectEmisTmsCostFeeRelVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="costNo != null and costNo != ''"> and cost_no=#{costNo}</if>
<if test="billCode != null and billCode != ''"> and bill_code like concat('%', #{billCode}, '%')</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="EmisTmsCostFeeRel" resultType="int">
select count(1) from emis_tms_cost_fee_rel
where del_flag='0'
and id = #{id}
and cost_no = #{costNo}
and bill_code = #{billCode}
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="selectEmisTmsCostFeeRelById" parameterType="Long" resultMap="EmisTmsCostFeeRelResult">
select id, cost_no, bill_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_cost_fee_rel a
where a.id = #{id}
</select>
<select id="selectEmisTmsCostFeeRelListByCostNo" parameterType="String" resultMap="EmisTmsCostFeeRelWithSubBillResult">
select id, cost_no, bill_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_cost_fee_rel a
where del_flag='0' and a.cost_no = #{costNo}
</select>
<select id="selectEmisTmsCostFeeRelListByBillCode" parameterType="String" resultMap="EmisTmsCostFeeRelWithSubBillResult">
select id, cost_no, bill_code, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_cost_fee_rel a
where del_flag='0' and a.bill_code = #{billCode}
</select>
<insert id="insertEmisTmsCostFeeRel" parameterType="EmisTmsCostFeeRel" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_cost_fee_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="costNo != null and costNo != ''">cost_no,</if>
<if test="billCode != null and billCode != ''">bill_code,</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="billCode != null and billCode != ''">#{billCode},</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="updateEmisTmsCostFeeRel" parameterType="EmisTmsCostFeeRel">
update emis_tms_cost_fee_rel
<trim prefix="SET" suffixOverrides=",">
<if test="costNo != null and costNo != ''">cost_no = #{costNo},</if>
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</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="deleteEmisTmsCostFeeRelByCostNo" parameterType="String">
update emis_tms_cost_fee_rel set del_flag='1' where cost_no = #{costNo}
</delete>
<delete id="deleteEmisTmsCostFeeRelById" parameterType="Long">
update emis_tms_cost_fee_rel set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisTmsCostFeeRelByIds" parameterType="String">
update emis_tms_cost_fee_rel set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>