ShipmentHeaderMapper.xml 7.16 KB
<?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.huaheng.shipment.shipmentHeader.mapper.ShipmentHeaderMapper">
  <resultMap id="BaseResultMap" type="com.huaheng.shipment.api.domain.ShipmentHeader">
    <!--@mbg.generated-->
    <!--@Table shipment_header-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="referCode" jdbcType="VARCHAR" property="referCode" />
    <result column="referCodeType" jdbcType="VARCHAR" property="referCodeType" />
    <result column="referId" jdbcType="INTEGER" property="referId" />
    <result column="referLineId" jdbcType="INTEGER" property="referLineId" />
    <result column="referPlatform" jdbcType="VARCHAR" property="referPlatform" />
    <result column="firstStatus" jdbcType="INTEGER" property="firstStatus" />
    <result column="lastStatus" jdbcType="INTEGER" property="lastStatus" />
    <result column="shipmentType" jdbcType="VARCHAR" property="shipmentType" />
    <result column="route" jdbcType="VARCHAR" property="route" />
    <result column="customerCode" jdbcType="VARCHAR" property="customerCode" />
    <result column="customerName" jdbcType="VARCHAR" property="customerName" />
    <result column="priority" jdbcType="INTEGER" property="priority" />
    <result column="requestedDeliveryDate" jdbcType="DATE" property="requestedDeliveryDate" />
    <result column="scheduledShipDate" jdbcType="DATE" property="scheduledShipDate" />
    <result column="actualShipDateTime" jdbcType="TIMESTAMP" property="actualShipDateTime" />
    <result column="actualDeliveryDate" jdbcType="DATE" property="actualDeliveryDate" />
    <result column="deliveryNote" jdbcType="VARCHAR" property="deliveryNote" />
    <result column="rejectionNote" jdbcType="VARCHAR" property="rejectionNote" />
    <result column="waveId" jdbcType="INTEGER" property="waveId" />
    <result column="shipDock" jdbcType="VARCHAR" property="shipDock" />
    <result column="allocateComplete" jdbcType="INTEGER" property="allocateComplete" />
    <result column="totalWeight" jdbcType="DECIMAL" property="totalWeight" />
    <result column="totalQty" jdbcType="DECIMAL" property="totalQty" />
    <result column="totalVolume" jdbcType="DECIMAL" property="totalVolume" />
    <result column="totalLines" jdbcType="INTEGER" property="totalLines" />
    <result column="processType" jdbcType="VARCHAR" property="processType" />
    <result column="lastWaveId" jdbcType="INTEGER" property="lastWaveId" />
    <result column="signValue" jdbcType="VARCHAR" property="signValue" />
    <result column="carrierCode" jdbcType="VARCHAR" property="carrierCode" />
    <result column="carrierService" jdbcType="VARCHAR" property="carrierService" />
    <result column="shipmentNote" jdbcType="VARCHAR" property="shipmentNote" />
    <result column="carrierServer" jdbcType="VARCHAR" property="carrierServer" />
    <result column="carrierServerName" jdbcType="VARCHAR" property="carrierServerName" />
    <result column="plateNumber" jdbcType="VARCHAR" property="plateNumber" />
    <result column="carModel" jdbcType="VARCHAR" property="carModel" />
    <result column="driverName" jdbcType="VARCHAR" property="driverName" />
    <result column="driverTel" jdbcType="VARCHAR" property="driverTel" />
    <result column="created" jdbcType="TIMESTAMP" property="created" />
    <result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
    <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
    <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
    <result column="version" jdbcType="INTEGER" property="version" />
    <result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
    <result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
    <result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
    <result column="processStamp" jdbcType="VARCHAR" property="processStamp" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, warehouseCode, companyCode, code, referCode, referCodeType, referId, referLineId, 
    referPlatform, firstStatus, lastStatus, shipmentType, route, customerCode, customerName, 
    priority, requestedDeliveryDate, scheduledShipDate, actualShipDateTime, actualDeliveryDate, 
    deliveryNote, rejectionNote, waveId, shipDock, allocateComplete, totalWeight, totalQty, 
    totalVolume, totalLines, processType, lastWaveId, signValue, carrierCode, carrierService, 
    shipmentNote, carrierServer, carrierServerName, plateNumber, carModel, driverName, 
    driverTel, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2, 
    userDef3, processStamp, deleted
  </sql>
  <select id="createCode" resultType="java.lang.String">
        SELECT code FROM shipment_header WHERE shipmentType = #{shipmentType,jdbcType=VARCHAR} ORDER BY id DESC LIMIT 1
    </select>

  <select id="selectListByCreated" resultType="com.huaheng.shipment.api.domain.ShipmentHeader">
    SELECT  s.* from shipment_header s
    inner join task_detail t on t.billCode=s.code and
    t.status>700 and DATEDIFF(NOW(), t.lastUpdated)=0 GROUP BY s.code
    </select>

  <select id="getLatestShipment" resultType="com.huaheng.shipment.api.domain.ShipmentHeader">
     select id, warehouseCode, companyCode, code, referCode, referCodeType, referId, referLineId,
    referPlatform, firstStatus, lastStatus, shipmentType, route, customerCode, customerName,
    priority, requestedDeliveryDate, scheduledShipDate, actualShipDateTime, actualDeliveryDate,
    deliveryNote, rejectionNote, waveId, shipDock, allocateComplete, totalWeight, totalQty,
    totalVolume, totalLines, processType, lastWaveId, signValue, carrierCode, carrierService,
    shipmentNote, carrierServer, carrierServerName, plateNumber, carModel, driverName,
    driverTel, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2,
    userDef3, processStamp, deleted from shipment_header order by id desc  limit 10
  </select>

    <select id="newQueryDayShipmentHeader" resultType="com.huaheng.shipment.api.domain.ShipmentHeader">
    SELECT id, warehouseCode, companyCode, code, referCode, referCodeType, referId, referLineId,
    referPlatform, firstStatus, lastStatus, shipmentType, route, customerCode, customerName,
    priority, requestedDeliveryDate, scheduledShipDate, actualShipDateTime, actualDeliveryDate,
    deliveryNote, rejectionNote, waveId, shipDock, allocateComplete, totalWeight, totalQty,
    totalVolume, totalLines, processType, lastWaveId, signValue, carrierCode, carrierService,
    shipmentNote, carrierServer, carrierServerName, plateNumber, carModel, driverName,
    driverTel, created, createdBy, lastUpdated, lastUpdatedBy, version, userDef1, userDef2,
    userDef3, processStamp, deleted
    FROM shipment_header
    WHERE to_days(created) = to_days(now()) AND firstStatus = 0
    GROUP BY id DESC
    LIMIT 1
    </select>


</mapper>