<?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.shipmentDetail.mapper.ShipmentDetailMapper"> <select id="SelectFirstStatus" resultType="java.util.Map"> SELECT h.id, h.firstStatus FROM shipment_header h INNER JOIN shipment_detail d ON h.id = d.shipmentId AND d.id IN (#{ids}) GROUP BY h.id,firstStatus </select> <delete id="batchDelete"> DELETE FROM shipment_detail WHERE id IN <foreach item="idItem" collection="array" open="(" separator="," close=")"> #{idItem} </foreach> </delete> <select id="countUnCompleted" resultType="java.lang.Integer"> SELECT COUNT(*) FROM shipment_detail WHERE shipmentId=#{shipmentId} AND qty>qtyCompleted </select> <select id="getShipmentDetailListByLike" resultType="com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail"> SELECT d.id,d.warehouseId,d.warehouseCode,d.companyId,d.companyCode,d.sourceCode,d.sourceLine,d.shipmentId,d.shipmentCode, d.materialId,d.materialCode,d.batch,d.lot,d.project,d.manufactureDate,d.expirationDate,d.agingDate,d.inventoryStatus,d.qty,d.qtyCompleted, d.price,d.status,d.created,d.createdBy,d.lastUpdated,d.lastUpdatedBy,d.deleted,d.userDef1,d.userDef2,d.userDef3, m.name as materialName, m.specification FROM shipment_detail d INNER JOIN material m ON d.materialCode = m.code AND d.warehouseId = m.warehouseId AND d.deleted = FALSE AND m.deleted = FALSE <if test="id != null "> AND d.id = #{id} </if> <if test="warehouseId != null "> AND d.warehouseId = #{warehouseId} </if> <if test="warehouseCode != null and warehouseCode != ''"> <bind name="warehouseCodePattern" value="'%' + warehouseCode + '%'" /> AND d.warehouseCode like #{warehouseCodePattern} </if> <if test="sourceLine != null and sourceLine != ''"> <bind name="sourceLinePattern" value="'%' + sourceLine + '%'" /> AND d.sourceLine like #{sourceLinePattern} </if> <if test="shipmentId != null "> AND d.shipmentId = #{shipmentId} </if> <if test="shipmentCode != null and shipmentCode != ''"> <bind name="shipmentCodePattern" value="'%' + shipmentCode + '%'" /> AND d.shipmentCode like #{shipmentCodePattern} </if> <if test="materialId != null "> AND d.materialId = #{materialId} </if> <if test="materialCode != null and materialCode != ''"> <bind name="materialCodePattern" value="'%' + materialCode + '%'" /> AND d.materialCode like #{materialCodePattern} </if> <if test="batch != null and batch != ''"> <bind name="batchPattern" value="'%' + batch + '%'" /> AND d.batch like #{batchPattern} </if> <if test="lot != null and lot != ''"> <bind name="lotPattern" value="'%' + lot + '%'" /> AND d.lot like #{lotPattern} </if> <if test="project != null and project != ''"> <bind name="projectPattern" value="'%' + project + '%'" /> AND d.project like #{projectPattern} </if> <if test="params != null and params.manufactureDateBegin != null and params.manufactureDateBegin != ''"> AND d.manufactureDate >= #{params.manufactureDateBegin} </if> <if test="params != null and params.manufactureDateEnd != null and params.manufactureDateEnd != ''"> AND d.manufactureDate <= #{params.manufactureDateEnd} </if> <if test="params != null and params.expirationDateBegin != null and params.expirationDateBegin != ''"> AND d.expirationDate >= #{params.expirationDateBegin} </if> <if test="params != null and params.expirationDateEnd != null and params.expirationDateEnd != ''"> AND d.expirationDate <= #{params.expirationDateEnd} </if> <if test="inventoryStatus != null and inventoryStatus != ''"> <bind name="inventoryStatusPattern" value="'%' + inventoryStatus + '%'" /> AND d.inventoryStatus like #{inventoryStatusPattern} </if> <if test="qty != null "> AND d.qty = #{qty} </if> <if test="qtyCompleted != null "> AND d.qtyCompleted = #{qtyCompleted} </if> <if test="price != null "> AND d.price = #{price} </if> <if test="status != null "> AND d.status = #{status} </if> <if test="params != null and params.createdBegin != null and params.createdBegin != ''"> AND d.created >= #{params.createdBegin} </if> <if test="params != null and params.createdEnd != null and params.createdEnd != ''"> AND d.created <= #{params.createdEnd} </if> <if test="createdBy != null and createdBy != ''"> <bind name="createdByPattern" value="'%' + createdBy + '%'" /> AND d.createdBy like #{createdByPattern} </if> <if test="params != null and params.lastUpdatedBegin != null and params.lastUpdatedBegin != ''"> AND d.lastUpdated >= #{params.lastUpdatedBegin} </if> <if test="params != null and params.lastUpdatedEnd != null and params.lastUpdatedEnd != ''"> AND d.lastUpdated <= #{params.lastUpdatedEnd} </if> <if test="lastUpdatedBy != null and lastUpdatedBy != ''"> <bind name="lastUpdatedByPattern" value="'%' + lastUpdatedBy + '%'" /> AND d.lastUpdatedBy like #{lastUpdatedByPattern} </if> <if test="deleted != null "> AND d.deleted = #{deleted} </if> <if test="userDef1 != null and userDef1 != ''"> <bind name="userDef1Pattern" value="'%' + userDef1 + '%'" /> AND d.userDef1 like #{userDef1Pattern} </if> <if test="userDef2 != null and userDef2 != ''"> <bind name="userDef2Pattern" value="'%' + userDef2 + '%'" /> AND d.userDef2 like #{userDef2Pattern} </if> <if test="userDef3 != null and userDef3 != ''"> <bind name="userDef3Pattern" value="'%' + userDef3 + '%'" /> AND d.userDef3 like #{userDef3Pattern} </if> </select> <select id="StatisticalByReceiptId" resultType="java.util.Map"> SELECT count(*) as 'totalLines',sum(qty) as 'totalQty' FROM shipment_detail WHERE shipmentId=#{receiptId} and deleted=FALSE </select> <insert id="insertModel"> INSERT INTO icsshipment_detail <trim prefix="(" suffix=")" suffixOverrides=","> <if test="cCode != null"> cCode, </if> <if test="ID != null"> ID, </if> <if test="AutoID != null"> AutoID, </if> <if test="irowno != null"> irowno, </if> <if test="cItemName != null"> cItemName, </if> <if test="DLID != null"> DLID, </if> <if test="cSOCode != null"> cSOCode, </if> <if test="cSOID != null"> cSOID, </if> <if test="cSOAutoID != null"> cSOAutoID, </if> <if test="MoId != null"> MoId, </if> <if test="MoCode != null"> MoCode, </if> <if test="MoDId != null"> MoDId, </if> <if test="SortSeq != null"> SortSeq, </if> <if test="cWHCode != null"> cWHCode, </if> <if test="cWHName != null"> cWHName, </if> <if test="cInvCode != null"> cInvCode, </if> <if test="cInvName != null"> cInvName, </if> <if test="cInvStd != null"> cInvStd, </if> <if test="iQuantity != null"> iQuantity, </if> <if test="cQuantity != null"> cQuantity, </if> <if test="cComUnitName != null"> cComUnitName, </if> <if test="StartDate != null"> StartDate, </if> <if test="DueDate != null"> DueDate, </if> <if test="CompanyCode != null"> CompanyCode, </if> <if test="cModifyDate != null"> cModifyDate, </if> <if test="cMemo != null"> cMemo, </if> <if test="iMaIDs != null"> iMaIDs, </if> <if test="POCode != null"> POCode, </if> <if test="POID != null"> POID, </if> <if test="PODID != null"> PODID, </if> <if test="iTrIds != null"> iTrIds, </if> <if test="iDLsID != null"> iDLsID, </if> <if test="iArrsId != null"> iArrsId, </if> <if test="iPOsID != null"> iPOsID, </if> </trim> <trim prefix=" values (" suffix=")" suffixOverrides=","> <if test="cCode != null"> #{cCode, jdbcType=VARCHAR}, </if> <if test="ID != null"> #{ID, jdbcType=INTEGER}, </if> <if test="AutoID != null"> #{AutoID, jdbcType=INTEGER}, </if> <if test="irowno != null"> #{irowno, jdbcType=INTEGER}, </if> <if test="cItemName != null"> #{cItemName, jdbcType=VARCHAR}, </if> <if test="DLID != null"> #{DLID, jdbcType=INTEGER}, </if> <if test="cSOCode != null"> #{cSOCode, jdbcType=VARCHAR}, </if> <if test="cSOID != null"> #{cSOID, jdbcType=INTEGER}, </if> <if test="cSOAutoID != null"> #{cSOAutoID, jdbcType=INTEGER}, </if> <if test="MoId != null"> #{MoId, jdbcType=INTEGER}, </if> <if test="MoDId != null"> #{MoDId, jdbcType=INTEGER}, </if> <if test="MoCode != null"> #{MoCode, jdbcType=VARCHAR}, </if> <if test="SortSeq != null"> #{SortSeq, jdbcType=INTEGER}, </if> <if test="cWHCode != null"> #{cWHCode, jdbcType=VARCHAR}, </if> <if test="cWHName != null"> #{cWHName, jdbcType=VARCHAR}, </if> <if test="cInvCode != null"> #{cInvCode, jdbcType=VARCHAR}, </if> <if test="cInvName != null"> #{cInvName, jdbcType=VARCHAR}, </if> <if test="cInvStd != null"> #{cInvStd, jdbcType=VARCHAR}, </if> <if test="iQuantity != null"> #{iQuantity, jdbcType=DECIMAL}, </if> <if test="cQuantity != null"> #{cQuantity, jdbcType=DECIMAL}, </if> <if test="cComUnitName != null"> #{cComUnitName, jdbcType=VARCHAR}, </if> <if test="StartDate != null"> #{StartDate, jdbcType=DATETIME}, </if> <if test="DueDate != null"> #{DueDate, jdbcType=DATETIME}, </if> <if test="CompanyCode != null"> #{CompanyCode, jdbcType=VARCHAR}, </if> <if test="cModifyDate != null"> #{cModifyDate, jdbcType=DATETIME}, </if> <if test="cMemo != null"> #{cMemo, jdbcType=VARCHAR}, </if> <if test="iMaIDs != null"> #{iMaIDs, jdbcType=INTEGER}, </if> <if test="POCode != null"> #{POCode, jdbcType=VARCHAR}, </if> <if test="POID != null"> #{POID, jdbcType=INTEGER}, </if> <if test="PODID != null"> #{PODID, jdbcType=INTEGER}, </if> <if test="iTrIds != null"> #{iTrIds, jdbcType=INTEGER}, </if> <if test="iDLsID != null"> #{iDLsID, jdbcType=INTEGER}, </if> <if test="iArrsId != null"> #{iArrsId, jdbcType=INTEGER}, </if> <if test="iPOsID != null"> #{iPOsID, jdbcType=INTEGER}, </if> </trim> </insert> <select id="selectModel" resultType="com.huaheng.api.U8.domain.ICSShipmentDetail"> SELECT cCode, ID, AutoID,irowno,cItemName, DLID, cSOCode, cSOID, cSOAutoID , MoId, MoDId,MoCode, SortSeq, cWHCode,cWHName,cInvCode,cInvName,cInvStd,iQuantity,cQuantity,cComUnitName,StartDate,DueDate,CompanyCode,cModifyDate,cMemo,iMaIDs, POCode, POID, PODID, iTrIds, iDLsID,iArrsId,iPOsID from icsshipment_detail <where> <if test="cCode != null"> AND cCode = #{cCode} </if> <if test="ID != null"> AND ID = #{ID} </if> <if test="AutoID != null"> AND AutoID = #{AutoID} </if> <if test="cItemName != null"> AND cItemName = #{cItemName} </if> <if test="irowno != null"> AND irowno = #{irowno} </if> <if test="DLID != null"> AND DLID = #{DLID} </if> <if test="cSOCode != null"> AND cSOCode = #{cSOCode} </if> <if test="cSOID != null"> AND cSOID = #{cSOID} </if> <if test="cSOAutoID != null"> AND cSOAutoID = #{cSOAutoID} </if> <if test="MoId != null"> AND MoId = #{MoId} </if> <if test="MoDId != null"> AND MoDId = #{MoDId} </if> <if test="MoCode != null"> AND MoCode = #{MoCode} </if> <if test="SortSeq != null"> AND SortSeq = #{SortSeq} </if> <if test="cWHCode != null"> AND cWHCode = #{cWHCode} </if> <if test="cWHName != null"> AND cWHName = #{cWHName} </if> <if test="cInvCode != null"> AND cInvCode = #{cInvCode} </if> <if test="cInvName != null"> AND cInvName = #{cInvName} </if> <if test="cInvStd != null"> AND cInvStd = #{cInvStd} </if> <if test="iQuantity != null"> AND iQuantity = #{iQuantity} </if> <if test="cQuantity != null"> AND cQuantity = #{cQuantity} </if> <if test="cComUnitName != null"> AND cComUnitName = #{cComUnitName} </if> <if test="StartDate != null"> AND StartDate = #{StartDate} </if> <if test="DueDate != null"> AND DueDate = #{DueDate} </if> <if test="CompanyCode != null"> AND CompanyCode = #{CompanyCode} </if> <if test="cModifyDate != null"> AND cModifyDate = #{cModifyDate} </if> <if test="cMemo != null"> AND cMemo = #{cMemo} </if> <if test="iMaIDs != null"> AND iMaIDs = #{iMaIDs} </if> <if test="POCode != null"> AND POCode = #{POCode} </if> <if test="POID != null"> AND POID = #{POID} </if> <if test="PODID != null"> AND PODID = #{PODID} </if> <if test="iTrIds != null"> AND iTrIds = #{iTrIds} </if> <if test="iDLsID != null"> AND iDLsID = #{iDLsID} </if> <if test="iArrsId != null"> AND iArrsId = #{iArrsId} </if> <if test="iPOsID != null"> AND iPOsID = #{iPOsID} </if> </where> LIMIT 1 </select> <select id="selectList" resultType="com.huaheng.api.U8.domain.ICSShipmentDetail"> SELECT cCode, ID, AutoID,irowno,cItemName, DLID, cSOCode, cSOID, cSOAutoID , MoId, MoDId,MoCode, SortSeq, cWHCode,cWHName,cInvCode,cInvName,cInvStd,iQuantity,cQuantity,cComUnitName,StartDate,DueDate,CompanyCode,cModifyDate,cMemo,iMaIDs, POCode, POID, PODID, iTrIds, iDLsID,iPOsID,iArrsId from icsshipment_detail <where> <if test="cCode != null"> AND cCode = #{cCode} </if> <if test="ID != null"> AND ID = #{ID} </if> <if test="AutoID != null"> AND AutoID = #{AutoID} </if> <if test="cItemName != null"> AND cItemName = #{cItemName} </if> <if test="irowno != null"> AND irowno = #{irowno} </if> <if test="DLID != null"> AND DLID = #{DLID} </if> <if test="cSOCode != null"> AND cSOCode = #{cSOCode} </if> <if test="cSOID != null"> AND cSOID = #{cSOID} </if> <if test="cSOAutoID != null"> AND cSOAutoID = #{cSOAutoID} </if> <if test="MoId != null"> AND MoId = #{MoId} </if> <if test="MoDId != null"> AND MoDId = #{MoDId} </if> <if test="MoCode != null"> AND MoCode = #{MoCode} </if> <if test="SortSeq != null"> AND SortSeq = #{SortSeq} </if> <if test="cWHCode != null"> AND cWHCode = #{cWHCode} </if> <if test="cWHName != null"> AND cWHName = #{cWHName} </if> <if test="cInvCode != null"> AND cInvCode = #{cInvCode} </if> <if test="cInvName != null"> AND cInvName = #{cInvName} </if> <if test="cInvStd != null"> AND cInvStd = #{cInvStd} </if> <if test="iQuantity != null"> AND iQuantity = #{iQuantity} </if> <if test="cQuantity != null"> AND cQuantity = #{cQuantity} </if> <if test="cComUnitName != null"> AND cComUnitName = #{cComUnitName} </if> <if test="StartDate != null"> AND StartDate = #{StartDate} </if> <if test="DueDate != null"> AND DueDate = #{DueDate} </if> <if test="CompanyCode != null"> AND CompanyCode = #{CompanyCode} </if> <if test="cModifyDate != null"> AND cModifyDate = #{cModifyDate} </if> <if test="cMemo != null"> AND cMemo = #{cMemo} </if> <if test="iMaIDs != null"> AND iMaIDs = #{iMaIDs} </if> <if test="POCode != null"> AND POCode = #{POCode} </if> <if test="POID != null"> AND POID = #{POID} </if> <if test="PODID != null"> AND PODID = #{PODID} </if> <if test="iTrIds != null"> AND iTrIds = #{iTrIds} </if> <if test="iDLsID != null"> AND iDLsID = #{iDLsID} </if> <if test="iArrsId != null"> AND iArrsId = #{iArrsId} </if> <if test="iPOsID != null"> AND iPOsID = #{iPOsID} </if> </where> </select> </mapper>