SnapshotInventoryDetailMapper.xml 6.02 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.inventory.snapshotInventoryDetail.mapper.SnapshotInventoryDetailMapper">

    <resultMap id="BaseResultMap"
               type="com.huaheng.pc.inventory.snapshotInventoryDetail.domain.SnapshotInventoryDetail">
        <!--@mbg.generated-->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="inventoryHeaderId" jdbcType="INTEGER" property="inventoryHeaderId"/>
        <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode"/>
        <result column="companyCode" jdbcType="VARCHAR" property="companyCode"/>
        <result column="locationCode" jdbcType="VARCHAR" property="locationCode"/>
        <result column="containerCode" jdbcType="VARCHAR" property="containerCode"/>
        <result column="materialCode" jdbcType="VARCHAR" property="materialCode"/>
        <result column="materialName" jdbcType="VARCHAR" property="materialName"/>
        <result column="materialSpec" jdbcType="VARCHAR" property="materialSpec"/>
        <result column="materialUnit" jdbcType="VARCHAR" property="materialUnit"/>
        <result column="qty" jdbcType="DECIMAL" property="qty"/>
        <result column="taskQty" jdbcType="DECIMAL" property="taskQty"/>
        <result column="lockedQty" jdbcType="DECIMAL" property="lockedQty"/>
        <result column="inventorySts" jdbcType="VARCHAR" property="inventorySts"/>
        <result column="supplierCode" jdbcType="VARCHAR" property="supplierCode"/>
        <result column="referCode" jdbcType="VARCHAR" property="referCode"/>
        <result column="referDetailId" jdbcType="VARCHAR" property="referDetailId"/>
        <result column="batch" jdbcType="VARCHAR" property="batch"/>
        <result column="lot" jdbcType="VARCHAR" property="lot"/>
        <result column="projectNo" jdbcType="VARCHAR" property="projectNo"/>
        <result column="qcCheck" jdbcType="VARCHAR" property="qcCheck"/>
        <result column="weight" jdbcType="VARCHAR" property="weight"/>
        <result column="manufactureDate" jdbcType="DATE" property="manufactureDate"/>
        <result column="expirationDate" jdbcType="DATE" property="expirationDate"/>
        <result column="agingDate" jdbcType="DATE" property="agingDate"/>
        <result column="attributeId" jdbcType="VARCHAR" property="attributeId"/>
        <result column="attribute1" jdbcType="VARCHAR" property="attribute1"/>
        <result column="attribute2" jdbcType="VARCHAR" property="attribute2"/>
        <result column="attribute3" jdbcType="VARCHAR" property="attribute3"/>
        <result column="lockCode" jdbcType="VARCHAR" property="lockCode"/>
        <result column="lastCycleCountDate" jdbcType="TIMESTAMP" property="lastCycleCountDate"/>
        <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="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="receiptCode" jdbcType="VARCHAR" property="receiptCode"/>
        <result column="receiptDetailId" jdbcType="INTEGER" property="receiptDetailId"/>
    </resultMap>

    <insert id="insertAll" parameterType="SnapshotInventoryDetail">
        INSERT INTO snapshot_inventory_detail(inventoryHeaderId, warehouseCode, companyCode, locationCode,
                                              containerCode, materialCode, materialName, materialSpec, materialUnit,
                                              qty, taskQty, lockedQty, inventorySts, supplierCode, referCode,
                                              referDetailId, batch, lot, projectNo, qcCheck, weight, manufactureDate,
                                              expirationDate, agingDate, attributeId, attribute1, attribute2,
                                              attribute3, lockCode, lastCycleCountDate, createdBy, lastUpdatedBy,
                                              userDef1, userDef2, userDef3, processStamp, receiptCode, receiptDetailId,
                                              created, lastUpdated)
        SELECT inventoryHeaderId,
               warehouseCode,
               companyCode,
               locationCode,
               containerCode,
               materialCode,
               materialName,
               materialSpec,
               materialUnit,
               qty,
               taskQty,
               lockedQty,
               inventorySts,
               supplierCode,
               referCode,
               referDetailId,
               batch,
               lot,
               projectNo,
               qcCheck,
               weight,
               manufactureDate,
               expirationDate,
               agingDate,
               attributeId,
               attribute1,
               attribute2,
               attribute3,
               lockCode,
               lastCycleCountDate,
               createdBy,
               lastUpdatedBy,
               userDef1,
               userDef2,
               userDef3,
               processStamp,
               receiptCode,
               receiptDetailId,
               #{date},
               #{date}
        FROM inventory_detail
    </insert>
    <delete id="deleteSnapshot">
        delete
        from snapshot_inventory_detail
        where id not in (SELECT id FROM inventory_detail)
    </delete>
    <select id="getOne"
            resultType="com.huaheng.pc.inventory.snapshotInventoryDetail.domain.SnapshotInventoryDetail">
        SELECT created FROM snapshot_inventory_detail ORDER BY created desc limit 1
    </select>

</mapper>