|
|
<?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.xujie.modules.order.dao.PODetailMapper">
<!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.xujie.modules.order.entity.PODetail"> <id column="order_no" property="orderNo" /> <result column="site" property="site" /> <result column="item_no" property="itemNo" /> <result column="part_no" property="partNo" /> <result column="status" property="status" /> <result column="qty" property="qty" /> <result column="umid" property="umid" /> <result column="convert_factor" property="convertFactor" /> <result column="price" property="price" /> <result column="base_price" property="basePrice" /> <result column="want_receive_date" property="wantReceiveDate" /> <result column="tax_rate" property="taxRate" /> <result column="tax" property="tax" /> <result column="additional_cost" property="additionalCost" /> <result column="freight" property="freight" /> <result column="duty" property="duty" /> <result column="arrive_qty" property="arriveQty" /> <result column="receive_qty" property="receiveQty" /> <result column="qty_returned" property="qtyReturned" /> <result column="qty_replace" property="qtyReplace" /> <result column="qty_scrapt" property="qtyScrapt" /> <result column="invoice_qty" property="invoiceQty" /> <result column="approve_result" property="approveResult" /> <result column="need_inspect_flag" property="needInspectFlag" /> <result column="remark" property="remark" /> <result column="iqc_qty" property="iqcQty" /> <result column="last_update_by" property="lastUpdateBy" /> <result column="pr_convert_note" property="prConvertNote" /> <result column="inspect_type_db" property="inspectTypeDb" /> <result column="inspect_type" property="inspectType" /> <result column="inspect_qty" property="inspectQty" /> <result column="inspect_percent" property="inspectPercent" /> <result column="inspection_level_no" property="inspectionLevelNo" /> <result column="close_tolerance" property="closeTolerance" /> <result column="over_receive_tolerance" property="overReceiveTolerance" /> <result column="item" property="item" /> <result column="c_value" property="value" /> <result column="c_ship_qty" property="shipQty" /> <result column="c_sum_price" property="sumPrice" /> <result column="c_narrival" property="narrival" /> <result column="c_crd" property="crd" /> <result column="c_inspection" property="inspection" /> <result column="c_real_crd" property="realCrd" /> <result column="c_eta" property="eta" /> <result column="c_flexid" property="flexid" /> <result column="c_obd" property="obd" /> <result column="c_doc_sent" property="docSent" /> <result column="c_telex_release" property="telexRelease" /> <result column="c_advance_payment" property="advancePayment" /> <result column="c_advance_paid" property="advancePaid" /> <result column="create_time" property="createTime" /> <result column="c_planner" property="planner" /> <result column="c_edit" property="edit" /> <result column="c_end_planner" property="endPlanner" /> <result column="c_remark_delay" property="remarkDelay" /> <result column="qty_cancelled" property="qtyCancelled" /> <result column="inspect_method_db" property="inspectMethodDb" /> <result column="to_inv_nofity_qty" property="toInvNofityQty" /> <result column="upload_date" property="uploadDate" /> <result column="order_ref1" property="orderRef1" /> <result column="order_ref5" property="orderRef5" /> <result column="batch_no" property="batchNo" /> <result column="order_ref4" property="orderRef4" /> <result column="pre_pay_amount" property="prePayAmount" /> <result column="upload_by" property="uploadBy" /> <result column="pur_lead_time" property="purLeadTime" /> <result column="order_ref_type" property="orderRefType" /> <result column="order_ref3" property="orderRef3" /> <result column="need_receive_flag" property="needReceiveFlag" /> <result column="upload_flag" property="uploadFlag" /> <result column="id" property="id" /> <result column="pre_pay_reverse_amount" property="prePayReverseAmount" /> <result column="out_work_order_flag" property="outWorkOrderFlag" /> <result column="order_ref2" property="orderRef2" /> <result column="qty_rbjs" property="qtyRbjs" /> <result column="pre_pay_pay_amount" property="prePayPayAmount" /> <result column="need_date" property="needDate" /> <result column="inspect_method" property="inspectMethod" /> <result column="inv_notify_qty" property="invNotifyQty" /> <result column="po_header_id" property="poHeaderId" /> </resultMap>
<!-- 通用查询结果列 --> <sql id="BaseColumnList"> po_header_id, order_no, site, item_no, part_no, status, qty, umid, convert_factor, price, base_price, want_receive_date, tax_rate, tax, additional_cost, freight, duty, arrive_qty, receive_qty, qty_returned, qty_replace, qty_scrapt, invoice_qty, approve_result, need_inspect_flag, remark, iqc_qty, last_update_by, pr_convert_note, inspect_type_db, inspect_type, inspect_qty, inspect_percent, inspection_level_no, close_tolerance, over_receive_tolerance, item, c_value, c_ship_qty, c_sum_price, c_narrival, c_crd, c_inspection, c_real_crd, c_eta, c_flexid, c_obd, c_doc_sent, c_telex_release, c_advance_payment, c_advance_paid, create_time, c_planner, c_edit, c_end_planner, c_remark_delay, qty_cancelled, inspect_method_db, to_inv_nofity_qty, upload_date, order_ref1, order_ref5, batch_no, order_ref4, pre_pay_amount, upload_by, pur_lead_time, order_ref_type, order_ref3, need_receive_flag, upload_flag, id, pre_pay_reverse_amount, out_work_order_flag, order_ref2, qty_rbjs, pre_pay_pay_amount, need_date, inspect_method, inv_notify_qty </sql>
<select id="getListByModel" resultType="com.xujie.modules.order.vo.PODetailVo"> select <include refid="BaseColumnList"/> from PODetail where site = #{site} <if test="poHeaderId != null and poHeaderId != '' "> and po_header_id = #{poHeaderId}</if> <if test="orderNo != null and orderNo != '' "> and order_no = #{orderNo}</if> <if test="itemNo != null "> and item_no = #{itemNo}</if> <if test="partNo != null and partNo != '' "> and part_no = #{partNo}</if> <if test="status != null and status != '' "> and status = #{status}</if> <if test="qty != null and qty != '' "> and qty = #{qty}</if> <if test="umid != null and umid != '' "> and umid = #{umid}</if> <if test="convertFactor != null and convertFactor != '' "> and convert_factor = #{convertFactor}</if> <if test="price != null and price != '' "> and price = #{price}</if> <if test="basePrice != null and basePrice != '' "> and base_price = #{basePrice}</if> <if test="wantReceiveDate != null and wantReceiveDate != '' "> and want_receive_date = #{wantReceiveDate}</if> <if test="taxRate != null and taxRate != '' "> and tax_rate = #{taxRate}</if> <if test="tax != null and tax != '' "> and tax = #{tax}</if> <if test="additionalCost != null and additionalCost != '' "> and additional_cost = #{additionalCost}</if> <if test="freight != null and freight != '' "> and freight = #{freight}</if> <if test="duty != null and duty != '' "> and duty = #{duty}</if> <if test="arriveQty != null and arriveQty != '' "> and arrive_qty = #{arriveQty}</if> <if test="receiveQty != null and receiveQty != '' "> and receive_qty = #{receiveQty}</if> <if test="qtyReturned != null and qtyReturned != '' "> and qty_returned = #{qtyReturned}</if> <if test="qtyReplace != null and qtyReplace != '' "> and qty_replace = #{qtyReplace}</if> <if test="qtyScrapt != null and qtyScrapt != '' "> and qty_scrapt = #{qtyScrapt}</if> <if test="invoiceQty != null and invoiceQty != '' "> and invoice_qty = #{invoiceQty}</if> <if test="approveResult != null and approveResult != '' "> and approve_result = #{approveResult}</if> <if test="needInspectFlag != null and needInspectFlag != '' "> and need_inspect_flag = #{needInspectFlag}</if> <if test="remark != null and remark != '' "> and remark = #{remark}</if> <if test="iqcQty != null and iqcQty != '' "> and iqc_qty = #{iqcQty}</if> <if test="lastUpdateBy != null and lastUpdateBy != '' "> and last_update_by = #{lastUpdateBy}</if> <if test="prConvertNote != null and prConvertNote != '' "> and pr_convert_note = #{prConvertNote}</if> <if test="inspectTypeDb != null and inspectTypeDb != '' "> and inspect_type_db = #{inspectTypeDb}</if> <if test="inspectType != null and inspectType != '' "> and inspect_type = #{inspectType}</if> <if test="inspectQty != null and inspectQty != '' "> and inspect_qty = #{inspectQty}</if> <if test="inspectPercent != null and inspectPercent != '' "> and inspect_percent = #{inspectPercent}</if> <if test="inspectionLevelNo != null and inspectionLevelNo != '' "> and inspection_level_no = #{inspectionLevelNo}</if> <if test="closeTolerance != null and closeTolerance != '' "> and close_tolerance = #{closeTolerance}</if> <if test="overReceiveTolerance != null and overReceiveTolerance != '' "> and over_receive_tolerance = #{overReceiveTolerance}</if> <if test="item != null and item != '' "> and item = #{item}</if> <if test="value != null and value != '' "> and c_value = #{value}</if> <if test="shipQty != null "> and c_ship_qty = #{shipQty}</if> <if test="sumPrice != null and sumPrice != '' "> and c_sum_price = #{sumPrice}</if> <if test="narrival != null and narrival != '' "> and c_narrival = #{narrival}</if> <if test="crd != null and crd != '' "> and c_crd = #{crd}</if> <if test="inspection != null and inspection != '' "> and c_inspection = #{inspection}</if> <if test="realCrd != null and realCrd != '' "> and c_real_crd = #{realCrd}</if> <if test="eta != null and eta != '' "> and c_eta = #{eta}</if> <if test="flexid != null and flexid != '' "> and c_flexid = #{flexid}</if> <if test="obd != null and obd != '' "> and c_obd = #{obd}</if> <if test="docSent != null and docSent != '' "> and c_doc_sent = #{docSent}</if> <if test="telexRelease != null and telexRelease != '' "> and c_telex_release = #{telexRelease}</if> <if test="advancePayment != null and advancePayment != '' "> and c_advance_payment = #{advancePayment}</if> <if test="advancePaid != null and advancePaid != '' "> and c_advance_paid = #{advancePaid}</if> <if test="createTime != null and createTime != '' "> and create_time = #{createTime}</if> <if test="planner != null and planner != '' "> and c_planner = #{planner}</if> <if test="edit != null and edit != '' "> and c_edit = #{edit}</if> <if test="endPlanner != null and endPlanner != '' "> and c_end_planner = #{endPlanner}</if> <if test="remarkDelay != null and remarkDelay != '' "> and c_remark_delay = #{remarkDelay}</if> <if test="qtyCancelled != null and qtyCancelled != '' "> and qty_cancelled = #{qtyCancelled}</if> <if test="inspectMethodDb != null and inspectMethodDb != '' "> and inspect_method_db = #{inspectMethodDb}</if> <if test="toInvNofityQty != null and toInvNofityQty != '' "> and to_inv_nofity_qty = #{toInvNofityQty}</if> <if test="uploadDate != null and uploadDate != '' "> and upload_date = #{uploadDate}</if> <if test="orderRef1 != null and orderRef1 != '' "> and order_ref1 = #{orderRef1}</if> <if test="orderRef5 != null and orderRef5 != '' "> and order_ref5 = #{orderRef5}</if> <if test="batchNo != null and batchNo != '' "> and batch_no = #{batchNo}</if> <if test="orderRef4 != null and orderRef4 != '' "> and order_ref4 = #{orderRef4}</if> <if test="prePayAmount != null and prePayAmount != '' "> and pre_pay_amount = #{prePayAmount}</if> <if test="uploadBy != null and uploadBy != '' "> and upload_by = #{uploadBy}</if> <if test="purLeadTime != null and purLeadTime != '' "> and pur_lead_time = #{purLeadTime}</if> <if test="orderRefType != null and orderRefType != '' "> and order_ref_type = #{orderRefType}</if> <if test="orderRef3 != null and orderRef3 != '' "> and order_ref3 = #{orderRef3}</if> <if test="needReceiveFlag != null and needReceiveFlag != '' "> and need_receive_flag = #{needReceiveFlag}</if> <if test="uploadFlag != null and uploadFlag != '' "> and upload_flag = #{uploadFlag}</if> <if test="id != null "> and id = #{id}</if> <if test="prePayReverseAmount != null and prePayReverseAmount != '' "> and pre_pay_reverse_amount = #{prePayReverseAmount}</if> <if test="outWorkOrderFlag != null and outWorkOrderFlag != '' "> and out_work_order_flag = #{outWorkOrderFlag}</if> <if test="orderRef2 != null and orderRef2 != '' "> and order_ref2 = #{orderRef2}</if> <if test="qtyRbjs != null and qtyRbjs != '' "> and qty_rbjs = #{qtyRbjs}</if> <if test="prePayPayAmount != null and prePayPayAmount != '' "> and pre_pay_pay_amount = #{prePayPayAmount}</if> <if test="needDate != null and needDate != '' "> and need_date = #{needDate}</if> <if test="inspectMethod != null and inspectMethod != '' "> and inspect_method = #{inspectMethod}</if> <if test="invNotifyQty != null and invNotifyQty != '' "> and inv_notify_qty = #{invNotifyQty}</if> order by id desc </select>
<select id="myPage" resultType="com.xujie.modules.order.vo.PODetailVo"> select pod.po_header_id, pod.order_no, pod.site, pod.item_no, pod.part_no, pod.status, pod.qty, pod.umid, pod.convert_factor, pod.price, pod.base_price, pod.want_receive_date, pod.tax_rate, pod.tax, pod.additional_cost, pod.freight, pod.duty, pod.arrive_qty, pod.receive_qty, pod.qty_returned, pod.qty_replace, pod.qty_scrapt, pod.invoice_qty, pod.approve_result, pod.need_inspect_flag, pod.remark, pod.iqc_qty, pod.last_update_by, pod.pr_convert_note, pod.inspect_type_db, pod.inspect_type, pod.inspect_qty, pod.inspect_percent, pod.inspection_level_no, pod.close_tolerance, pod.over_receive_tolerance ,pod.inspect_method_db, pod.to_inv_nofity_qty, pod.upload_date, pod.order_ref1, pod.order_ref5, pod.batch_no, pod.order_ref4, pod.pre_pay_amount, pod.upload_by, pod.pur_lead_time, pod.order_ref_type, pod.order_ref3, pod.need_receive_flag, pod.upload_flag, pod.id, pod.pre_pay_reverse_amount, pod.out_work_order_flag, pod.order_ref2, pod.qty_rbjs, pod.pre_pay_pay_amount, pod.need_date, pod.inspect_method, pod.inv_notify_qty ,pod.item as item ,pod.c_value as value ,pod.c_ship_qty as shipQty ,pod.c_sum_price as sumPrice ,pod.c_narrival as narrival ,pod.c_crd as crd ,pod.c_inspection as inspection ,pod.c_real_crd as realCrd ,pod.c_eta as eta ,pod.c_flexid as flexid ,pod.c_obd as obd ,pod.c_doc_sent as docSent ,pod.c_telex_release as telexRelease ,pod.c_advance_payment as advancePayment ,pod.c_advance_paid as advancePaid ,pod.create_time as createTime ,pod.c_planner as planner ,pod.c_edit as edit ,pod.c_end_planner as endPlanner ,pod.c_remark_delay as remarkDelay ,pod.qty_cancelled as qtyCancelled
,poh.c_customer as customer ,poh.buyer ,poh.supplier_no ,poh.po_no ,poh.c_departure as departure ,poh.c_destination as destination ,poh.ship_via ,poh.order_date ,poh.c_enquiry as enquiry ,poh.c_confirmed as confirmed ,poh.want_receive_date
,ss.supplier_name ,ss.c_short_office as shortOffice ,ss.c_short_npc as shortNpc
,p.category ,p.sku
from PODetail pod left join POHeader poh on poh.id = pod.po_header_id left join srm_supplier ss on ss.supplier_no = poh.supplier_no and ss.site = pod.site left join part p on p.part_no = pod.part_no and p.site = pod.site where pod.site = '${query.site}' <if test="query.poHeaderId != null and query.poHeaderId != '' "> and pod.po_header_id like '%${query.poHeaderId}%'</if> <if test="query.orderNo != null and query.orderNo != '' "> and pod.order_no like '%${query.orderNo}%'</if> <if test="query.poNo != null and query.poNo != '' "> and poh.po_no like '%${query.poNo}%'</if> <if test="query.customer != null and query.customer != '' "> and poh.c_customer like '%${query.customer}%'</if> <if test="query.buyer != null and query.buyer != '' "> and poh.buyer like '%${query.buyer}%'</if> <if test="query.itemNo != null "> and pod.item_no = '${query.itemNo}'</if> <if test="query.partNo != null and query.partNo != '' "> and pod.part_no like '%${query.partNo}%'</if> <if test="query.status != null and query.status != '' "> and pod.status like '%${query.status}%'</if> <if test="query.qty != null and query.qty != '' "> and pod.qty like '%${query.qty}%'</if> <if test="query.umid != null and query.umid != '' "> and pod.umid like '%${query.umid}%'</if> <if test="query.convertFactor != null and query.convertFactor != '' "> and pod.convert_factor like '%${query.convertFactor}%'</if> <if test="query.price != null and query.price != '' "> and pod.price like '%${query.price}%'</if> <if test="query.basePrice != null and query.basePrice != '' "> and pod.base_price like '%${query.basePrice}%'</if> <if test="query.wantReceiveDate != null "> and pod.want_receive_date like '%${query.wantReceiveDate}%'</if> <if test="query.taxRate != null and query.taxRate != '' "> and pod.tax_rate like '%${query.taxRate}%'</if> <if test="query.tax != null and query.tax != '' "> and pod.tax like '%${query.tax}%'</if> <if test="query.additionalCost != null and query.additionalCost != '' "> and pod.additional_cost like '%${query.additionalCost}%'</if> <if test="query.freight != null and query.freight != '' "> and pod.freight like '%${query.freight}%'</if> <if test="query.duty != null and query.duty != '' "> and pod.duty like '%${query.duty}%'</if> <if test="query.arriveQty != null and query.arriveQty != '' "> and pod.arrive_qty like '%${query.arriveQty}%'</if> <if test="query.receiveQty != null and query.receiveQty != '' "> and pod.receive_qty like '%${query.receiveQty}%'</if> <if test="query.qtyReturned != null and query.qtyReturned != '' "> and pod.qty_returned like '%${query.qtyReturned}%'</if> <if test="query.qtyReplace != null and query.qtyReplace != '' "> and pod.qty_replace like '%${query.qtyReplace}%'</if> <if test="query.qtyScrapt != null and query.qtyScrapt != '' "> and pod.qty_scrapt like '%${query.qtyScrapt}%'</if> <if test="query.invoiceQty != null and query.invoiceQty != '' "> and pod.invoice_qty like '%${query.invoiceQty}%'</if> <if test="query.approveResult != null and query.approveResult != '' "> and pod.approve_result like '%${query.approveResult}%'</if> <if test="query.needInspectFlag != null and query.needInspectFlag != '' "> and pod.need_inspect_flag like '%${query.needInspectFlag}%'</if> <if test="query.remark != null and query.remark != '' "> and pod.remark like '%${query.remark}%'</if> <if test="query.iqcQty != null and query.iqcQty != '' "> and pod.iqc_qty like '%${query.iqcQty}%'</if> <if test="query.lastUpdateBy != null and query.lastUpdateBy != '' "> and pod.last_update_by like '%${query.lastUpdateBy}%'</if> <if test="query.prConvertNote != null and query.prConvertNote != '' "> and pod.pr_convert_note like '%${query.prConvertNote}%'</if> <if test="query.inspectTypeDb != null and query.inspectTypeDb != '' "> and pod.inspect_type_db like '%${query.inspectTypeDb}%'</if> <if test="query.inspectType != null and query.inspectType != '' "> and pod.inspect_type like '%${query.inspectType}%'</if> <if test="query.inspectQty != null and query.inspectQty != '' "> and pod.inspect_qty like '%${query.inspectQty}%'</if> <if test="query.inspectPercent != null and query.inspectPercent != '' "> and pod.inspect_percent like '%${query.inspectPercent}%'</if> <if test="query.inspectionLevelNo != null and query.inspectionLevelNo != '' "> and pod.inspection_level_no like '%${query.inspectionLevelNo}%'</if> <if test="query.closeTolerance != null and query.closeTolerance != '' "> and pod.close_tolerance like '%${query.closeTolerance}%'</if> <if test="query.overReceiveTolerance != null and query.overReceiveTolerance != '' "> and pod.over_receive_tolerance like '%${query.overReceiveTolerance}%'</if> <if test="query.item != null and query.item != '' "> and pod.item like '%${query.item}%'</if> <if test="query.value != null and query.value != '' "> and pod.c_value like '%${query.value}%'</if> <if test="query.shipQty != null "> and pod.c_ship_qty = '${query.shipQty}'</if> <if test="query.sumPrice != null and query.sumPrice != '' "> and pod.c_sum_price like '%${query.sumPrice}%'</if> <if test="query.narrival != null and query.narrival != '' "> and pod.c_narrival like '%${query.narrival}%'</if> <if test="query.crd != null and query.crd != '' "> and pod.c_crd like '%${query.crd}%'</if> <if test="query.inspection != null and query.inspection != '' "> and pod.c_inspection like '%${query.inspection}%'</if> <if test="query.realCrd != null and query.realCrd != '' "> and pod.c_real_crd like '%${query.realCrd}%'</if> <if test="query.eta != null and query.eta != '' "> and pod.c_eta like '%${query.eta}%'</if> <if test="query.flexid != null and query.flexid != '' "> and pod.c_flexid like '%${query.flexid}%'</if> <if test="query.obd != null and query.obd != '' "> and pod.c_obd like '%${query.obd}%'</if> <if test="query.docSent != null and query.docSent != '' "> and pod.c_doc_sent like '%${query.docSent}%'</if> <if test="query.telexRelease != null and query.telexRelease != '' "> and pod.c_telex_release like '%${query.telexRelease}%'</if> <if test="query.advancePayment != null and query.advancePayment != '' "> and pod.c_advance_payment like '%${query.advancePayment}%'</if> <if test="query.advancePaid != null and query.advancePaid != '' "> and pod.c_advance_paid like '%${query.advancePaid}%'</if> <if test="query.createTime != null and query.createTime != '' "> and pod.create_time like '%${query.createTime}%'</if> <if test="query.planner != null and query.planner != '' "> and pod.c_planner like '%${query.planner}%'</if> <if test="query.edit != null and query.edit != '' "> and pod.c_edit like '%${query.edit}%'</if> <if test="query.endPlanner != null and query.endPlanner != '' "> and pod.c_end_planner like '%${query.endPlanner}%'</if> <if test="query.remarkDelay != null and query.remarkDelay != '' "> and pod.c_remark_delay like '%${query.remarkDelay}%'</if> <if test="query.qtyCancelled != null and query.qtyCancelled != '' "> and pod.qty_cancelled like '%${query.qtyCancelled}%'</if> <if test="query.inspectMethodDb != null and query.inspectMethodDb != '' "> and pod.inspect_method_db like '%${query.inspectMethodDb}%'</if> <if test="query.toInvNofityQty != null and query.toInvNofityQty != '' "> and pod.to_inv_nofity_qty like '%${query.toInvNofityQty}%'</if> <if test="query.uploadDate != null and query.uploadDate != '' "> and pod.upload_date like '%${query.uploadDate}%'</if> <if test="query.orderRef1 != null and query.orderRef1 != '' "> and pod.order_ref1 like '%${query.orderRef1}%'</if> <if test="query.orderRef5 != null and query.orderRef5 != '' "> and pod.order_ref5 like '%${query.orderRef5}%'</if> <if test="query.batchNo != null and query.batchNo != '' "> and pod.batch_no like '%${query.batchNo}%'</if> <if test="query.orderRef4 != null and query.orderRef4 != '' "> and pod.order_ref4 like '%${query.orderRef4}%'</if> <if test="query.prePayAmount != null and query.prePayAmount != '' "> and pod.pre_pay_amount like '%${query.prePayAmount}%'</if> <if test="query.uploadBy != null and query.uploadBy != '' "> and pod.upload_by like '%${query.uploadBy}%'</if> <if test="query.purLeadTime != null and query.purLeadTime != '' "> and pod.pur_lead_time like '%${query.purLeadTime}%'</if> <if test="query.orderRefType != null and query.orderRefType != '' "> and pod.order_ref_type like '%${query.orderRefType}%'</if> <if test="query.orderRef3 != null and query.orderRef3 != '' "> and pod.order_ref3 like '%${query.orderRef3}%'</if> <if test="query.needReceiveFlag != null and query.needReceiveFlag != '' "> and pod.need_receive_flag like '%${query.needReceiveFlag}%'</if> <if test="query.uploadFlag != null and query.uploadFlag != '' "> and pod.upload_flag like '%${query.uploadFlag}%'</if> <if test="query.id != null "> and pod.id = '${query.id}'</if> <if test="query.prePayReverseAmount != null and query.prePayReverseAmount != '' "> and pod.pre_pay_reverse_amount like '%${query.prePayReverseAmount}%'</if> <if test="query.outWorkOrderFlag != null and query.outWorkOrderFlag != '' "> and pod.out_work_order_flag like '%${query.outWorkOrderFlag}%'</if> <if test="query.orderRef2 != null and query.orderRef2 != '' "> and pod.order_ref2 like '%${query.orderRef2}%'</if> <if test="query.qtyRbjs != null and query.qtyRbjs != '' "> and pod.qty_rbjs like '%${query.qtyRbjs}%'</if> <if test="query.prePayPayAmount != null and query.prePayPayAmount != '' "> and pod.pre_pay_pay_amount like '%${query.prePayPayAmount}%'</if> <if test="query.needDate != null and query.needDate != '' "> and pod.need_date like '%${query.needDate}%'</if> <if test="query.inspectMethod != null and query.inspectMethod != '' "> and pod.inspect_method like '%${query.inspectMethod}%'</if> <if test="query.invNotifyQty != null and query.invNotifyQty != '' "> and pod.inv_notify_qty like '%${query.invNotifyQty}%'</if> <if test="query.sku != null and query.sku != '' "> and p.sku like '%${query.sku}%'</if> order by pod.id desc </select>
<update id="batchUpdatePoDetail"> UPDATE pd SET order_no = t.order_no, site = t.site, item_no = t.item_no, part_no = t.part_no, status = t.status, qty = t.qty, umid = t.umid, convert_factor = t.convert_factor, price = t.price, base_price = t.base_price, want_receive_date = t.want_receive_date, tax_rate = t.tax_rate, tax = t.tax, additional_cost = t.additional_cost, freight = t.freight, duty = t.duty, arrive_qty = t.arrive_qty, receive_qty = t.receive_qty, qty_returned = t.qty_returned, qty_replace = t.qty_replace, qty_scrapt = t.qty_scrapt, invoice_qty = t.invoice_qty, approve_result = t.approve_result, need_inspect_flag = t.need_inspect_flag, remark = t.remark, iqc_qty = t.iqc_qty, last_update_by = t.last_update_by, pr_convert_note = t.pr_convert_note, inspect_type_db = t.inspect_type_db, inspect_type = t.inspect_type, inspect_qty = t.inspect_qty, inspect_percent = t.inspect_percent, inspection_level_no = t.inspection_level_no, close_tolerance = t.close_tolerance, over_receive_tolerance = t.over_receive_tolerance, item = t.item, c_value = t.c_value, c_ship_qty = t.c_ship_qty, c_sum_price = t.c_sum_price, c_narrival = t.c_narrival, c_crd = t.c_crd, c_inspection = t.c_inspection, c_real_crd = t.c_real_crd, c_eta = t.c_eta, c_flexid = t.c_flexid, c_obd = t.c_obd, c_doc_sent = t.c_doc_sent, c_telex_release = t.c_telex_release, c_advance_payment = t.c_advance_payment, c_advance_paid = t.c_advance_paid, create_time = t.create_time, c_planner = t.c_planner, c_edit = t.c_edit, c_end_planner = t.c_end_planner, c_remark_delay = t.c_remark_delay, qty_cancelled = t.qty_cancelled, inspect_method_db = t.inspect_method_db, to_inv_nofity_qty = t.to_inv_nofity_qty, upload_date = t.upload_date, order_ref1 = t.order_ref1, order_ref5 = t.order_ref5, batch_no = t.batch_no, order_ref4 = t.order_ref4, pre_pay_amount = t.pre_pay_amount, upload_by = t.upload_by, pur_lead_time = t.pur_lead_time, order_ref_type = t.order_ref_type, order_ref3 = t.order_ref3, need_receive_flag = t.need_receive_flag, upload_flag = t.upload_flag, pre_pay_reverse_amount = t.pre_pay_reverse_amount, out_work_order_flag = t.out_work_order_flag, order_ref2 = t.order_ref2, qty_rbjs = t.qty_rbjs, pre_pay_pay_amount = t.pre_pay_pay_amount, need_date = t.need_date, inspect_method = t.inspect_method, inv_notify_qty = t.inv_notify_qty FROM PODetail pd INNER JOIN ( <foreach collection="list" item="item" separator="UNION ALL"> SELECT CAST(#{item.id} AS INT) AS id, CAST(#{item.orderNo} AS VARCHAR(15)) AS order_no, CAST(#{item.site} AS VARCHAR(4)) AS site, CAST(#{item.itemNo} AS INT) AS item_no, CAST(#{item.partNo} AS VARCHAR(30)) AS part_no, CAST(#{item.status} AS VARCHAR(10)) AS status, CAST(#{item.qty} AS DECIMAL(20,6)) AS qty, CAST(#{item.umid} AS VARCHAR(8)) AS umid, CAST(#{item.convertFactor} AS DECIMAL(20,6)) AS convert_factor, CAST(#{item.price} AS DECIMAL(20,6)) AS price, CAST(#{item.basePrice} AS DECIMAL(20,6)) AS base_price, CAST(#{item.wantReceiveDate} AS DATETIME) AS want_receive_date, CAST(#{item.taxRate} AS DECIMAL(20,6)) AS tax_rate, CAST(#{item.tax} AS DECIMAL(20,6)) AS tax, CAST(#{item.additionalCost} AS DECIMAL(20,6)) AS additional_cost, CAST(#{item.freight} AS DECIMAL(20,6)) AS freight, CAST(#{item.duty} AS DECIMAL(20,6)) AS duty, CAST(#{item.arriveQty} AS DECIMAL(20,6)) AS arrive_qty, CAST(#{item.receiveQty} AS DECIMAL(20,6)) AS receive_qty, CAST(#{item.qtyReturned} AS DECIMAL(20,6)) AS qty_returned, CAST(#{item.qtyReplace} AS DECIMAL(20,6)) AS qty_replace, CAST(#{item.qtyScrapt} AS DECIMAL(20,6)) AS qty_scrapt, CAST(#{item.invoiceQty} AS DECIMAL(20,6)) AS invoice_qty, CAST(#{item.approveResult} AS CHAR(1)) AS approve_result, CAST(#{item.needInspectFlag} AS CHAR(1)) AS need_inspect_flag, CAST(#{item.remark} AS VARCHAR(400)) AS remark, CAST(#{item.iqcQty} AS DECIMAL(20,6)) AS iqc_qty, CAST(#{item.lastUpdateBy} AS VARCHAR(20)) AS last_update_by, CAST(#{item.prConvertNote} AS VARCHAR(200)) AS pr_convert_note, CAST(#{item.inspectTypeDb} AS CHAR(1)) AS inspect_type_db, CAST(#{item.inspectType} AS VARCHAR(40)) AS inspect_type, CAST(#{item.inspectQty} AS DECIMAL(20,6)) AS inspect_qty, CAST(#{item.inspectPercent} AS DECIMAL(20,6)) AS inspect_percent, CAST(#{item.inspectionLevelNo} AS VARCHAR(20)) AS inspection_level_no, CAST(#{item.closeTolerance} AS DECIMAL(20,6)) AS close_tolerance, CAST(#{item.overReceiveTolerance} AS DECIMAL(20,6)) AS over_receive_tolerance, CAST(#{item.item} AS VARCHAR(64)) AS item, CAST(#{item.value} AS VARCHAR(50)) AS c_value, CAST(#{item.shipQty} AS INT) AS c_ship_qty, CAST(#{item.sumPrice} AS DECIMAL(20,6)) AS c_sum_price, CAST(#{item.narrival} AS DATETIME) AS c_narrival, CAST(#{item.crd} AS DATETIME) AS c_crd, CAST(#{item.inspection} AS DATETIME) AS c_inspection, CAST(#{item.realCrd} AS DATETIME) AS c_real_crd, CAST(#{item.eta} AS DATETIME) AS c_eta, CAST(#{item.flexid} AS VARCHAR(50)) AS c_flexid, CAST(#{item.obd} AS DATETIME) AS c_obd, CAST(#{item.docSent} AS CHAR(1)) AS c_doc_sent, CAST(#{item.telexRelease} AS CHAR(1)) AS c_telex_release, CAST(#{item.advancePayment} AS CHAR(1)) AS c_advance_payment, CAST(#{item.advancePaid} AS CHAR(1)) AS c_advance_paid, CAST(#{item.createTime} AS DATETIME) AS create_time, CAST(#{item.planner} AS VARCHAR(50)) AS c_planner, CAST(#{item.edit} AS DATETIME) AS c_edit, CAST(#{item.endPlanner} AS VARCHAR(50)) AS c_end_planner, CAST(#{item.remarkDelay} AS VARCHAR(255)) AS c_remark_delay, CAST(#{item.qtyCancelled} AS DECIMAL(20,6)) AS qty_cancelled, CAST(#{item.inspectMethodDb} AS CHAR(1)) AS inspect_method_db, CAST(#{item.toInvNofityQty} AS DECIMAL(20,6)) AS to_inv_nofity_qty, CAST(#{item.uploadDate} AS DATETIME) AS upload_date, CAST(#{item.orderRef1} AS VARCHAR(20)) AS order_ref1, CAST(#{item.orderRef5} AS VARCHAR(20)) AS order_ref5, CAST(#{item.batchNo} AS VARCHAR(18)) AS batch_no, CAST(#{item.orderRef4} AS VARCHAR(20)) AS order_ref4, CAST(#{item.prePayAmount} AS DECIMAL(20,6)) AS pre_pay_amount, CAST(#{item.uploadBy} AS VARCHAR(50)) AS upload_by, CAST(#{item.purLeadTime} AS DECIMAL(20,6)) AS pur_lead_time, CAST(#{item.orderRefType} AS VARCHAR(20)) AS order_ref_type, CAST(#{item.orderRef3} AS VARCHAR(20)) AS order_ref3, CAST(#{item.needReceiveFlag} AS CHAR(1)) AS need_receive_flag, CAST(#{item.uploadFlag} AS CHAR(1)) AS upload_flag, CAST(#{item.prePayReverseAmount} AS DECIMAL(20,6)) AS pre_pay_reverse_amount, CAST(#{item.outWorkOrderFlag} AS CHAR(1)) AS out_work_order_flag, CAST(#{item.orderRef2} AS VARCHAR(20)) AS order_ref2, CAST(#{item.qtyRbjs} AS DECIMAL(20,6)) AS qty_rbjs, CAST(#{item.prePayPayAmount} AS DECIMAL(20,6)) AS pre_pay_pay_amount, CAST(#{item.needDate} AS DATETIME) AS need_date, CAST(#{item.inspectMethod} AS VARCHAR(20)) AS inspect_method, CAST(#{item.invNotifyQty} AS DECIMAL(20,6)) AS inv_notify_qty </foreach> ) t ON pd.id = t.id </update>
<select id="selectByPK" resultType="com.xujie.modules.order.entity.PODetail"> SELECT TOP 1 * FROM PODetail WHERE order_no = #{orderNo} AND site = #{site} AND item_no = #{itemNo} </select>
<select id="getMaxItemNo" resultType="int"> SELECT MAX(item_no) FROM PODetail WHERE order_no = #{poNo} AND site = #{site} </select>
<select id="countByOrderAndItem" resultType="java.lang.Integer"> SELECT COUNT(1) FROM PODetail WHERE order_no = #{orderNo} AND site = #{site} </select>
</mapper>
|