select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name , t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount , t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version,t1.flow_type from oms_purchase_order t1 SELECT t1.id, t1.purchase_id, t1.product_code, t1.quantity, t1.price, t1.tax_rate, t1.tax_total, t1.amount_total, t1.delivery_date, t1.inner_quantity, t2.type as product_type,t2.model as product_model,t2.description as product_description FROM oms_purchase_order_item t1 left join product_info t2 on t1.product_code = t2.product_code select t1.id, t1.purchase_no, t1.buyer_name, t1.buyer_address, t1.vendor_id, t1.currency, t1.purchaser_id, t1.purchaser_name , t1.purchaser_mobile, t1.purchaser_email, t1.warehouse_id, t1.pay_method, t1.owner_id, t1.owner_name, t1.remark, t1.total_amount,t1.flow_type , t1.status, t1.approve_status, t1.approve_time, t1.approve_node, t1.confirm_status, t1.create_time, t1.update_time, t1.del_flag,t1.version ,t2.vendor_name,t2.vendor_user,t2.vendor_phone from oms_purchase_order t1 left join oms_vendor_info t2 on t1.vendor_id = t2.vendor_id insert into oms_purchase_order purchase_no, buyer_name, buyer_address, vendor_id, currency, purchaser_id, purchaser_name, purchaser_mobile, purchaser_email, warehouse_id, pay_method, owner_id, owner_name, remark, total_amount, status, approve_status, approve_time, approve_node, confirm_status, create_time, update_time, del_flag, version, flow_type, #{purchaseNo}, #{buyerName}, #{buyerAddress}, #{vendorId}, #{currency}, #{purchaserId}, #{purchaserName}, #{purchaserMobile}, #{purchaserEmail}, #{warehouseId}, #{payMethod}, #{ownerId}, #{ownerName}, #{remark}, #{totalAmount}, #{status}, #{approveStatus}, #{approveTime}, #{approveNode}, #{confirmStatus}, #{createTime}, #{updateTime}, #{delFlag}, #{version}, #{flowType}, update oms_purchase_order purchase_no = #{purchaseNo}, buyer_name = #{buyerName}, buyer_address = #{buyerAddress}, vendor_id = #{vendorId}, currency = #{currency}, purchaser_id = #{purchaserId}, purchaser_name = #{purchaserName}, purchaser_mobile = #{purchaserMobile}, purchaser_email = #{purchaserEmail}, warehouse_id = #{warehouseId}, pay_method = #{payMethod}, owner_id = #{ownerId}, owner_name = #{ownerName}, remark = #{remark}, total_amount = #{totalAmount}, status = #{status}, approve_status = #{approveStatus}, approve_time = #{approveTime}, approve_node = #{approveNode}, confirm_status = #{confirmStatus}, create_time = #{createTime}, update_time = #{updateTime}, del_flag = #{delFlag}, version = #{version}, flow_type=#{flowType}, where id = #{id} update oms_purchase_order buyer_name = #{buyerName}, buyer_address = #{buyerAddress}, vendor_id = #{vendorId}, currency = #{currency}, purchaser_id = #{purchaserId}, purchaser_name = #{purchaserName}, purchaser_mobile = #{purchaserMobile}, purchaser_email = #{purchaserEmail}, warehouse_id = #{warehouseId}, pay_method = #{payMethod}, owner_id = #{ownerId}, owner_name = #{ownerName}, remark = #{remark}, total_amount = #{totalAmount}, status = #{status}, approve_status = #{approveStatus}, approve_time = #{approveTime}, approve_node = #{approveNode}, confirm_status = #{confirmStatus}, create_time = #{createTime}, update_time = #{updateTime}, del_flag = #{delFlag}, version = #{version}, flow_type=#{flowType}, where purchase_no = #{purchaseNo} update oms_purchase_order purchase_no = #{purchaseNo}, buyer_name = #{buyerName}, buyer_address = #{buyerAddress}, vendor_id = #{vendorId}, currency = #{currency}, purchaser_id = #{purchaserId}, purchaser_name = #{purchaserName}, purchaser_mobile = #{purchaserMobile}, purchaser_email = #{purchaserEmail}, warehouse_id = #{warehouseId}, pay_method = #{payMethod}, owner_id = #{ownerId}, owner_name = #{ownerName}, remark = #{remark}, total_amount = #{totalAmount}, status = #{status}, approve_status = #{approveStatus}, approve_time = #{approveTime}, approve_node = #{approveNode}, confirm_status = #{confirmStatus}, create_time = #{createTime}, update_time = #{updateTime}, del_flag = #{delFlag}, version = #{version}, flow_type=#{flowType}, where purchase_no = #{purchaseNo} update oms_purchase_order_item inner_quantity = #{innerQuantity}, where id = #{id} delete from oms_purchase_order where id = #{id} delete from oms_purchase_order where id in #{id} delete from oms_purchase_order_item where purchase_id in #{purchaseId} delete from oms_purchase_order_item where purchase_id = #{purchaseId} update oms_purchase_order_item t1 left join oms_purchase_order t2 on t1.purchase_id = t2.id set t1.inner_quantity = t1.inner_quantity- #{item.innerQuantity} where t1.product_code = #{item.productCode} and t2.purchase_no=#{item.purchaseNo} insert into oms_purchase_order_item( purchase_id, product_code, inner_quantity, quantity, price, tax_rate, tax_total, amount_total,delivery_date) values ( #{item.purchaseId}, #{item.productCode}, #{item.innerQuantity}, #{item.quantity}, #{item.price}, #{item.taxRate}, #{item.taxTotal}, #{item.amountTotal}, #{item.deliveryDate})