ShipmentContainerHeaderMapper.xml 7.7 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.pc.shipment.shipmentContainerHeader.mapper.ShipmentContainerHeaderMapper">

    <select id="getShipmentContainerMaxAndMinStatusByShipmentID" resultType="java.util.Map">
        SELECT MAX(`status`) maxStatus , MIN(`status`) minStatus from shipment_container_header t join shipment_container_detail b on t.id = b.headerId
          WHERE  b.shipmentHeaderId = #{shipmentId}
    </select>

    <select id="getShipmentContainerHeaderByContainerCode"
            resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
        SELECT * from shipment_container_header where shipmentContainerCode = #{containerCode} and `status` &lt; 30 limit 1
    </select>

    <select id="listShipmentHeaders" resultType="com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader">
        SELECT id, code, warehouseId, warehouseCode, companyId, companyCode, sourceCode, sourcePlatform, type, shipTo,
        priority, station, totalQty, totalLines, remark, uploadremark, uploadTime, appointmentTime, firstStatus,
        lastStatus, uploadStatus, created, createdBy, lastUpdated, lastUpdatedBy, enable, userDef1, userDef2, userDef3
        FROM shipment_header
        <where>
            <if test="id != null">
                AND id = #{id}
            </if>
            <if test="code != null">
                AND code = #{code}
            </if>
            <if test="warehouseId != null">
                AND warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null">
                AND warehouseCode = #{warehouseCode}
            </if>
            <if test="companyId != null">
                AND companyId = #{companyId}
            </if>
            <if test="companyCode != null">
                AND companyCode = #{companyCode}
            </if>
            <if test="sourceCode != null">
                AND sourceCode = #{sourceCode}
            </if>
            <if test="sourcePlatform != null">
                AND sourcePlatform = #{sourcePlatform}
            </if>
            <if test="type != null">
                AND type = #{type}
            </if>
            <if test="shipTo != null">
                AND shipTo = #{shipTo}
            </if>
            <if test="priority != null">
                AND priority = #{priority}
            </if>
            <if test="station != null">
                AND station = #{station}
            </if>
            <if test="totalQty != null">
                AND totalQty = #{totalQty}
            </if>
            <if test="totalLines != null">
                AND totalLines = #{totalLines}
            </if>
            <if test="remark != null">
                AND remark = #{remark}
            </if>
            <if test="uploadremark != null">
                AND uploadremark = #{uploadremark}
            </if>
            <if test="uploadTime != null">
                AND uploadTime = #{uploadTime}
            </if>
            <if test="appointmentTime != null">
                AND appointmentTime = #{appointmentTime}
            </if>
            <if test="firstStatus != null">
                AND firstStatus &lt;= #{firstStatus}
            </if>
            <if test="lastStatus != null">
                AND lastStatus >= #{lastStatus}
            </if>
            <if test="uploadStatus != null">
                AND uploadStatus = #{uploadStatus}
            </if>
            <if test="created != null">
                AND created = #{created}
            </if>
            <if test="createdBy != null">
                AND createdBy = #{createdBy}
            </if>
            <if test="lastUpdated != null">
                AND lastUpdated = #{lastUpdated}
            </if>
            <if test="lastUpdatedBy != null">
                AND lastUpdatedBy = #{lastUpdatedBy}
            </if>
            <if test="enable != null">
                AND enable = #{enable}
            </if>
            <if test="userDef1 != null">
                AND userDef1 = #{userDef1}
            </if>
            <if test="userDef2 != null">
                AND userDef2 = #{userDef2}
            </if>
            <if test="userDef3 != null">
                AND userDef3 = #{userDef3}
            </if>
            <if test="sectionStartTime != null">
                AND created >= #{sectionStartTime}
            </if>
            <if test="sectionEndTime != null">
                AND created &lt;= #{sectionEndTime}
            </if>
        </where>
    </select>

    <select id="getShipmentContainerHeaders" resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
        SELECT id, shipmentContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
        FROM shipment_container_header
        <where>
            <if test="id != null">
                AND id = #{id}
            </if>
            <if test="shipmentContainerCode != null">
                AND shipmentContainerCode = #{shipmentContainerCode}
            </if>
            <if test="warehouseId != null">
                AND warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null">
                AND warehouseCode = #{warehouseCode}
            </if>
            <if test="taskType != null">
                AND taskType = #{taskType}
            </if>
            <if test="status != null">
                AND status = #{status}
            </if>
            <if test="created != null">
                AND created = #{created}
            </if>
            <if test="createdBy != null">
                AND createdBy = #{createdBy}
            </if>
            <if test="sectionStartTime != null">
                AND created >= #{sectionStartTime}
            </if>
            <if test="sectionEndTime != null">
                AND created &lt;= #{sectionEndTime}
            </if>
        </where>
    </select>

    <select id="selectUnCompletedShipmentContainer"  resultType="com.huaheng.pc.shipment.shipmentContainerHeader.domain.ShipmentContainerHeader">
        SELECT id, shipmentContainerCode, warehouseId, warehouseCode, taskType, status, created, createdBy
        FROM shipment_container_header
        <where>
            AND status &lt; 20
            <if test="id != null ">
                AND id = #{id}
            </if>
            <if test="shipmentContainerCode != null and shipmentContainerCode != ''">
                <bind name="shipmentContainerCodePattern" value="'%' + shipmentContainerCode + '%'" />
                AND shipmentContainerCode like #{shipmentContainerCodePattern}
            </if>
            <if test="warehouseId != null ">
                AND warehouseId = #{warehouseId}
            </if>
            <if test="warehouseCode != null and warehouseCode != ''">
                <bind name="warehouseCodePattern" value="'%' + warehouseCode + '%'" />
                AND warehouseCode like #{warehouseCodePattern}
            </if>
            <if test="taskType != null ">
                AND taskType = #{taskType}
            </if>
            <if test="params != null and params.createdBegin != null and params.createdBegin != ''">
                AND created &gt;= #{params.createdBegin}
            </if>
            <if test="params != null and params.createdEnd != null and params.createdEnd != ''">
                AND created &lt;= #{params.createdEnd}
            </if>
            <if test="createdBy != null and createdBy != ''">
                <bind name="createdByPattern" value="'%' + createdBy + '%'" />
                AND createdBy like #{createdByPattern}
            </if>
        </where>
    </select>

</mapper>