ShipmentDetailHistoryMapper.xml 4.67 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.shipmentDetailHistory.mapper.ShipmentDetailHistoryMapper">
  <resultMap id="BaseResultMap" type="com.huaheng.pc.shipment.shipmentDetailHistory.domain.ShipmentDetailHistory">
    <!--@mbg.generated-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="shipmentId" jdbcType="INTEGER" property="shipmentId" />
    <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
    <result column="shipmentCode" jdbcType="VARCHAR" property="shipmentCode" />
    <result column="referCode" jdbcType="VARCHAR" property="referCode" />
    <result column="referId" jdbcType="INTEGER" property="referId" />
    <result column="referLineNum" jdbcType="VARCHAR" property="referLineNum" />
    <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="shipQty" jdbcType="INTEGER" property="shipQty" />
    <result column="requestQty" jdbcType="INTEGER" property="requestQty" />
    <result column="allocationRule" jdbcType="VARCHAR" property="allocationRule" />
    <result column="replenishmentRule" jdbcType="VARCHAR" property="replenishmentRule" />
    <result column="pickLocs" jdbcType="VARCHAR" property="pickLocs" />
    <result column="attribute1" jdbcType="VARCHAR" property="attribute1" />
    <result column="attribute2" jdbcType="VARCHAR" property="attribute2" />
    <result column="attribute3" jdbcType="VARCHAR" property="attribute3" />
    <result column="attribute4" jdbcType="VARCHAR" property="attribute4" />
    <result column="batch" jdbcType="VARCHAR" property="batch" />
    <result column="lot" jdbcType="VARCHAR" property="lot" />
    <result column="projectNo" jdbcType="VARCHAR" property="projectNo" />
    <result column="manufactureDate" jdbcType="DATE" property="manufactureDate" />
    <result column="expirationDate" jdbcType="DATE" property="expirationDate" />
    <result column="agingDate" jdbcType="DATE" property="agingDate" />
    <result column="inventorySts" jdbcType="VARCHAR" property="inventorySts" />
    <result column="dockLoc" jdbcType="VARCHAR" property="dockLoc" />
    <result column="packingClass" jdbcType="VARCHAR" property="packingClass" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="waveId" jdbcType="INTEGER" property="waveId" />
    <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" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, shipmentId, warehouseCode, companyCode, shipmentCode, referCode, referId, referLineNum, 
    materialCode, materialName, materialSpec, materialUnit, shipQty, requestQty, allocationRule, 
    replenishmentRule, pickLocs, attribute1, attribute2, attribute3, attribute4, batch, 
    lot, projectNo, manufactureDate, expirationDate, agingDate, inventorySts, dockLoc, 
    packingClass, `enable`, waveId, created, createdBy, lastUpdated, lastUpdatedBy, version, 
    userDef1, userDef2, userDef3,processStamp
  </sql>

  <select id="SelectFirstStatus" resultType="java.util.Map">
        SELECT h.id, h.firstStatus
        FROM shipment_header_history h
        INNER JOIN shipment_detail_history d ON h.id = d.shipmentId AND d.id IN (#{ids})
        GROUP BY h.id,firstStatus
    </select>

  <delete id="batchDelete">
    DELETE FROM shipment_detail_history WHERE id IN
    <foreach item="idItem" collection="array" open="(" separator="," close=")">
      #{idItem}
    </foreach>
  </delete>

  <select id="StatisticalByReceiptId" resultType="java.util.Map">
       SELECT count(*) as 'totalLines',sum(shipQty) as 'totalQty'
       FROM shipment_detail_history
       WHERE shipmentId=#{headerId}
    </select>

</mapper>