emis-service/emis-biz/src/main/resources/mapper/EmisTmsPackMapper.xml
2024-07-05 20:00:26 +08:00

344 lines
23 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.EmisTmsPackMapper">
<resultMap type="EmisTmsPack" id="EmisTmsPackResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="packNo" column="pack_no" />
<result property="packName" column="pack_name" />
<result property="packDate" column="pack_date" />
<result property="destCountry" column="dest_country" />
<result property="destCountryName" column="dest_country_name" />
<result property="blUnpack" column="bl_unpack" />
<result property="sendStiteCode" column="send_stite_code" />
<result property="nextSiteCode" column="next_site_code" />
<result property="nextStation" column="next_station" />
<result property="totalParcelQty" column="total_parcel_qty" />
<result property="totalWaybillQty" column="total_waybill_qty" />
<result property="totalVolume" column="total_volume" />
<result property="totalWeight" column="total_weight" />
<result property="packStatus" column="pack_status" />
<result property="printStatus" column="print_status" />
<result property="printCount" column="print_count" />
<result property="printDate" column="print_date" />
<result property="extData" column="ext_data" />
<result property="opMan" column="op_man" />
<result property="ext1" column="ext1" />
<result property="ext2" column="ext2" />
<result property="ext3" column="ext3" />
<result property="ext4" column="ext4" />
</resultMap>
<sql id="selectEmisTmsPackVo">
select id, pack_no, pack_name, pack_date, dest_country, dest_country_name, bl_unpack, send_stite_code, next_site_code, next_station, total_parcel_qty, total_waybill_qty, total_volume, total_weight, pack_status, print_status, print_count, print_date, ext_data, op_man, ext1, ext2, ext3, ext4, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_pack
</sql>
<select id="selectEmisTmsPackList" parameterType="EmisTmsPack" resultMap="EmisTmsPackResult">
<include refid="selectEmisTmsPackVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="packNo != null and packNo != ''"> and ( FIND_IN_SET(`pack_no`,#{packNo}) or pack_no like concat('%', #{packNo}, '%') )</if>
<if test="packName != null and packName != ''"> and pack_name like concat('%', #{packName}, '%')</if>
<if test="packDate != null "> and pack_date like concat('%', #{packDate}, '%')</if>
<if test="destCountry != null and destCountry != ''"> and dest_country = #{destCountry}</if>
<if test="destCountryName != null and destCountryName != ''"> and dest_country_name like concat('%', #{destCountryName}, '%')</if>
<if test="blUnpack != null and blUnpack != ''"> and bl_unpack = #{blUnpack}</if>
<if test="sendStiteCode != null and sendStiteCode != ''"> and send_stite_code = #{sendStiteCode}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code = #{nextSiteCode}</if>
<if test="nextStation != null and nextStation != ''"> and next_station = #{nextStation}</if>
<if test="totalParcelQty != null "> and total_parcel_qty = #{totalParcelQty}</if>
<if test="totalWaybillQty != null "> and total_waybill_qty = #{totalWaybillQty}</if>
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
<if test="packStatus != null and packStatus != ''"> and pack_status = #{packStatus}</if>
<if test="printStatus != null and printStatus != ''"> and print_status = #{printStatus}</if>
<if test="printCount != null "> and print_count = #{printCount}</if>
<if test="printDate != null "> and print_date = #{printDate}</if>
<if test="extData != null and extData != ''"> and ext_data like concat('%', #{extData}, '%')</if>
<if test="opMan != null and opMan != ''"> and op_man = #{opMan}</if>
<if test="ext1 != null and ext1 != ''"> and ext1 like concat('%', #{ext1}, '%')</if>
<if test="ext2 != null and ext2 != ''"> and ext2 like concat('%', #{ext2}, '%')</if>
<if test="ext3 != null and ext3 != ''"> and ext3 like concat('%', #{ext3}, '%')</if>
<if test="ext4 != null and ext4 != ''"> and ext4 like concat('%', #{ext4}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</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.beginCreateTime != null and params.beginCreateTime != ''">
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.blValid != null and params.blValid == 1">
and pack_status=0
and to_days(create_time) = to_days(now())
and create_site=#{params.privSiteCode}
</if>
<if test="params.blValid != null and params.blValid != 1">
and pack_status!=0
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
send_stite_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
create_site in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
)
</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisTmsPack" resultType="int">
select count(1) from emis_tms_pack
where del_flag='0'
and pack_no = #{packNo}
limit 1
</select>
<select id="selectEmisTmsPackById" parameterType="Long" resultMap="EmisTmsPackResult">
select id, pack_no, pack_name, pack_date, dest_country, dest_country_name, bl_unpack, send_stite_code, next_site_code, next_station, total_parcel_qty, total_waybill_qty, total_volume, total_weight, pack_status, print_status, print_count, print_date, ext_data, op_man, ext1, ext2, ext3, ext4, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_pack a
where a.id = #{id}
</select>
<select id="selectEmisTmsPackByPackNo" parameterType="String" resultMap="EmisTmsPackResult">
select id, pack_no, pack_name, pack_date, dest_country, dest_country_name, bl_unpack, send_stite_code, next_site_code, next_station, total_parcel_qty, total_waybill_qty, total_volume, total_weight, pack_status, print_status, print_count, print_date, ext_data, op_man, ext1, ext2, ext3, ext4, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_pack a
where a.pack_no = #{packNo}
</select>
<insert id="insertEmisTmsPack" parameterType="EmisTmsPack" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_pack
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="packNo != null and packNo != ''">pack_no,</if>
<if test="packName != null and packName != ''">pack_name,</if>
<if test="packDate != null">pack_date,</if>
<if test="destCountry != null and destCountry != ''">dest_country,</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name,</if>
<if test="blUnpack != null and blUnpack != ''">bl_unpack,</if>
<if test="sendStiteCode != null and sendStiteCode != ''">send_stite_code,</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code,</if>
<if test="nextStation != null and nextStation != ''">next_station,</if>
<if test="totalParcelQty != null">total_parcel_qty,</if>
<if test="totalWaybillQty != null">total_waybill_qty,</if>
<if test="totalVolume != null">total_volume,</if>
<if test="totalWeight != null">total_weight,</if>
<if test="packStatus != null and packStatus != ''">pack_status,</if>
<if test="printStatus != null and printStatus != ''">print_status,</if>
<if test="printCount != null">print_count,</if>
<if test="printDate != null">print_date,</if>
<if test="extData != null and extData != ''">ext_data,</if>
<if test="opMan != null and opMan != ''">op_man,</if>
<if test="ext1 != null and ext1 != ''">ext1,</if>
<if test="ext2 != null and ext2 != ''">ext2,</if>
<if test="ext3 != null and ext3 != ''">ext3,</if>
<if test="ext4 != null and ext4 != ''">ext4,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</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="packNo != null and packNo != ''">#{packNo},</if>
<if test="packName != null and packName != ''">#{packName},</if>
<if test="packDate != null">#{packDate},</if>
<if test="destCountry != null and destCountry != ''">#{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">#{destCountryName},</if>
<if test="blUnpack != null and blUnpack != ''">#{blUnpack},</if>
<if test="sendStiteCode != null and sendStiteCode != ''">#{sendStiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">#{nextSiteCode},</if>
<if test="nextStation != null and nextStation != ''">#{nextStation},</if>
<if test="totalParcelQty != null">#{totalParcelQty},</if>
<if test="totalWaybillQty != null">#{totalWaybillQty},</if>
<if test="totalVolume != null">#{totalVolume},</if>
<if test="totalWeight != null">#{totalWeight},</if>
<if test="packStatus != null and packStatus != ''">#{packStatus},</if>
<if test="printStatus != null and printStatus != ''">#{printStatus},</if>
<if test="printCount != null">#{printCount},</if>
<if test="printDate != null">#{printDate},</if>
<if test="extData != null and extData != ''">#{extData},</if>
<if test="opMan != null and opMan != ''">#{opMan},</if>
<if test="ext1 != null and ext1 != ''">#{ext1},</if>
<if test="ext2 != null and ext2 != ''">#{ext2},</if>
<if test="ext3 != null and ext3 != ''">#{ext3},</if>
<if test="ext4 != null and ext4 != ''">#{ext4},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</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="updateEmisTmsPack" parameterType="EmisTmsPack">
update emis_tms_pack
<trim prefix="SET" suffixOverrides=",">
<if test="packNo != null and packNo != ''">pack_no = #{packNo},</if>
<if test="packName != null and packName != ''">pack_name = #{packName},</if>
<if test="packDate != null">pack_date = #{packDate},</if>
<if test="destCountry != null and destCountry != ''">dest_country = #{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name = #{destCountryName},</if>
<if test="blUnpack != null and blUnpack != ''">bl_unpack = #{blUnpack},</if>
<if test="sendStiteCode != null and sendStiteCode != ''">send_stite_code = #{sendStiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="nextStation != null and nextStation != ''">next_station = #{nextStation},</if>
<if test="totalParcelQty != null">total_parcel_qty = #{totalParcelQty},</if>
<if test="totalWaybillQty != null">total_waybill_qty = #{totalWaybillQty},</if>
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
<if test="packStatus != null and packStatus != ''">pack_status = #{packStatus},</if>
<if test="printStatus != null and printStatus != ''">print_status = #{printStatus},</if>
<if test="printCount != null">print_count = #{printCount},</if>
<if test="printDate != null">print_date = #{printDate},</if>
<if test="extData != null and extData != ''">ext_data = #{extData},</if>
<if test="opMan != null and opMan != ''">op_man = #{opMan},</if>
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="ext4 != null and ext4 != ''">ext4 = #{ext4},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</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>
<update id="updateEmisTmsPackByPackNo" parameterType="EmisTmsPack">
update emis_tms_pack
<trim prefix="SET" suffixOverrides=",">
<if test="packName != null and packName != ''">pack_name = #{packName},</if>
<if test="packDate != null">pack_date = #{packDate},</if>
<if test="destCountry != null and destCountry != ''">dest_country = #{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name = #{destCountryName},</if>
<if test="blUnpack != null and blUnpack != ''">bl_unpack = #{blUnpack},</if>
<if test="sendStiteCode != null and sendStiteCode != ''">send_stite_code = #{sendStiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="nextStation != null and nextStation != ''">next_station = #{nextStation},</if>
<if test="totalParcelQty != null">total_parcel_qty = #{totalParcelQty},</if>
<if test="totalWaybillQty != null">total_waybill_qty = #{totalWaybillQty},</if>
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
<if test="packStatus != null and packStatus != ''">pack_status = #{packStatus},</if>
<if test="printStatus != null and printStatus != ''">print_status = #{printStatus},</if>
<if test="printCount != null">print_count = #{printCount},</if>
<if test="printDate != null">print_date = #{printDate},</if>
<if test="extData != null and extData != ''">ext_data = #{extData},</if>
<if test="opMan != null and opMan != ''">op_man = #{opMan},</if>
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="ext4 != null and ext4 != ''">ext4 = #{ext4},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</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 pack_no = #{packNo} and del_flag='0'
</update>
<update id="updateEmisTmsPack" parameterType="EmisTmsPack">
update emis_tms_pack
<trim prefix="SET" suffixOverrides=",">
<if test="packNo != null and packNo != ''">pack_no = #{packNo},</if>
<if test="packName != null and packName != ''">pack_name = #{packName},</if>
<if test="packDate != null">pack_date = #{packDate},</if>
<if test="destCountry != null and destCountry != ''">dest_country = #{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name = #{destCountryName},</if>
<if test="blUnpack != null and blUnpack != ''">bl_unpack = #{blUnpack},</if>
<if test="sendStiteCode != null and sendStiteCode != ''">send_stite_code = #{sendStiteCode},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="nextStation != null and nextStation != ''">next_station = #{nextStation},</if>
<if test="totalParcelQty != null">total_parcel_qty = #{totalParcelQty},</if>
<if test="totalWaybillQty != null">total_waybill_qty = #{totalWaybillQty},</if>
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
<if test="packStatus != null and packStatus != ''">pack_status = #{packStatus},</if>
<if test="printStatus != null and printStatus != ''">print_status = #{printStatus},</if>
<if test="printCount != null">print_count = #{printCount},</if>
<if test="printDate != null">print_date = #{printDate},</if>
<if test="extData != null and extData != ''">ext_data = #{extData},</if>
<if test="opMan != null and opMan != ''">op_man = #{opMan},</if>
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="ext4 != null and ext4 != ''">ext4 = #{ext4},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</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="deleteEmisTmsPackById" parameterType="Long">
update emis_tms_pack set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisTmsPackByIds" parameterType="String">
update emis_tms_pack set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>