emis-service/emis-biz/src/main/resources/mapper/EmisWaybillTransferMapper.xml
2025-03-18 11:03:03 +08:00

183 lines
12 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.EmisWaybillTransferMapper">
<resultMap type="EmisWaybillTransfer" id="BaseEmisWaybillTransferResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="billCode" column="bill_code" />
<result property="transferBillCode" column="transfer_bill_code" />
<result property="transferDate" column="transfer_date" />
<result property="transferExpress" column="transfer_express" />
<result property="linkMan" column="link_man" />
<result property="linkPhone" column="link_phone" />
<result property="transferFee" column="transfer_fee" />
<result property="transferWeight" column="transfer_weight" />
<result property="transferVolume" column="transfer_volume" />
<result property="transferResean" column="transfer_resean" />
<result property="transferCity" column="transfer_city" />
<result property="dataFrom" column="data_from" />
</resultMap>
<resultMap id="EmisWaybillTransferResult" type="EmisWaybillTransfer" extends="BaseEmisWaybillTransferResult" >
<association property="waybillDetail"
column="bill_code"
select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"
fetchType="lazy"
/>
</resultMap>
<sql id="selectEmisWaybillTransferVo">
select id, bill_code, transfer_bill_code, transfer_date, transfer_express, link_man, link_phone, transfer_fee, transfer_weight, transfer_volume, transfer_resean, transfer_city, data_from, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_waybill_transfer a
</sql>
<select id="selectEmisWaybillTransferList" parameterType="EmisWaybillTransfer" resultMap="EmisWaybillTransferResult">
<include refid="selectEmisWaybillTransferVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="billCode != null and billCode != ''"> and ( FIND_IN_SET(`bill_code`,#{billCode}) or bill_code like concat('%', #{billCode}, '%') ) </if>
<if test="transferBillCode != null and transferBillCode != ''"> and transfer_bill_code like concat('%', #{transferBillCode}, '%')</if>
<if test="transferDate != null "> and transfer_date = #{transferDate}</if>
<if test="transferExpress != null and transferExpress != ''"> and transfer_express=#{transferExpress}</if>
<if test="linkMan != null and linkMan != ''"> and link_man like concat('%', #{linkMan}, '%')</if>
<if test="linkPhone != null and linkPhone != ''"> and link_phone like concat('%', #{linkPhone}, '%')</if>
<if test="transferFee != null "> and transfer_fee = #{transferFee}</if>
<if test="transferWeight != null "> and transfer_weight = #{transferWeight}</if>
<if test="transferVolume != null "> and transfer_volume = #{transferVolume}</if>
<if test="transferResean != null and transferResean != ''"> and transfer_resean like concat('%', #{transferResean}, '%')</if>
<if test="transferCity != null and transferCity != ''"> and transfer_city like concat('%', #{transferCity}, '%')</if>
<if test="dataFrom != null and dataFrom != ''"> and data_from like concat('%', #{dataFrom}, '%')</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="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="createSite != null and createSite != ''"> and create_site=#{createSite}</if>
<if test="updateSite != null and updateSite != ''"> and update_site=#{updateSite}</if>
<if test="params.beginTransferDate != null and params.beginTransferDate != ''">
and transfer_date <![CDATA[ >= ]]> #{params.beginTransferDate}
</if>
<if test="params.endTransferDate != null and params.endTransferDate != ''">
and transfer_date <![CDATA[ <= ]]> #{params.endTransferDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
create_site=#{params.privSiteCode}
)
</if>
<if test="params.blSign != null and params.blSign == 1">
and exists (select 1 from emis_waybill ewb where ewb.bl_sign = '1' and ewb.bill_code=a.bill_code)
</if>
<if test="params.blSign != null and params.blSign == 0">
and exists (select 1 from emis_waybill ewb where ewb.bl_sign != '1' and ewb.bill_code=a.bill_code)
</if>
</where>
order by create_time desc
</select>
<select id="selectEmisWaybillTransferById" parameterType="Long" resultMap="EmisWaybillTransferResult">
select id, bill_code, transfer_bill_code, transfer_date, transfer_express, link_man, link_phone, transfer_fee, transfer_weight, transfer_volume, transfer_resean, transfer_city, data_from, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
from emis_waybill_transfer a
where a.id = #{id}
</select>
<insert id="insertEmisWaybillTransfer" parameterType="EmisWaybillTransfer" useGeneratedKeys="true" keyProperty="id">
insert into emis_waybill_transfer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="billCode != null and billCode != ''">bill_code,</if>
<if test="transferBillCode != null and transferBillCode != ''">transfer_bill_code,</if>
<if test="transferDate != null">transfer_date,</if>
<if test="transferExpress != null and transferExpress != ''">transfer_express,</if>
<if test="linkMan != null and linkMan != ''">link_man,</if>
<if test="linkPhone != null and linkPhone != ''">link_phone,</if>
<if test="transferFee != null">transfer_fee,</if>
<if test="transferWeight != null">transfer_weight,</if>
<if test="transferVolume != null">transfer_volume,</if>
<if test="transferResean != null and transferResean != ''">transfer_resean,</if>
<if test="transferCity != null and transferCity != ''">transfer_city,</if>
<if test="dataFrom != null and dataFrom != ''">data_from,</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="remark != null and remark != ''">remark,</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="transferBillCode != null and transferBillCode != ''">#{transferBillCode},</if>
<if test="transferDate != null">#{transferDate},</if>
<if test="transferExpress != null and transferExpress != ''">#{transferExpress},</if>
<if test="linkMan != null and linkMan != ''">#{linkMan},</if>
<if test="linkPhone != null and linkPhone != ''">#{linkPhone},</if>
<if test="transferFee != null">#{transferFee},</if>
<if test="transferWeight != null">#{transferWeight},</if>
<if test="transferVolume != null">#{transferVolume},</if>
<if test="transferResean != null and transferResean != ''">#{transferResean},</if>
<if test="transferCity != null and transferCity != ''">#{transferCity},</if>
<if test="dataFrom != null and dataFrom != ''">#{dataFrom},</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="remark != null and remark != ''">#{remark},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisWaybillTransfer" parameterType="EmisWaybillTransfer">
update emis_waybill_transfer
<trim prefix="SET" suffixOverrides=",">
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
<if test="transferBillCode != null and transferBillCode != ''">transfer_bill_code = #{transferBillCode},</if>
<if test="transferDate != null">transfer_date = #{transferDate},</if>
<if test="transferExpress != null and transferExpress != ''">transfer_express = #{transferExpress},</if>
<if test="linkMan != null and linkMan != ''">link_man = #{linkMan},</if>
<if test="linkPhone != null and linkPhone != ''">link_phone = #{linkPhone},</if>
<if test="transferFee != null">transfer_fee = #{transferFee},</if>
<if test="transferWeight != null">transfer_weight = #{transferWeight},</if>
<if test="transferVolume != null">transfer_volume = #{transferVolume},</if>
<if test="transferResean != null and transferResean != ''">transfer_resean = #{transferResean},</if>
<if test="transferCity != null and transferCity != ''">transfer_city = #{transferCity},</if>
<if test="dataFrom != null and dataFrom != ''">data_from = #{dataFrom},</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="remark != null and remark != ''">remark = #{remark},</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="deleteEmisWaybillTransferById" parameterType="Long">
update emis_waybill_transfer set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisWaybillTransferByIds" parameterType="String">
update emis_waybill_transfer set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>