<?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> </mapper>