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

300 lines
19 KiB
XML
Raw Normal View History

2024-03-01 06:47:57 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2024-06-03 05:55:23 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-03-01 06:47:57 +00:00
<mapper namespace="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMapper">
2024-06-03 05:55:23 +00:00
2024-06-02 02:57:46 +00:00
<resultMap type="EmisTmsSiteBatch" id="EmisTmsSiteBatchResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
2024-03-01 06:47:57 +00:00
<result property="id" column="id" />
2024-06-03 05:55:23 +00:00
<result property="batchNo" column="batch_no" />
2024-03-01 06:47:57 +00:00
<result property="batchName" column="batch_name" />
<result property="batchDate" column="batch_date" />
2024-06-07 05:10:38 +00:00
<result property="transLineType" column="trans_line_type" />
<result property="productType" column="product_type" />
2024-06-03 05:55:23 +00:00
<result property="batchType" column="batch_type" />
2024-03-01 06:47:57 +00:00
<result property="transType" column="trans_type" />
2024-06-07 05:10:38 +00:00
2024-06-08 04:51:13 +00:00
<result property="startSiteCode" column="start_site_code" />
2024-03-01 06:47:57 +00:00
<result property="nextSiteCode" column="next_site_code" />
<result property="airBilllNo" column="air_billl_no" />
<result property="etd" column="etd" />
<result property="eta" column="eta" />
<result property="packNum" column="pack_num" />
<result property="carNo" column="car_no" />
<result property="shipNo" column="ship_no" />
<result property="clearanceResStatus" column="clearance_res_status" />
<result property="declareResStatus" column="declare_res_status" />
2024-06-08 04:51:13 +00:00
<result property="sendCountry" column="send_country" />
2024-06-03 05:55:23 +00:00
<result property="destCountry" column="dest_country" />
2024-06-07 05:10:38 +00:00
2024-06-03 05:55:23 +00:00
<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="opMan" column="op_man" />
2024-06-07 05:10:38 +00:00
<association property="productTypeName" column="product_type" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectProdNameByCode"/>
<association property="transLineTypeName" column="trans_line_type" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectLineNameByCode"/>
<!-- 个性化查询 -->
2024-06-08 04:57:22 +00:00
<association property="sendCountryName" column="trans_line_type" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectFromCountryNameByLineCode"/>
<association property="destCountryName" column="dest_country" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode"/>
2024-06-07 05:10:38 +00:00
2024-03-01 06:47:57 +00:00
</resultMap>
<sql id="selectEmisTmsSiteBatchVo">
2024-06-07 05:10:38 +00:00
select id, batch_no, batch_name, batch_date, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, pack_num, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, total_parcel_qty, total_waybill_qty, total_volume, total_weight, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_tms_site_batch
2024-03-01 06:47:57 +00:00
</sql>
<select id="selectEmisTmsSiteBatchList" parameterType="EmisTmsSiteBatch" resultMap="EmisTmsSiteBatchResult">
<include refid="selectEmisTmsSiteBatchVo"/>
2024-06-03 05:55:23 +00:00
<where>
del_flag='0'
2024-03-01 06:47:57 +00:00
<if test="id != null "> and id = #{id}</if>
2024-06-13 14:42:49 +00:00
<if test="batchNo != null and batchNo != ''"> and ( FIND_IN_SET(`batch_no`,#{batchNo}) or batch_no like concat('%', #{batchNo}, '%') )</if>
2024-03-01 06:47:57 +00:00
<if test="batchName != null and batchName != ''"> and batch_name like concat('%', #{batchName}, '%')</if>
2024-06-03 05:55:23 +00:00
<if test="batchDate != null "> and batch_date = #{batchDate}</if>
2024-06-13 14:42:49 +00:00
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
<if test="batchType != null and batchType != ''"> and batch_type=#{batchType}</if>
<if test="transType != null and transType != ''"> and trans_type=#{transType}</if>
<if test="startSiteCode != null and startSiteCode != ''"> and start_site_code=#{startSiteCode}</if>
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code=#{nextSiteCode}</if>
<if test="airBilllNo != null and airBilllNo != ''"> and air_billl_no=#{airBilllNo}</if>
2024-06-03 05:55:23 +00:00
<if test="etd != null "> and etd = #{etd}</if>
<if test="eta != null "> and eta = #{eta}</if>
<if test="packNum != null "> and pack_num = #{packNum}</if>
2024-06-13 14:42:49 +00:00
<if test="carNo != null and carNo != ''"> and car_no=#{carNo}</if>
<if test="shipNo != null and shipNo != ''"> and ship_no=#{shipNo}</if>
<if test="clearanceResStatus != null and clearanceResStatus != ''"> and clearance_res_status= #{clearanceResStatus}</if>
<if test="declareResStatus != null and declareResStatus != ''"> and declare_res_status=#{declareResStatus}</if>
<if test="destCountry != null and destCountry != ''"> and dest_country=#{destCountry}</if>
2024-06-03 05:55:23 +00:00
<if test="destCountryName != null and destCountryName != ''"> and dest_country_name like concat('%', #{destCountryName}, '%')</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="opMan != null and opMan != ''"> and op_man like concat('%', #{opMan}, '%')</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>
2024-03-01 06:47:57 +00:00
<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>
2024-06-13 14:42:49 +00:00
<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.privSiteCode != null and params.privSiteCode != '88888'">
and (
start_site_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>
2024-03-01 06:47:57 +00:00
</where>
order by create_time desc
</select>
2024-06-03 05:55:23 +00:00
<select id="checkUnique" parameterType="EmisTmsSiteBatch" resultType="int">
select count(1) from emis_tms_site_batch
where del_flag='0'
and id = #{id}
and batch_no = #{batchNo}
and batch_name = #{batchName}
and batch_date = #{batchDate}
2024-06-07 05:10:38 +00:00
and trans_line_type = #{transLineType}
and product_type = #{productType}
2024-06-03 05:55:23 +00:00
and batch_type = #{batchType}
and trans_type = #{transType}
and start_site_code = #{startSiteCode}
2024-06-07 05:10:38 +00:00
and send_country = #{sendCountry}
2024-06-03 05:55:23 +00:00
and next_site_code = #{nextSiteCode}
and air_billl_no = #{airBilllNo}
and etd = #{etd}
and eta = #{eta}
and pack_num = #{packNum}
and car_no = #{carNo}
and ship_no = #{shipNo}
and clearance_res_status = #{clearanceResStatus}
and declare_res_status = #{declareResStatus}
and dest_country = #{destCountry}
and dest_country_name = #{destCountryName}
and total_parcel_qty = #{totalParcelQty}
and total_waybill_qty = #{totalWaybillQty}
and total_volume = #{totalVolume}
and total_weight = #{totalWeight}
and op_man = #{opMan}
and remark = #{remark}
and tenant_id = #{tenantId}
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>
2024-03-01 06:47:57 +00:00
<select id="selectEmisTmsSiteBatchById" parameterType="Long" resultMap="EmisTmsSiteBatchResult">
2024-06-07 05:10:38 +00:00
select id, batch_no, batch_name, batch_date, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, pack_num, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, total_parcel_qty, total_waybill_qty, total_volume, total_weight, op_man, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2024-03-01 06:47:57 +00:00
from emis_tms_site_batch a
where a.id = #{id}
</select>
2024-06-03 05:55:23 +00:00
<insert id="insertEmisTmsSiteBatch" parameterType="EmisTmsSiteBatch" useGeneratedKeys="true" keyProperty="id">
2024-03-01 06:47:57 +00:00
insert into emis_tms_site_batch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
2024-06-03 05:55:23 +00:00
<if test="batchNo != null and batchNo != ''">batch_no,</if>
2024-03-01 06:47:57 +00:00
<if test="batchName != null and batchName != ''">batch_name,</if>
2024-06-03 05:55:23 +00:00
<if test="batchDate != null">batch_date,</if>
2024-06-07 05:10:38 +00:00
<if test="transLineType != null and transLineType != ''">trans_line_type,</if>
<if test="productType != null and productType != ''">product_type,</if>
2024-06-03 05:55:23 +00:00
<if test="batchType != null and batchType != ''">batch_type,</if>
2024-03-01 06:47:57 +00:00
<if test="transType != null and transType != ''">trans_type,</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code,</if>
2024-06-07 05:10:38 +00:00
<if test="sendCountry != null and sendCountry != ''">send_country,</if>
2024-03-01 06:47:57 +00:00
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code,</if>
<if test="airBilllNo != null and airBilllNo != ''">air_billl_no,</if>
2024-06-03 05:55:23 +00:00
<if test="etd != null">etd,</if>
<if test="eta != null">eta,</if>
<if test="packNum != null">pack_num,</if>
2024-03-01 06:47:57 +00:00
<if test="carNo != null and carNo != ''">car_no,</if>
<if test="shipNo != null and shipNo != ''">ship_no,</if>
<if test="clearanceResStatus != null and clearanceResStatus != ''">clearance_res_status,</if>
<if test="declareResStatus != null and declareResStatus != ''">declare_res_status,</if>
2024-06-03 05:55:23 +00:00
<if test="destCountry != null and destCountry != ''">dest_country,</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name,</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="opMan != null and opMan != ''">op_man,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
2024-03-01 06:47:57 +00:00
<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>
2024-06-03 05:55:23 +00:00
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
2024-03-01 06:47:57 +00:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
2024-06-03 05:55:23 +00:00
<if test="batchNo != null and batchNo != ''">#{batchNo},</if>
2024-03-01 06:47:57 +00:00
<if test="batchName != null and batchName != ''">#{batchName},</if>
2024-06-03 05:55:23 +00:00
<if test="batchDate != null">#{batchDate},</if>
2024-06-07 05:10:38 +00:00
<if test="transLineType != null and transLineType != ''">#{transLineType},</if>
<if test="productType != null and productType != ''">#{productType},</if>
2024-06-03 05:55:23 +00:00
<if test="batchType != null and batchType != ''">#{batchType},</if>
2024-03-01 06:47:57 +00:00
<if test="transType != null and transType != ''">#{transType},</if>
<if test="startSiteCode != null and startSiteCode != ''">#{startSiteCode},</if>
2024-06-07 05:10:38 +00:00
<if test="sendCountry != null and sendCountry != ''">#{sendCountry},</if>
2024-03-01 06:47:57 +00:00
<if test="nextSiteCode != null and nextSiteCode != ''">#{nextSiteCode},</if>
<if test="airBilllNo != null and airBilllNo != ''">#{airBilllNo},</if>
2024-06-03 05:55:23 +00:00
<if test="etd != null">#{etd},</if>
<if test="eta != null">#{eta},</if>
<if test="packNum != null">#{packNum},</if>
2024-03-01 06:47:57 +00:00
<if test="carNo != null and carNo != ''">#{carNo},</if>
<if test="shipNo != null and shipNo != ''">#{shipNo},</if>
<if test="clearanceResStatus != null and clearanceResStatus != ''">#{clearanceResStatus},</if>
<if test="declareResStatus != null and declareResStatus != ''">#{declareResStatus},</if>
2024-06-03 05:55:23 +00:00
<if test="destCountry != null and destCountry != ''">#{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">#{destCountryName},</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="opMan != null and opMan != ''">#{opMan},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
2024-03-01 06:47:57 +00:00
<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>
2024-06-03 05:55:23 +00:00
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
2024-03-01 06:47:57 +00:00
</insert>
<update id="updateEmisTmsSiteBatch" parameterType="EmisTmsSiteBatch">
update emis_tms_site_batch
<trim prefix="SET" suffixOverrides=",">
2024-06-03 05:55:23 +00:00
<if test="batchNo != null and batchNo != ''">batch_no = #{batchNo},</if>
2024-03-01 06:47:57 +00:00
<if test="batchName != null and batchName != ''">batch_name = #{batchName},</if>
2024-06-03 05:55:23 +00:00
<if test="batchDate != null">batch_date = #{batchDate},</if>
2024-06-07 05:10:38 +00:00
<if test="transLineType != null and transLineType != ''">trans_line_type = #{transLineType},</if>
<if test="productType != null and productType != ''">product_type = #{productType},</if>
2024-06-03 05:55:23 +00:00
<if test="batchType != null and batchType != ''">batch_type = #{batchType},</if>
2024-03-01 06:47:57 +00:00
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code = #{startSiteCode},</if>
2024-06-07 05:10:38 +00:00
<if test="sendCountry != null and sendCountry != ''">send_country = #{sendCountry},</if>
2024-03-01 06:47:57 +00:00
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="airBilllNo != null and airBilllNo != ''">air_billl_no = #{airBilllNo},</if>
2024-06-03 05:55:23 +00:00
<if test="etd != null">etd = #{etd},</if>
<if test="eta != null">eta = #{eta},</if>
<if test="packNum != null">pack_num = #{packNum},</if>
2024-03-01 06:47:57 +00:00
<if test="carNo != null and carNo != ''">car_no = #{carNo},</if>
<if test="shipNo != null and shipNo != ''">ship_no = #{shipNo},</if>
<if test="clearanceResStatus != null and clearanceResStatus != ''">clearance_res_status = #{clearanceResStatus},</if>
<if test="declareResStatus != null and declareResStatus != ''">declare_res_status = #{declareResStatus},</if>
2024-06-03 05:55:23 +00:00
<if test="destCountry != null and destCountry != ''">dest_country = #{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name = #{destCountryName},</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="opMan != null and opMan != ''">op_man = #{opMan},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
2024-03-01 06:47:57 +00:00
<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>
2024-06-03 05:55:23 +00:00
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
2024-03-01 06:47:57 +00:00
</trim>
where id = #{id}
</update>
<delete id="deleteEmisTmsSiteBatchById" parameterType="Long">
delete from emis_tms_site_batch where id = #{id}
</delete>
<delete id="deleteEmisTmsSiteBatchByIds" parameterType="String">
2024-06-03 05:55:23 +00:00
delete from emis_tms_site_batch where id in
2024-03-01 06:47:57 +00:00
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>