@ -8,10 +8,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "purchaseOrderChildId" column= "purchase_order_child_id" />
<result property= "purchaseOrderCode" column= "purchase_order_code" />
<result property= "purchasePlanCode" column= "purchase_plan_code" />
<result property= "purchasePlanCorrelationCode" column= "purchase_plan_correlation_code" />
<result property= "supplierCode" column= "supplier_code" />
<result property= "supplierName" column= "supplier_name" />
<result property= "materialCode" column= "material_code" />
<result property= "materialName" column= "material_name" />
<result property= "materialType" column= "material_type" />
<result property= "materialBrand" column= "material_brand" />
<result property= "materialDescribe" column= "material_describe" />
<result property= "materialPhotourl" column= "material_photoUrl" />
<result property= "materialProcessMethod" column= "material_process_method" />
<result property= "materialUnit" column= "material_unit" />
<result property= "hasStorageNum" column= "has_storage_num" />
<result property= "notifyArrivedNum" column= "notify_arrived_num" />
<result property= "materialNoRmb" column= "material_no_rmb" />
<result property= "materialRmb" column= "material_rmb" />
<result property= "materialNum" column= "material_num" />
@ -19,6 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property= "materialSum" column= "material_sum" />
<result property= "materialNoRmbSum" column= "material_no_rmb_sum" />
<result property= "materialRmbSum" column= "material_rmb_sum" />
<result property= "materialRealNum" column= "material_real_num" />
<result property= "materialRealNoRmb" column= "material_real_no_rmb" />
<result property= "materialRealRmb" column= "material_real_rmb" />
<result property= "materialRealNoRmbSum" column= "material_real_no_rmb_sum" />
<result property= "materialRealRmbSum" column= "material_real_rmb_sum" />
<result property= "deliveryTime" column= "delivery_time" />
<result property= "eceiptStatus" column= "eceipt_status" />
<result property= "paymentStatus" column= "payment_status" />
@ -33,11 +47,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id= "selectPurchaseOrderChildVo" >
select purchase_order_child_id, purchase_order_code, supplier_code, supplier_name,
material_code, material_name, material_no_rmb, material_rmb, material_num,
material_amount, material_sum, material_no_rmb_sum, material_rmb_sum, delivery_time,
eceipt_status, payment_status, tax_rate, create_by, create_time, update_by, update_time,
del_flag, standby_one, standby_two from purchase_order_child
select purchase_order_child_id, purchase_order_code, purchase_plan_code,purchase_plan_correlation_code,
supplier_code, supplier_name,
material_code, material_name,material_type, material_describe,material_brand,
material_photoUrl, material_process_method,material_unit,
material_no_rmb, material_rmb, material_num,
material_amount, material_sum, material_no_rmb_sum, material_rmb_sum,
material_real_num, material_real_no_rmb, material_real_rmb, material_real_no_rmb_sum,
material_real_rmb_sum,delivery_time,eceipt_status, payment_status, tax_rate, create_by,
create_time, update_by, update_time,del_flag, standby_one, standby_two
from purchase_order_child
</sql>
<select id= "selectPurchaseOrderChildList" parameterType= "PurchaseOrderChild" resultMap= "PurchaseOrderChildResult" >
@ -64,10 +83,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into purchase_order_child
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "purchaseOrderCode != null" > purchase_order_code,</if>
<if test= "purchasePlanCode != null" > purchase_plan_code,</if>
<if test= "purchasePlanCorrelationCode != null" > purchase_plan_correlation_code,</if>
<if test= "supplierCode != null" > supplier_code,</if>
<if test= "supplierName != null" > supplier_name,</if>
<if test= "materialCode != null" > material_code,</if>
<if test= "materialName != null" > material_name,</if>
<if test= "materialType != null" > material_type,</if>
<if test= "materialDescribe != null" > material_describe,</if>
<if test= "materialBrand != null" > material_brand,</if>
<if test= "materialPhotourl != null" > material_photo_url,</if>
<if test= "materialProcessMethod != null" > material_process_method,</if>
<if test= "materialUnit != null" > material_unit,</if>
<if test= "materialNoRmb != null" > material_no_rmb,</if>
<if test= "materialRmb != null" > material_rmb,</if>
<if test= "materialNum != null" > material_num,</if>
@ -75,24 +102,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "materialSum != null" > material_sum,</if>
<if test= "materialNoRmbSum != null" > material_no_rmb_sum,</if>
<if test= "materialRmbSum != null" > material_rmb_sum,</if>
<if test= "materialRealNum != null" > material_real_num,</if>
<if test= "materialRealNoRmb != null" > material_real_no_rmb,</if>
<if test= "materialRealRmb != null" > material_real_rmb,</if>
<if test= "materialRealNoRmbSum != null" > material_real_no_rmb_sum,</if>
<if test= "materialRealRmbSum != null" > material_real_rmb_sum,</if>
<if test= "deliveryTime != null" > delivery_time,</if>
<if test= "eceiptStatus != null" > eceipt_status,</if>
<if test= "paymentStatus != null" > payment_status,</if>
<if test= "taxRate != null" > tax_rate,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "delFlag != null" > del_flag,</if>
<if test= "standbyOne != null" > standby_one,</if>
<if test= "standbyTwo != null" > standby_two,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "purchaseOrderCode != null" > #{purchaseOrderCode},</if>
<if test= "purchasePlanCode != null" > #{purchasePlanCode},</if>
<if test= "purchasePlanCorrelationCode != null" > #{purchasePlanCorrelationCode},</if>
<if test= "supplierCode != null" > #{supplierCode},</if>
<if test= "supplierName != null" > #{supplierName},</if>
<if test= "materialCode != null" > #{materialCode},</if>
<if test= "materialName != null" > #{materialName},</if>
<if test= "materialType != null" > #{materialType},</if>
<if test= "materialDescribe != null" > #{materialDescribe},</if>
<if test= "materialBrand != null" > #{materialBrand},</if>
<if test= "materialPhotourl != null" > #{materialPhotourl},</if>
<if test= "materialProcessMethod != null" > #{materialProcessMethod},</if>
<if test= "materialUnit != null" > #{materialUnit},</if>
<if test= "materialNoRmb != null" > #{materialNoRmb},</if>
<if test= "materialRmb != null" > #{materialRmb},</if>
<if test= "materialNum != null" > #{materialNum},</if>
@ -100,28 +138,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "materialSum != null" > #{materialSum},</if>
<if test= "materialNoRmbSum != null" > #{materialNormbsum},</if>
<if test= "materialRmbSum != null" > #{materialRmbsum},</if>
<if test= "materialRealNum != null" > #{materialRealNum},</if>
<if test= "materialRealNoRmb != null" > #{materialRealNoRmb},</if>
<if test= "materialRealRmb != null" > #{materialRealRmb},</if>
<if test= "materialRealNoRmbSum != null" > #{materialRealNoRmbSum},</if>
<if test= "materialRealRmbSum != null" > #{materialRealRmbSum},</if>
<if test= "deliveryTime != null" > #{deliveryTime},</if>
<if test= "eceiptStatus != null" > #{eceiptStatus},</if>
<if test= "paymentStatus != null" > #{paymentStatus},</if>
<if test= "taxRate != null" > #{taxRate},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "delFlag != null" > #{delFlag},</if>
<if test= "standbyOne != null" > #{standbyOne},</if>
<if test= "standbyTwo != null" > #{standbyTwo},</if>
</trim>
</insert>
<update id= "updatePurchaseOrderChild" parameterType= "PurchaseOrderChild" >
update purchase_order_child
<trim prefix= "SET" suffixOverrides= "," >
<if test= "purchaseOrderCode != null" > purchase_order_code = #{purchaseOrderCode},</if>
<if test= "purchasePlanCode != null" > purchase_plan_code = #{purchasePlanCode},</if>
<if test= "purchasePlanCorrelationCode != null" > purchase_plan_correlation_code = #{purchasePlanCorrelationCode},</if>
<if test= "supplierCode != null" > supplier_code = #{supplierCode},</if>
<if test= "supplierName != null" > supplier_name = #{supplierName},</if>
<if test= "materialCode != null" > material_code = #{materialCode},</if>
<if test= "materialName != null" > material_name = #{materialName},</if>
<if test= "materialType != null" > material_type = #{materialType},</if>
<if test= "materialDescribe != null" > material_describe = #{materialDescribe},</if>
<if test= "materialBrand != null" > material_brand = #{materialBrand},</if>
<if test= "materialPhotourl != null" > material_photo_url = #{materialPhotourl}</if>
<if test= "materialProcessMethod != null" > material_process_method = #{materialProcessMethod},</if>
<if test= "materialUnit != null" > material_unit = #{materialUnit},</if>
<if test= "materialNoRmb != null" > material_no_rmb = #{materialNoRmb},</if>
<if test= "materialRmb != null" > material_rmb = #{materialRmb},</if>
<if test= "materialNum != null" > material_num = #{materialNum},</if>
@ -129,6 +177,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test= "materialSum != null" > material_sum = #{materialSum},</if>
<if test= "materialNoRmbSum != null" > material_no_rmb_sum = #{materialNoRmbSum},</if>
<if test= "materialRmbSum != null" > material_rmb_sum = #{materialRmbsum},</if>
<if test= "materialRealNum != null" > material_real_num = #{materialRealNum},</if>
<if test= "materialRealNoRmb != null" > material_real_no_rmb = #{materialRealNoRmb},</if>
<if test= "materialRealRmb != null" > material_real_rmb = #{materialRealRmb},</if>
<if test= "materialRealNoRmbSum != null" > material_real_no_rmb_sum = #{materialRealNoRmbSum},</if>
<if test= "materialRealRmbSum != null" > material_real_rmb_sum = #{materialRealRmbSum},</if>
<if test= "deliveryTime != null" > delivery_time = #{deliveryTime},</if>
<if test= "eceiptStatus != null" > eceipt_status = #{eceiptStatus},</if>
<if test= "paymentStatus != null" > payment_status = #{paymentStatus},</if>
@ -168,5 +221,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid= "selectPurchaseOrderChildVo" />
where purchase_order_code = #{purchaseOrderCode}
</select>
<select id= "selectPurchaseOrderChildByOrderCodeTotal" parameterType= "String" resultMap= "PurchaseOrderChildResult" >
select
supplier_code,supplier_name,
count(material_code) as material_amount,
sum(material_real_num) as material_sum,
sum(material_real_no_rmb_sum) as material_no_rmb_sum,
sum(material_real_rmb_sum) as material_rmb_sum,
payment_status,
eceipt_status
from purchase_order_child
where purchase_order_code = #{purchaseOrderCode} group by supplier_code
</select>
<select id= "selectPurhcaseOrderStorageByPurchaseOrderCode" parameterType= "String" resultMap= "PurchaseOrderChildResult" >
select p.purchase_order_child_id,p.purchase_order_code,p.purchase_plan_code,p.purchase_plan_correlation_code,
p.supplier_code,p.supplier_name,p.material_code,p.material_name,p.material_type,p.material_describe,
p.material_brand,p.material_photo_url,p.material_process_method,p.material_unit,p.material_no_rmb,
p.material_rmb,p.material_num,p.material_amount,p.material_sum,p.material_no_rmb_sum,p.material_rmb_sum,
p.material_real_num,p.material_real_no_rmb,p.material_real_rmb,p.material_real_no_rmb_sum,p.material_real_rmb_sum,
p.delivery_time,p.eceipt_status,p.payment_status,p.tax_rate,p.create_by,p.create_time,p.update_by,p.update_time,p.del_flag,
(select w.has_storage_num from warehouse_storage_order_detail as w where w.material_no = p.material_code and w.related_order_code = p.purchase_order_code and w.supplier_code = p.supplier_code) as has_storage_num,
(select w.notify_has_arrived_num from warehouse_storage_order_detail as w where w.material_no = p.material_code and w.related_order_code = p.purchase_order_code and w.supplier_code = p.supplier_code) as notify_has_arrived_num
from purchase_order_child as p where p.purchase_order_code = #{purchaseOrderCode};
</select>
</mapper>