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

507 lines
35 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.EmisTmsSiteBatchMapper">
<resultMap type="EmisTmsSiteBatch" id="EmisTmsSiteBatchResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="batchNo" column="batch_no" />
<result property="batchName" column="batch_name" />
<result property="batchDate" column="batch_date" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="transLineType" column="trans_line_type" />
<result property="productType" column="product_type" />
<result property="batchType" column="batch_type" />
<result property="transType" column="trans_type" />
<result property="startSiteCode" column="start_site_code" />
<result property="sendCountry" column="send_country" />
<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="carNo" column="car_no" />
<result property="shipNo" column="ship_no" />
<result property="clearanceResStatus" column="clearance_res_status" />
<result property="declareResStatus" column="declare_res_status" />
<result property="destCountry" column="dest_country" />
<result property="destCountryName" column="dest_country_name" />
<result property="transWeight" column="trans_weight" />
<result property="packNum" column="pack_num" />
<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" />
<result property="blEntering" column="bl_entering" />
<!-- 扩展 -->
<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"/>
<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"/>
<association property="startSiteName" column="start_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
</resultMap>
<resultMap type="EmisTmsSiteBatch" id="EmisTmsSiteBatchDtlResult" extends="EmisTmsSiteBatchResult">
<result property="id" column="id" />
<result property="batchNo" column="batch_no" />
<result property="batchName" column="batch_name" />
<result property="batchDate" column="batch_date" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="transLineType" column="trans_line_type" />
<result property="productType" column="product_type" />
<result property="batchType" column="batch_type" />
<result property="transType" column="trans_type" />
<result property="startSiteCode" column="start_site_code" />
<result property="sendCountry" column="send_country" />
<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="carNo" column="car_no" />
<result property="shipNo" column="ship_no" />
<result property="clearanceResStatus" column="clearance_res_status" />
<result property="declareResStatus" column="declare_res_status" />
<result property="destCountry" column="dest_country" />
<result property="destCountryName" column="dest_country_name" />
<result property="transWeight" column="trans_weight" />
<result property="packNum" column="pack_num" />
<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" />
<result property="blEntering" column="bl_entering" />
<!-- 扩展 -->
<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"/>
<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"/>
<association property="startSiteName" column="start_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<!-- 批次明细列表 -->
<collection property="batchDtlList" ofType="EmisTmsSiteBatchDtl" select="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlByBatchNo" column="batch_no">
<result property="id" column="id"/>
<result property="billCode" column="bill_code"/>
<result property="batchNo" column="batch_no"/>
<result property="scanDate" column="scan_date"/>
<result property="scanStatus" column="scan_status"/>
<result property="groupStatus" column="group_status"/>
<result property="scanMan" column="scan_man"/>
<result property="scanSite" column="scan_site"/>
<association property="waybillDetail" column="bill_code" select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"/>
</collection>
</resultMap>
<resultMap type="EmisTmsSiteBatch" id="EmisTmsSiteBatchWithDetailsResult" extends="EmisTmsSiteBatchResult">
<!-- 批次明细列表 -->
<collection property="batchDtlList" ofType="EmisTmsSiteBatchDtl" select="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlByBatchNo" column="batch_no">
<result property="id" column="id"/>
<result property="billCode" column="bill_code"/>
<result property="batchNo" column="batch_no"/>
<result property="scanDate" column="scan_date"/>
<result property="scanStatus" column="scan_status"/>
<result property="groupStatus" column="group_status"/>
<result property="scanMan" column="scan_man"/>
<result property="scanSite" column="scan_site"/>
<association property="waybillDetail" column="bill_code" select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"/>
</collection>
<!-- 装载信息列表 -->
<collection property="loadingList" ofType="EmisTmsSiteBatchLoading" select="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLoadingMapper.selectEmisTmsSiteBatchLoadingByBatchNo" column="batch_no">
<result property="id" column="id"/>
<result property="batchNo" column="batch_no"/>
<result property="posNo" column="pos_no"/>
<result property="row" column="row"/>
<result property="col" column="col"/>
<result property="layer" column="layer"/>
<result property="posDesc" column="pos_desc"/>
</collection>
</resultMap>
<sql id="selectEmisTmsSiteBatchVo">
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, 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, bl_entering from emis_tms_site_batch
</sql>
<select id="selectEmisTmsSiteBatchList" parameterType="EmisTmsSiteBatch" resultMap="EmisTmsSiteBatchResult">
<include refid="selectEmisTmsSiteBatchVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="batchNo != null and batchNo != ''"> and FIND_IN_SET(`batch_no`,#{batchNo})</if>
<if test="batchName != null and batchName != ''"> and ( batch_name like concat('%', #{batchName}, '%') )</if>
<if test="batchDate != null "> and batch_date = #{batchDate}</if>
<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>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code=#{supplierCode}</if>
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
<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>
<if test="carNo != null and carNo != ''"> and car_no like concat('%', #{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>
<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>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{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="blEntering != null and blEntering != ''"> and bl_entering=#{blEntering}</if>
<if test="searchValue != null and searchValue != '' ">
and ( batch_no like concat('%', #{searchValue},'%') or batch_name like concat('%', #{searchValue},'%') or car_no like concat('%', #{searchValue},'%') )
</if>
<if test="params.billCode != null and params.billCode != ''">
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0' and FIND_IN_SET(`bill_code`,#{params.billCode}) )
</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.beginEtd != null and params.beginEtd != ''">
and etd <![CDATA[ >= ]]> #{params.beginEtd}
</if>
<if test="params.endEtd != null and params.endEtd != ''">
and etd <![CDATA[ <= ]]> #{params.endEtd}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
start_site_code=#{params.privSiteCode}
or create_site=#{params.privSiteCode}
)
</if>
</where>
order by create_time desc
</select>
<select id="selectEmisTmsSiteBatchDtlList" parameterType="EmisTmsSiteBatch" resultMap="EmisTmsSiteBatchDtlResult">
<include refid="selectEmisTmsSiteBatchVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="batchNo != null and batchNo != ''"> and `batch_no`= #{batchNo} </if>
<if test="batchName != null and batchName != ''"> and ( batch_name like concat('%', #{batchName}, '%') )</if>
<if test="batchDate != null "> and batch_date = #{batchDate}</if>
<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>
<if test="supplierCode != null and supplierCode != ''"> and supplier_code=#{supplierCode}</if>
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
<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>
<if test="carNo != null and carNo != ''"> and car_no like concat('%', #{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>
<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>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{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="blEntering != null and blEntering != ''"> and bl_entering=#{blEntering}</if>
<if test="searchValue != null and searchValue != '' ">
and ( batch_no like concat('%', #{searchValue},'%') or batch_name like concat('%', #{searchValue},'%') or car_no like concat('%', #{searchValue},'%') )
</if>
<if test="params.billCode != null and params.billCode != ''">
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0' and FIND_IN_SET(`bill_code`,#{params.billCode}) )
</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.beginEtd != null and params.beginEtd != ''">
and etd <![CDATA[ >= ]]> #{params.beginEtd}
</if>
<if test="params.endEtd != null and params.endEtd != ''">
and etd <![CDATA[ <= ]]> #{params.endEtd}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
start_site_code=#{params.privSiteCode}
or create_site=#{params.privSiteCode}
)
</if>
</where>
order by create_time desc
</select>
<!-- 查询待提成运单 -->
<select id="selectWaitDoProfitList" parameterType="EmisTmsSiteBatch" resultMap="EmisTmsSiteBatchResult">
SELECT
batch_no
FROM
emis_tms_site_batch a
WHERE a.del_flag = '0'
<if test="params.noNeedBlProfit == null">
AND a.bl_profit = '0'
</if>
<if test="params.billMonth != null and params.billMonth != ''">
and DATE_FORMAT(a.etd,'%Y%m')= #{params.billMonth}
</if>
ORDER BY a.etd DESC
</select>
<select id="checkUnique" parameterType="EmisTmsSiteBatch" resultType="int">
select count(1)
from emis_tms_site_batch
where del_flag = '0'
and batch_no != #{batchNo}
and start_site_code = #{startSiteCode}
and next_site_code = #{nextSiteCode}
and supplier_code=#{supplierCode}
and batch_no in (select batch_no from emis_tms_site_batch_dtl where del_flag='0'
and FIND_IN_SET(`bill_code`
, #{params.billCode}) )
limit 1
</select>
<select id="selectEmisTmsSiteBatchById" parameterType="Long" resultMap="EmisTmsSiteBatchResult">
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, 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 a
where a.id = #{id}
</select>
<select id="selectEmisTmsSiteBatchWithDetailsById" parameterType="Long" resultMap="EmisTmsSiteBatchWithDetailsResult">
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, 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, bl_entering
from emis_tms_site_batch a
where a.id = #{id}
</select>
<select id="selectTmsSiteBatchBySupplerAndCarNo" parameterType="EmisTmsSiteBatch" resultMap="EmisTmsSiteBatchResult">
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, 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 a
where a.del_flag='0' and a.supplier_code = #{supplierCode} and a.car_no = #{carNo} limit 1
</select>
<select id="selectTmsSiteBatchByBatchNo" parameterType="String" resultMap="EmisTmsSiteBatchResult">
select id, batch_no, batch_name, batch_date, supplier_code, supplier_name, trans_line_type, product_type, batch_type, trans_type, start_site_code, send_country, next_site_code, air_billl_no, etd, eta, car_no, ship_no, clearance_res_status, declare_res_status, dest_country, dest_country_name, trans_weight, pack_num, 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 a
where a.batch_no = #{batchNo}
</select>
<!-- 打提成标识 -->
<update id="updateHasDoProfit" parameterType="String">
update emis_tms_site_batch set
bl_profit = '1'
where batch_no=#{batchNo}
</update>
<!-- 更新录入状态 -->
<update id="updateEnteringStatus" parameterType="String">
update emis_tms_site_batch set
bl_entering = '1'
where batch_no=#{batchNo}
</update>
<insert id="insertEmisTmsSiteBatch" parameterType="EmisTmsSiteBatch" useGeneratedKeys="true" keyProperty="id">
insert into emis_tms_site_batch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="batchNo != null and batchNo != ''">batch_no,</if>
<if test="batchName != null and batchName != ''">batch_name,</if>
<if test="batchDate != null">batch_date,</if>
<if test="supplierCode != null and supplierCode != ''">supplier_code,</if>
<if test="supplierName != null and supplierName != ''">supplier_name,</if>
<if test="transLineType != null and transLineType != ''">trans_line_type,</if>
<if test="productType != null and productType != ''">product_type,</if>
<if test="batchType != null and batchType != ''">batch_type,</if>
<if test="transType != null and transType != ''">trans_type,</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code,</if>
<if test="sendCountry != null and sendCountry != ''">send_country,</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code,</if>
<if test="airBilllNo != null and airBilllNo != ''">air_billl_no,</if>
<if test="etd != null">etd,</if>
<if test="eta != null">eta,</if>
<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>
<if test="destCountry != null and destCountry != ''">dest_country,</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name,</if>
<if test="transWeight != null">trans_weight,</if>
<if test="packNum != null">pack_num,</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>
<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="batchNo != null and batchNo != ''">#{batchNo},</if>
<if test="batchName != null and batchName != ''">#{batchName},</if>
<if test="batchDate != null">#{batchDate},</if>
<if test="supplierCode != null and supplierCode != ''">#{supplierCode},</if>
<if test="supplierName != null and supplierName != ''">#{supplierName},</if>
<if test="transLineType != null and transLineType != ''">#{transLineType},</if>
<if test="productType != null and productType != ''">#{productType},</if>
<if test="batchType != null and batchType != ''">#{batchType},</if>
<if test="transType != null and transType != ''">#{transType},</if>
<if test="startSiteCode != null and startSiteCode != ''">#{startSiteCode},</if>
<if test="sendCountry != null and sendCountry != ''">#{sendCountry},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">#{nextSiteCode},</if>
<if test="airBilllNo != null and airBilllNo != ''">#{airBilllNo},</if>
<if test="etd != null">#{etd},</if>
<if test="eta != null">#{eta},</if>
<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>
<if test="destCountry != null and destCountry != ''">#{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">#{destCountryName},</if>
<if test="transWeight != null">#{transWeight},</if>
<if test="packNum != null">#{packNum},</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>
<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="updateEmisTmsSiteBatch" parameterType="EmisTmsSiteBatch">
update emis_tms_site_batch
<trim prefix="SET" suffixOverrides=",">
<if test="batchNo != null and batchNo != ''">batch_no = #{batchNo},</if>
<if test="batchName != null and batchName != ''">batch_name = #{batchName},</if>
<if test="batchDate != null">batch_date = #{batchDate},</if>
<if test="supplierCode != null and supplierCode != ''">supplier_code = #{supplierCode},</if>
<if test="supplierName != null and supplierName != ''">supplier_name = #{supplierName},</if>
<if test="transLineType != null and transLineType != ''">trans_line_type = #{transLineType},</if>
<if test="productType != null and productType != ''">product_type = #{productType},</if>
<if test="batchType != null and batchType != ''">batch_type = #{batchType},</if>
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
<if test="startSiteCode != null and startSiteCode != ''">start_site_code = #{startSiteCode},</if>
<if test="sendCountry != null and sendCountry != ''">send_country = #{sendCountry},</if>
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
<if test="airBilllNo != null and airBilllNo != ''">air_billl_no = #{airBilllNo},</if>
<if test="etd != null">etd = #{etd},</if>
<if test="eta != null">eta = #{eta},</if>
<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>
<if test="destCountry != null and destCountry != ''">dest_country = #{destCountry},</if>
<if test="destCountryName != null and destCountryName != ''">dest_country_name = #{destCountryName},</if>
<if test="transWeight != null">trans_weight = #{transWeight},</if>
<if test="packNum != null">pack_num = #{packNum},</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>
<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="deleteEmisTmsSiteBatchById" parameterType="Long">
update emis_tms_site_batch set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisTmsSiteBatchByIds" parameterType="String">
update emis_tms_site_batch set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 根据运单号列表查询组批次信息 -->
<select id="selectEmisTmsSiteBatchListByBillCodes" resultMap="EmisTmsSiteBatchDtlResult">
select distinct b.id, b.batch_no, b.supplier_code, b.trans_line_type, b.product_type, b.trans_type, b.start_site_code, b.next_site_code, b.etd
from emis_tms_site_batch b
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
where d.bill_code in
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
#{billCode}
</foreach>
and b.del_flag = '0'
and d.del_flag = '0'
</select>
</mapper>