@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "orderBindBarcodeAmount" column= "order_bind_barcode_amount" />
<result property= "safeBindBarcodeAmount" column= "safe_bind_barcode_amount" />
<result property= "alwaysFlag" column= "always_flag" />
</resultMap>
<resultMap id= "MesPurchaseOrderMesOrderBindResult" type= "MesPurchaseOrder" extends= "MesPurchaseOrderResult" >
@ -64,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "productId" column= "sub_product_id" />
<result property= "productCode" column= "sub_product_code" />
<result property= "productName" column= "sub_product_name" />
<result property= "purchaseOrderId" column= "sub_purchase_order_id" />
<result property= "poNo" column= "sub_po_no" />
<result property= "materialId" column= "sub_material_id" />
@ -75,6 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "createTime" column= "sub_create_time" />
<result property= "updateBy" column= "sub_update_by" />
<result property= "updateTime" column= "sub_update_time" />
<result property= "productSpec" column= "sub_product_spec" />
<result property= "barcodeAmount" column= "sub_barcode_amount" />
</resultMap>
@ -109,10 +113,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id= "selectMesPurchaseOrderByPurchaseOrderId" parameterType= "Long" resultMap= "MesPurchaseOrderMesOrderBindResult" >
select a.purchase_order_id, a.erp_id, a.fentry_id, a.po_no, a.document_status, a.material_id, a.material_code, a.material_name, a.order_amount, a.complete_amount, a.approve_date, a.erp_modify_date, a.plan_delivery_date, a.begin_date, a.end_date, a.order_status, a.complete_date, a.is_flag, a.unit_id, a.stock_unit_id, a.price_unit_id, a.aux_prop_id, a.src_bill_no, a.purchase_org_id, a.tond_base, a.supplier_id, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
b.order_bind_id as sub_order_bind_id, b.safe_flag as sub_safe_flag, b.sale_order_id as sub_sale_order_id, b.sale_order_code as sub_sale_order_code, b.product_id as sub_product_id, b.product_code as sub_product_code, b.product_name as sub_product_name, b.purchase_order_id as sub_purchase_order_id, b.po_no as sub_po_no, b.material_id as sub_material_id, b.material_code as sub_material_code, b.material_name as sub_material_name, b.bind_amount as sub_bind_amount, b.remark as sub_remark, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
select a.purchase_order_id, a.po_no, a.document_status, a.material_id,
a.material_code, a.material_name, a.order_amount, a.complete_amount, a.approve_date,a.specification_parameter,
a.erp_modify_date, a.plan_delivery_date, a.order_status, a.complete_date,
a.is_flag, a.src_bill_no,
a.purchase_org_id, a.tond_base, a.supplier_id,a.create_by, a.create_time, a.update_by, a.update_time,
b.order_bind_id as sub_order_bind_id, b.safe_flag as sub_safe_flag, b.sale_order_id as sub_sale_order_id,
b.sale_order_code as sub_sale_order_code, b.product_id as sub_product_id,
mbmi.material_code as sub_product_code, mbmi.material_name as sub_product_name, mbmi.material_spec as sub_product_spec,
b.purchase_order_id as sub_purchase_order_id, b.po_no as sub_po_no,
b.material_id as sub_material_id, b.material_code as sub_material_code,
b.material_name as sub_material_name, b.bind_amount as sub_bind_amount, b.barcode_amount as sub_barcode_amount
from mes_purchase_order a
left join mes_order_bind b on b.purchase_order_id = a.purchase_order_id
left join mes_base_material_info mbmi on b.product_id=mbmi.erp_id
where a.purchase_order_id = #{purchaseOrderId}
</select>
@ -337,4 +351,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by mpo.erp_modify_date desc,mpo.po_no ,mpo.material_name
</select>
<select id= "selectMesPurchaseOrderJoinList" parameterType= "MesPurchaseOrder" resultMap= "MesPurchaseOrderResult" >
select mpo.purchase_order_id, mpo.erp_id, mpo.fentry_id, mpo.po_no, mpo.document_status, mpo.material_id,
mpo.order_amount, mpo.complete_amount, mpo.approve_date,
mpo.erp_modify_date, mpo.plan_delivery_date, mpo.begin_date, mpo.end_date, mpo.order_status,
mpo.complete_date, mpo.specification_parameter, mpo.src_bill_no, mpo.purchase_org_id, mpo.tond_base,
mbmi.material_code,mbmi.material_name,mbmi.material_spec,mbmi.always_flag
from mes_purchase_order mpo left join mes_base_material_info mbmi on mpo.material_id =mbmi.erp_id
<where >
<if test= "poNo != null and poNo != ''" > and mpo.po_no like concat('%', #{poNo}, '%')</if>
<if test= "materialCode != null and materialCode != ''" > and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test= "materialName != null and materialName != ''" > and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test= "materialSpec != null and materialSpec != '' " > and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if>
<if test= "specificationParameter != null and specificationParameter != '' " > and replace(mpo.specification_parameter,' ','') like concat('%', #{specificationParameter},
'%')</if>
<if test= "orderStatus != null and orderStatus != ''" > and mpo.order_status = #{orderStatus}</if>
<if test= "alwaysFlag != null and alwaysFlag != ''" > and mbmi.always_flag = #{alwaysFlag}</if>
<if test= "orderAmount != null " > and mpo.order_amount = #{orderAmount}</if>
<if test= "completeAmount != null " > and mpo.complete_amount = #{completeAmount}</if>
<if test= "approveDate != null " > and mpo.approve_date = #{approveDate}</if>
<if test= "erpModifyDate != null " > and mpo.erp_modify_date = #{erpModifyDate}</if>
<if test= "planDeliveryDate != null " > and mpo.plan_delivery_date = #{planDeliveryDate}</if>
<if test= "beginDate != null " > and mpo.begin_date = #{beginDate}</if>
<if test= "endDate != null " > and mpo.end_date = #{endDate}</if>
<if test= "completeDate != null " > and mpo.complete_date = #{completeDate}</if>
<if test= "isFlag != null and isFlag != ''" > and mpo.is_flag = #{isFlag}</if>
<if test= "srcBillNo != null and srcBillNo != ''" > and mpo.src_bill_no like concat('%', #{srcBillNo}, '%')</if>
<if test= "tondBase != null and tondBase != ''" > and mpo.tond_base like concat('%', #{tondBase}, '%')</if>
</where>
</select>
</mapper>