Files
nanguangszwlback/mhd_wms/src/main/resources/mapper/receiptMaterialDetail/ReceiptMaterialDetailMapper.xml
T

265 lines
14 KiB
XML

<?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.mhd.wms.domain.receiptMaterialDetail.repository.mapper.ReceiptMaterialDetailMapper">
<resultMap type="com.mhd.wms.domain.receiptMaterialDetail.repository.po.ReceiptMaterialDetailPO" id="ReceiptMaterialDetailResult">
<result property="materialDetailId" column="material_detail_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="uniqueId" column="unique_id" />
<result property="receiptOrderNumber" column="receipt_order_number" />
<result property="materialBaseInfoId" column="material_base_info_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="MATERIAL_NAME" />
<result property="barCode" column="bar_code" />
<result property="specificationModel" column="specification_model" />
<result property="quantity" column="quantity" />
<result property="receiptQuantity" column="receipt_quantity" />
<result property="receiptStatus" column="receipt_status" />
<result property="packId" column="pack_id" />
<result property="packCode" column="pack_code" />
<result property="packName" column="pack_name" />
<result property="packDetailId" column="pack_detail_id" />
<result property="unitCode" column="unit_code" />
<result property="unitName" column="unit_name" />
<result property="unitNumber" column="unit_number" />
<result property="materialWarehouseControlId" column="material_warehouse_control_id" />
<result property="serialNumberManage" column="serial_number_manage" />
<result property="qualityInspectionManage" column="quality_inspection_manage" />
<result property="qualityInspectionStage" column="quality_inspection_stage" />
<result property="qualityInspectionRule" column="quality_inspection_rule" />
<result property="qualityInspectionRatio" column="quality_inspection_ratio" />
<result property="qualityInspectionTerm" column="quality_inspection_term" />
<result property="qualityInspectionResults" column="quality_inspection_results" />
<result property="allowOvercharge" column="allow_overcharge" />
<result property="overchargeRatio" column="overcharge_ratio" />
<result property="batchNumber" column="batch_number" />
<result property="materialStatusCode" column="material_status_code" />
<result property="materialStatusName" column="material_status_name" />
<result property="distributeRuleId" column="distribute_rule_id" />
<result property="distributeRuleCode" column="distribute_rule_code" />
<result property="distributeRuleName" column="distribute_rule_name" />
<result property="containerId" column="container_id" />
<result property="containerCode" column="container_code" />
<result property="containerType" column="container_type" />
<result property="containerTypeName" column="container_type_name" />
<result property="level" column="level" />
<result property="parentUniqueId" column="parent_unique_id" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="genStockShelf" column="gen_stock_shelf" />
<result property="inUniqueId" column="in_unique_id" />
<result property="totalNetWeight" column="total_net_weight" />
<result property="totalGrossWeight" column="total_gross_weight" />
<result property="totalVolume" column="total_volume" />
<result property="totalArea" column="total_area" />
<result property="invoiceNo" column="INVOICE_NO" />
<result property="batchRefNo" column="BATCH_REF_NO" />
<result property="sheetRefNo" column="SHEET_REF_NO" />
<result property="boxPalletNo" column="BOX_PALLET_NO" />
<result property="productionDate" column="PRODUCTION_DATE" />
<result property="expiryDate" column="EXPIRY_DATE" />
<result property="inventoryDate" column="INVENTORY_DATE" />
<result property="extAttr1" column="EXT_ATTR_1" />
<result property="extAttr2" column="EXT_ATTR_2" />
<result property="extAttr3" column="EXT_ATTR_3" />
<result property="extAttr4" column="EXT_ATTR_4" />
</resultMap>
<sql id="selectReceiptMaterialDetailPo">
select a.MATERIAL_DETAIL_ID, a.ORGANIZATION_ID, a.ORGANIZATION_NAME, a.TOP_ORGANIZATION_ID, a.UNIQUE_ID, a.RECEIPT_ORDER_NUMBER, a.MATERIAL_BASE_INFO_ID,
ifnull(a.MATERIAL_CODE, c.MATERIAL_CODE) MATERIAL_CODE,
ifnull(a.MATERIAL_NAME, c.MATERIAL_NAME) MATERIAL_NAME,
a.BAR_CODE,
c.SPECIFICATION_MODEL,
a.QUANTITY, a.ALREADY_RECEIPT_QUANTITY, a.RECEIPT_QUANTITY, a.RECEIPT_STATUS, a.PACK_ID, a.PACK_CODE, a.PACK_NAME, a.PACK_DETAIL_ID, ifnull(a.UNIT_CODE, b.UNIT_CODE) UNIT_CODE, ifnull(a.UNIT_NAME, b.UNIT_NAME) UNIT_NAME, a.UNIT_NUMBER, a.MATERIAL_WAREHOUSE_CONTROL_ID, a.SERIAL_NUMBER_MANAGE, a.QUALITY_INSPECTION_MANAGE, a.QUALITY_INSPECTION_STAGE, a.QUALITY_INSPECTION_RULE, a.QUALITY_INSPECTION_RATIO, a.QUALITY_INSPECTION_TERM, a.QUALITY_INSPECTION_RESULTS, a.ALLOW_OVERCHARGE, a.OVERCHARGE_RATIO, a.BATCH_NUMBER, a.MATERIAL_STATUS_CODE, a.MATERIAL_STATUS_NAME, a.DISTRIBUTE_RULE_ID, a.DISTRIBUTE_RULE_CODE, a.DISTRIBUTE_RULE_NAME, a.CONTAINER_ID, a.CONTAINER_CODE, a.CONTAINER_TYPE, a.CONTAINER_TYPE_NAME, a.LEVEL, a.PARENT_UNIQUE_ID, a.IN_UNIQUE_ID, a.ALLOW_MODIFY, a.REMARK, a.CREATE_TIME, a.CREATE_BY, a.CREATE_BY_NAME, a.UPDATE_TIME, a.UPDATE_BY, a.UPDATE_BY_NAME, a.GEN_STOCK_SHELF, a.DEL_FLAG,
ifnull(a.TOTAL_NET_WEIGHT, b.TOTAL_NET_WEIGHT) TOTAL_NET_WEIGHT,
ifnull(a.TOTAL_GROSS_WEIGHT, b.TOTAL_GROSS_WEIGHT) TOTAL_GROSS_WEIGHT,
ifnull(a.TOTAL_VOLUME, b.TOTAL_VOLUME) TOTAL_VOLUME,
ifnull(a.TOTAL_AREA, b.TOTAL_AREA) TOTAL_AREA,
ifnull(a.INVOICE_NO, b.INVOICE_NO) INVOICE_NO,
ifnull(a.BATCH_REF_NO, b.BATCH_REF_NO) BATCH_REF_NO,
ifnull(a.SHEET_REF_NO, b.SHEET_REF_NO) SHEET_REF_NO,
ifnull(a.BOX_PALLET_NO, b.BOX_PALLET_NO) BOX_PALLET_NO,
ifnull(a.PRODUCTION_DATE, b.PRODUCTION_DATE) PRODUCTION_DATE,
ifnull(a.EXPIRY_DATE, b.EXPIRY_DATE) EXPIRY_DATE,
ifnull(a.INVENTORY_DATE, b.INVENTORY_DATE) INVENTORY_DATE,
ifnull(a.EXT_ATTR_1, b.EXT_ATTR_1) EXT_ATTR_1,
ifnull(a.EXT_ATTR_2, b.EXT_ATTR_2) EXT_ATTR_2,
ifnull(a.EXT_ATTR_3, b.EXT_ATTR_3) EXT_ATTR_3,
ifnull(a.EXT_ATTR_4, b.EXT_ATTR_4) EXT_ATTR_4
from RECEIPT_MATERIAL_DETAIL a
LEFT JOIN IN_MATERIAL_DETAIL b ON a.IN_UNIQUE_ID = b.UNIQUE_ID AND b.DEL_FLAG = 1
LEFT JOIN MATERIAL_BASE_INFO c ON a.MATERIAL_BASE_INFO_ID = c.MATERIAL_BASE_INFO_ID AND c.DEL_FLAG = 1
</sql>
<sql id="selectReceiptMaterialDetailPo1">
<where>
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="uniqueId != null ">
and unique_id = #{uniqueId}
</if>
<if test="receiptOrderNumber != null and receiptOrderNumber != ''">
and RECEIPT_ORDER_NUMBER = #{receiptOrderNumber}
</if>
<if test="materialBaseInfoId != null ">
and MATERIAL_BASE_INFO_ID = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and MATERIAL_CODE = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and MATERIAL_NAME like concat('%', #{materialName}, '%')
</if>
<if test="barCode != null and barCode != ''">
and bar_code = #{barCode}
</if>
<if test="quantity != null ">
and quantity = #{quantity}
</if>
<if test="receiptQuantity != null ">
and receipt_quantity = #{receiptQuantity}
</if>
<if test="receiptStatus != null ">
and receipt_status = #{receiptStatus}
</if>
<if test="packId != null ">
and pack_id = #{packId}
</if>
<if test="packCode != null and packCode != ''">
and pack_code = #{packCode}
</if>
<if test="packName != null and packName != ''">
and pack_name like concat('%', #{packName}, '%')
</if>
<if test="packDetailId != null and packDetailId != ''">
and pack_detail_id = #{packDetailId}
</if>
<if test="unitCode != null and unitCode != ''">
and unit_code = #{unitCode}
</if>
<if test="unitName != null and unitName != ''">
and unit_name like concat('%', #{unitName}, '%')
</if>
<if test="unitNumber != null ">
and unit_number = #{unitNumber}
</if>
<if test="materialWarehouseControlId != null ">
and material_warehouse_control_id = #{materialWarehouseControlId}
</if>
<if test="serialNumberManage != null ">
and serial_number_manage = #{serialNumberManage}
</if>
<if test="qualityInspectionManage != null ">
and quality_inspection_manage = #{qualityInspectionManage}
</if>
<if test="qualityInspectionStage != null ">
and quality_inspection_stage = #{qualityInspectionStage}
</if>
<if test="qualityInspectionRule != null ">
and quality_inspection_rule = #{qualityInspectionRule}
</if>
<if test="qualityInspectionRatio != null ">
and quality_inspection_ratio = #{qualityInspectionRatio}
</if>
<if test="qualityInspectionTerm != null ">
and quality_inspection_term = #{qualityInspectionTerm}
</if>
<if test="qualityInspectionResults != null ">
and quality_inspection_results = #{qualityInspectionResults}
</if>
<if test="allowOvercharge != null ">
and allow_overcharge = #{allowOvercharge}
</if>
<if test="overchargeRatio != null ">
and overcharge_ratio = #{overchargeRatio}
</if>
<if test="batchNumber != null and batchNumber != ''">
and batch_number = #{batchNumber}
</if>
<if test="materialStatusCode != null and materialStatusCode != ''">
and material_status_code = #{materialStatusCode}
</if>
<if test="materialStatusName != null and materialStatusName != ''">
and material_status_name like concat('%', #{materialStatusName}, '%')
</if>
<if test="distributeRuleId != null ">
and distribute_rule_id = #{distributeRuleId}
</if>
<if test="distributeRuleCode != null and distributeRuleCode != ''">
and distribute_rule_code = #{distributeRuleCode}
</if>
<if test="distributeRuleName != null and distributeRuleName != ''">
and distribute_rule_name like concat('%', #{distributeRuleName}, '%')
</if>
<if test="containerId != null ">
and container_id = #{containerId}
</if>
<if test="containerCode != null and containerCode != ''">
and container_code = #{containerCode}
</if>
<if test="containerType != null and containerType != ''">
and container_type = #{containerType}
</if>
<if test="containerTypeName != null and containerTypeName != ''">
and container_type_name like concat('%', #{containerTypeName}, '%')
</if>
<if test="level != null ">
and level = #{level}
</if>
<if test="parentUniqueId != null ">
and parent_unique_id = #{parentUniqueId}
</if>
<if test="createByName != null and createByName != ''">
and create_by_name like concat('%', #{createByName}, '%')
</if>
<if test="updateByName != null and updateByName != ''">
and update_by_name like concat('%', #{updateByName}, '%')
</if>
<if test="genStockShelf != null ">
and gen_stock_shelf = #{genStockShelf}
</if>
<if test="compoundOrQuery != null and compoundOrQuery != ''">
and ( instr(MATERIAL_NAME, #{compoundOrQuery}) > 0
or
instr(MATERIAL_CODE, #{compoundOrQuery}) > 0
or
instr(BAR_CODE, #{compoundOrQuery}) > 0
)
</if>
<if test="receiptOrderNumberList != null and receiptOrderNumberList.size > 0 ">
and RECEIPT_ORDER_NUMBER in
<foreach collection="receiptOrderNumberList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</where>
</sql>
<select id="queryList" parameterType="com.mhd.wms.domain.receiptMaterialDetail.repository.todo.ReceiptMaterialDetailDO" resultMap="ReceiptMaterialDetailResult">
<include refid="selectReceiptMaterialDetailPo"/>
<include refid="selectReceiptMaterialDetailPo1"/>
</select>
</mapper>