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

148 lines
8.1 KiB
XML
Raw Normal View History

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" />
<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">
select id, bill_code, standard_fee, bill_fee, cost_fee, bill_profit, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_cost_profit
</sql>
2025-02-23 09:17:09 +00:00
<select id="selectEmisTmsCostProfitList" parameterType="EmisTmsCostProfit" resultMap="EmisTmsCostProfitWithSubBillResult">
2024-10-10 02:18:56 +00:00
<include refid="selectEmisTmsCostProfitVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="billCode != null and billCode != ''"> and bill_code like concat('%', #{billCode}, '%')</if>
<if test="standardFee != null "> and standard_fee = #{standardFee}</if>
<if test="billFee != null "> and bill_fee = #{billFee}</if>
<if test="costFee != null "> and cost_fee = #{costFee}</if>
<if test="billProfit != null "> and bill_profit = #{billProfit}</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="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">
select id, bill_code, standard_fee, bill_fee, cost_fee, bill_profit, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
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">
select id, bill_code, standard_fee, bill_fee, cost_fee, bill_profit, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_cost_profit a
where a.bill_code = #{billCode}
</select>
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>
<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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="billCode != null and billCode != ''">#{billCode},</if>
<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>
</trim>
</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>
<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>