ShipmentHeaderMapper.xml 2.61 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.project.shipment.shipmentHeader.mapper.ShipmentHeaderMapper">

    <insert id="HeaderToHistory" parameterType="string">
        INSERT INTO shipment_header_history (
            code,warehouseCode,companyId,sourceCode,sourcePlatform,shipmentTypeId,shipTo,priority,station,totalQty,
            totalLines,remark,uploadremark,uploadTime,appointmentTime,firstStatus,lastStatus,uploadStatus,created,
            createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
        SELECT
            code,warehouseCode,companyId,sourceCode,sourcePlatform,shipmentTypeId,shipTo,priority,station,totalQty,
            totalLines,remark,uploadremark,uploadTime,appointmentTime,firstStatus,lastStatus,uploadStatus,created,
            createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
        FROM shipment_header WHERE code = #{code,jdbcType=VARCHAR}
    </insert>

    <insert id="DetailToHistory" parameterType="string">
         INSERT INTO shipment_detail_history (
            sourceLine,shipmentCode,materialCode,batch,lot,project,manufactureDate,agingDate,inventoryStatus,qty,
            price,created,createdBy,lastUpdated,lastUpdatedBy,enable,deleted,userDef1,userDef2,userDef3)
         SELECT
            sourceLine,shipmentCode,materialCode,batch,lot,project,manufactureDate,agingDate,inventoryStatus,qty,
            price,created,createdBy,lastUpdated,lastUpdatedBy,enable,1,userDef1,userDef2,userDef3
         FROM shipment_detail WHERE shipmentCode = #{code,jdbcType=VARCHAR}
    </insert>

    <select id="list" resultType="com.huaheng.project.shipment.shipmentHeader.domain.ShipmentHeader">
        select * from shipment_header
        <where>
            <if test="shipmentCode != null">
                and code = #{shipmentCode}
            </if>
            <if test="shipmentType != 0">
                and shipmentTypeId = #{shipmentType}
            </if>
            <if test="company != 0">
                and companyId = #{company}
            </if>
            <if test="firstStatus != null">
                and firstStatus = #{firstStatus}
            </if>
            <if test="lastStatus != null">
                and lastStatus = #{lastStatus}
            </if>
            <if test="beginTime != null">
                and created &gt;= #{beginTime}
            </if>
            <if test="endTime != null">
                and created &lt;= #{endTime}
            </if>
        </where>
    </select>
    
</mapper>