|
|
@@ -11,6 +11,7 @@
|
|
|
<result column="PD_UNIT" property="pd_unit" jdbcType="VARCHAR" />
|
|
|
<result column="PD_QTY" property="pd_qty" jdbcType="DOUBLE" />
|
|
|
<result column="PD_PRICE" property="pd_price" jdbcType="DOUBLE" />
|
|
|
+ <result column="PD_TAXPRICE" property="pd_taxprice" jdbcType="DOUBLE" />
|
|
|
<result column="PD_TOTAL" property="pd_total" jdbcType="DOUBLE" />
|
|
|
<result column="PD_TAXRATE" property="pd_taxrate" jdbcType="DOUBLE" />
|
|
|
<result column="PD_TAXTOTAL" property="pd_taxtotal" jdbcType="DOUBLE" />
|
|
|
@@ -60,7 +61,7 @@
|
|
|
</association>
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
- PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,
|
|
|
+ PD_ID, PD_PUID, PD_CODE, PD_DETNO, PD_PRODID, PD_PRODCODE, PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
|
|
|
PD_TOTAL, PD_TAXRATE,PD_TAXTOTAL, PD_ACCEPTQTY, PD_DELIVERY, PD_SALECODE, PD_SALEDETNO, PD_SDID,
|
|
|
companyId, updaterId, updateTime, pd_text1, pd_text2, pd_text3, pd_text4, pd_text5,
|
|
|
pd_yqty
|
|
|
@@ -75,183 +76,180 @@
|
|
|
delete from purchasedetail
|
|
|
where PD_ID = #{id}
|
|
|
</delete>
|
|
|
- <insert id="insert" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
|
|
|
- insert into purchasedetail (PD_PUID, PD_CODE,
|
|
|
- PD_DETNO, PD_PRODID, PD_PRODCODE,
|
|
|
- PD_UNIT, PD_QTY, PD_PRICE,
|
|
|
- PD_TOTAL, PD_TAXTOTAL, PD_ACCEPTQTY,
|
|
|
- PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
|
|
|
- PD_SDID, companyId, updaterId,
|
|
|
- updateTime, pd_text1, pd_text2,
|
|
|
- pd_text3, pd_text4, pd_text5,
|
|
|
- pd_yqty)
|
|
|
- values (#{pdPuid,jdbcType=INTEGER}, #{pdCode,jdbcType=VARCHAR},
|
|
|
- #{pdDetno,jdbcType=INTEGER}, #{pdProdid,jdbcType=INTEGER}, #{pdProdcode,jdbcType=VARCHAR},
|
|
|
- #{pdUnit,jdbcType=VARCHAR}, #{pdQty,jdbcType=DOUBLE}, #{pdPrice,jdbcType=DOUBLE},
|
|
|
- #{pdTotal,jdbcType=DOUBLE}, #{pdTaxtotal,jdbcType=DOUBLE}, #{pdAcceptqty,jdbcType=DOUBLE},
|
|
|
- #{pdDelivery,jdbcType=DOUBLE}, #{pdSalecode,jdbcType=VARCHAR}, #{pdSaledetno,jdbcType=INTEGER},
|
|
|
- #{pdSdid,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
|
|
|
- #{updateTime,jdbcType=TIMESTAMP}, #{pdText1,jdbcType=VARCHAR}, #{pdText2,jdbcType=VARCHAR},
|
|
|
- #{pdText3,jdbcType=VARCHAR}, #{pdText4,jdbcType=VARCHAR}, #{pdText5,jdbcType=VARCHAR},
|
|
|
- #{pdYqty,jdbcType=DOUBLE})
|
|
|
- </insert>
|
|
|
- <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
|
|
|
+
|
|
|
+ <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail">
|
|
|
+ <selectKey resultType="java.lang.Long" keyProperty="id">
|
|
|
+ SELECT LAST_INSERT_ID() AS ID
|
|
|
+ </selectKey>
|
|
|
insert into purchasedetail
|
|
|
- <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
- <if test="pdPuid != null" >
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="PD_ID != null">
|
|
|
+ PD_ID,
|
|
|
+ </if>
|
|
|
+ <if test="PD_PUID != null">
|
|
|
PD_PUID,
|
|
|
</if>
|
|
|
- <if test="pdCode != null" >
|
|
|
+ <if test="PD_CODE != null">
|
|
|
PD_CODE,
|
|
|
</if>
|
|
|
- <if test="pdDetno != null" >
|
|
|
+ <if test="PD_DETNO != null">
|
|
|
PD_DETNO,
|
|
|
</if>
|
|
|
- <if test="pdProdid != null" >
|
|
|
+ <if test="PD_PRODID != null">
|
|
|
PD_PRODID,
|
|
|
</if>
|
|
|
- <if test="pdProdcode != null" >
|
|
|
+ <if test="PD_PRODCODE != null">
|
|
|
PD_PRODCODE,
|
|
|
</if>
|
|
|
- <if test="pdUnit != null" >
|
|
|
+ <if test="PD_UNIT != null">
|
|
|
PD_UNIT,
|
|
|
</if>
|
|
|
- <if test="pdQty != null" >
|
|
|
+ <if test="PD_QTY != null">
|
|
|
PD_QTY,
|
|
|
</if>
|
|
|
- <if test="pdPrice != null" >
|
|
|
+ <if test="PD_YQTY != null">
|
|
|
+ PD_YQTY,
|
|
|
+ </if>
|
|
|
+ <if test="PD_PRICE != null">
|
|
|
PD_PRICE,
|
|
|
</if>
|
|
|
- <if test="pdTotal != null" >
|
|
|
+ <if test="PD_TAXPRICE != null">
|
|
|
+ PD_TAXPRICE,
|
|
|
+ </if>
|
|
|
+ <if test="PD_TOTAL != null">
|
|
|
PD_TOTAL,
|
|
|
</if>
|
|
|
- <if test="PD_TAXRATE != null" >
|
|
|
+ <if test="PD_TAXRATE != null">
|
|
|
PD_TAXRATE,
|
|
|
</if>
|
|
|
- <if test="pdTaxtotal != null" >
|
|
|
+ <if test="PD_TAXTOTAL != null">
|
|
|
PD_TAXTOTAL,
|
|
|
</if>
|
|
|
- <if test="pdAcceptqty != null" >
|
|
|
+ <if test="PD_ACCEPTQTY != null">
|
|
|
PD_ACCEPTQTY,
|
|
|
</if>
|
|
|
- <if test="pdDelivery != null" >
|
|
|
+ <if test="PD_DELIVERY != null">
|
|
|
PD_DELIVERY,
|
|
|
</if>
|
|
|
- <if test="pdSalecode != null" >
|
|
|
+ <if test="PD_SALECODE != null">
|
|
|
PD_SALECODE,
|
|
|
</if>
|
|
|
- <if test="pdSaledetno != null" >
|
|
|
+ <if test="PD_SALEDETNO != null">
|
|
|
PD_SALEDETNO,
|
|
|
</if>
|
|
|
- <if test="pdSdid != null" >
|
|
|
+ <if test="PD_SDID != null">
|
|
|
PD_SDID,
|
|
|
</if>
|
|
|
- <if test="companyId != null" >
|
|
|
+ <if test="companyId != null">
|
|
|
companyId,
|
|
|
</if>
|
|
|
- <if test="updaterId != null" >
|
|
|
+ <if test="updaterId != null">
|
|
|
updaterId,
|
|
|
</if>
|
|
|
- <if test="updateTime != null" >
|
|
|
+ <if test="updateTime != null">
|
|
|
updateTime,
|
|
|
</if>
|
|
|
- <if test="pdText1 != null" >
|
|
|
+ <if test="pd_text1 != null">
|
|
|
pd_text1,
|
|
|
</if>
|
|
|
- <if test="pdText2 != null" >
|
|
|
+ <if test="pd_text2 != null">
|
|
|
pd_text2,
|
|
|
</if>
|
|
|
- <if test="pdText3 != null" >
|
|
|
+ <if test="pd_text3 != null">
|
|
|
pd_text3,
|
|
|
</if>
|
|
|
- <if test="pdText4 != null" >
|
|
|
+ <if test="pd_text4 != null">
|
|
|
pd_text4,
|
|
|
</if>
|
|
|
- <if test="pdText5 != null" >
|
|
|
+ <if test="pd_text5 != null">
|
|
|
pd_text5,
|
|
|
</if>
|
|
|
- <if test="pdYqty != null" >
|
|
|
- pd_yqty,
|
|
|
- </if>
|
|
|
</trim>
|
|
|
- <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
- <if test="pdPuid != null" >
|
|
|
- #{pdPuid,jdbcType=INTEGER},
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+
|
|
|
+ <if test="PD_PUID != null">
|
|
|
+ #{PD_PUID,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="PD_CODE != null">
|
|
|
+ #{PD_CODE,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdCode != null" >
|
|
|
- #{pdCode,jdbcType=VARCHAR},
|
|
|
+ <if test="PD_DETNO != null">
|
|
|
+ #{PD_DETNO,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="pdDetno != null" >
|
|
|
- #{pdDetno,jdbcType=INTEGER},
|
|
|
+ <if test="PD_PRODID != null">
|
|
|
+ #{PD_PRODID,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="pdProdid != null" >
|
|
|
- #{pdProdid,jdbcType=INTEGER},
|
|
|
+ <if test="PD_PRODCODE != null">
|
|
|
+ #{PD_PRODCODE,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdProdcode != null" >
|
|
|
- #{pdProdcode,jdbcType=VARCHAR},
|
|
|
+ <if test="PD_UNIT != null">
|
|
|
+ #{PD_UNIT,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdUnit != null" >
|
|
|
- #{pdUnit,jdbcType=VARCHAR},
|
|
|
+ <if test="PD_QTY != null">
|
|
|
+ #{PD_QTY,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="pdQty != null" >
|
|
|
- #{pdQty,jdbcType=DOUBLE},
|
|
|
+ <if test="PD_YQTY != null">
|
|
|
+ #{PD_YQTY,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="pdPrice != null" >
|
|
|
- #{pdPrice,jdbcType=DOUBLE},
|
|
|
+ <if test="PD_PRICE != null">
|
|
|
+ #{PD_PRICE,jdbcType=DOUBLE},
|
|
|
</if>
|
|
|
- <if test="pdTotal != null" >
|
|
|
- #{pdTotal,jdbcType=DOUBLE},
|
|
|
+ <if test="PD_TAXPRICE != null">
|
|
|
+ #{PD_TAXPRICE,jdbcType=DOUBLE},
|
|
|
</if>
|
|
|
- <if test="PD_TAXRATE != null" >
|
|
|
+ <if test="PD_TOTAL != null">
|
|
|
+ #{PD_TOTAL,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="PD_TAXRATE != null">
|
|
|
#{PD_TAXRATE,jdbcType=DOUBLE},
|
|
|
</if>
|
|
|
- <if test="pdTaxtotal != null" >
|
|
|
- #{pdTaxtotal,jdbcType=DOUBLE},
|
|
|
+ <if test="PD_TAXTOTAL != null">
|
|
|
+ #{PD_TAXTOTAL,jdbcType=DOUBLE},
|
|
|
</if>
|
|
|
- <if test="pdAcceptqty != null" >
|
|
|
- #{pdAcceptqty,jdbcType=DOUBLE},
|
|
|
+ <if test="PD_ACCEPTQTY != null">
|
|
|
+ #{PD_ACCEPTQTY,jdbcType=DOUBLE},
|
|
|
</if>
|
|
|
- <if test="pdDelivery != null" >
|
|
|
- #{pdDelivery,jdbcType=TIMESTAMP},
|
|
|
+ <if test="PD_DELIVERY != null">
|
|
|
+ #{PD_DELIVERY,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
- <if test="pdSalecode != null" >
|
|
|
- #{pdSalecode,jdbcType=VARCHAR},
|
|
|
+ <if test="PD_SALECODE != null">
|
|
|
+ #{PD_SALECODE,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdSaledetno != null" >
|
|
|
- #{pdSaledetno,jdbcType=INTEGER},
|
|
|
+ <if test="PD_SALEDETNO != null">
|
|
|
+ #{PD_SALEDETNO,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="pdSdid != null" >
|
|
|
- #{pdSdid,jdbcType=INTEGER},
|
|
|
+ <if test="PD_SDID != null">
|
|
|
+ #{PD_SDID,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="companyId != null" >
|
|
|
+ <if test="companyId != null">
|
|
|
#{companyId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="updaterId != null" >
|
|
|
+ <if test="updaterId != null">
|
|
|
#{updaterId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="updateTime != null" >
|
|
|
+ <if test="updateTime != null">
|
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
- <if test="pdText1 != null" >
|
|
|
- #{pdText1,jdbcType=VARCHAR},
|
|
|
- </if>
|
|
|
- <if test="pdText2 != null" >
|
|
|
- #{pdText2,jdbcType=VARCHAR},
|
|
|
+ <if test="pd_text1 != null">
|
|
|
+ #{pd_text1,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdText3 != null" >
|
|
|
- #{pdText3,jdbcType=VARCHAR},
|
|
|
+ <if test="pd_text2 != null">
|
|
|
+ #{pd_text2,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdText4 != null" >
|
|
|
- #{pdText4,jdbcType=VARCHAR},
|
|
|
+ <if test="pd_text3 != null">
|
|
|
+ #{pd_text3,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdText5 != null" >
|
|
|
- #{pdText5,jdbcType=VARCHAR},
|
|
|
+ <if test="pd_text4 != null">
|
|
|
+ #{pd_text4,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
- <if test="pdYqty != null" >
|
|
|
- #{pdYqty,jdbcType=DOUBLE},
|
|
|
+ <if test="pd_text5 != null">
|
|
|
+ #{pd_text5,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
|
|
|
update purchasedetail
|
|
|
<set >
|
|
|
@@ -334,38 +332,11 @@
|
|
|
</set>
|
|
|
where PD_ID = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
- <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
|
|
|
- update purchasedetail
|
|
|
- set PD_PUID = #{pdPuid,jdbcType=INTEGER},
|
|
|
- PD_CODE = #{pdCode,jdbcType=VARCHAR},
|
|
|
- PD_DETNO = #{pdDetno,jdbcType=INTEGER},
|
|
|
- PD_PRODID = #{pdProdid,jdbcType=INTEGER},
|
|
|
- PD_PRODCODE = #{pdProdcode,jdbcType=VARCHAR},
|
|
|
- PD_UNIT = #{pdUnit,jdbcType=VARCHAR},
|
|
|
- PD_QTY = #{pdQty,jdbcType=DOUBLE},
|
|
|
- PD_PRICE = #{pdPrice,jdbcType=DOUBLE},
|
|
|
- PD_TOTAL = #{pdTotal,jdbcType=DOUBLE},
|
|
|
- PD_TAXTOTAL = #{pdTaxtotal,jdbcType=DOUBLE},
|
|
|
- PD_ACCEPTQTY = #{pdAcceptqty,jdbcType=DOUBLE},
|
|
|
- PD_DELIVERY = #{pdDelivery,jdbcType=DOUBLE},
|
|
|
- PD_SALECODE = #{pdSalecode,jdbcType=VARCHAR},
|
|
|
- PD_SALEDETNO = #{pdSaledetno,jdbcType=INTEGER},
|
|
|
- PD_SDID = #{pdSdid,jdbcType=INTEGER},
|
|
|
- companyId = #{companyId,jdbcType=INTEGER},
|
|
|
- updaterId = #{updaterId,jdbcType=INTEGER},
|
|
|
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
- pd_text1 = #{pdText1,jdbcType=VARCHAR},
|
|
|
- pd_text2 = #{pdText2,jdbcType=VARCHAR},
|
|
|
- pd_text3 = #{pdText3,jdbcType=VARCHAR},
|
|
|
- pd_text4 = #{pdText4,jdbcType=VARCHAR},
|
|
|
- pd_text5 = #{pdText5,jdbcType=VARCHAR},
|
|
|
- pd_yqty = #{pdYqty,jdbcType=DOUBLE}
|
|
|
- where PD_ID = #{id,jdbcType=INTEGER}
|
|
|
- </update>
|
|
|
+
|
|
|
<insert id="batchInsert" parameterType="java.util.List" >
|
|
|
insert into purchasedetail ( PD_PUID, PD_CODE,
|
|
|
PD_DETNO, PD_PRODID, PD_PRODCODE,
|
|
|
- PD_UNIT, PD_QTY, PD_PRICE,
|
|
|
+ PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
|
|
|
PD_TOTAL,PD_TAXRATE, PD_TAXTOTAL, PD_ACCEPTQTY,
|
|
|
PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
|
|
|
PD_SDID, companyId, updaterId,
|
|
|
@@ -377,7 +348,7 @@
|
|
|
(
|
|
|
#{item.pd_puid,jdbcType=INTEGER}, #{item.pd_code,jdbcType=VARCHAR},
|
|
|
#{item.pd_detno,jdbcType=INTEGER}, #{item.pd_prodid,jdbcType=INTEGER}, #{item.pd_prodcode,jdbcType=VARCHAR},
|
|
|
- #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},
|
|
|
+ #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},#{item.pd_taxprice,jdbcType=DOUBLE},
|
|
|
#{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE}, #{item.pd_taxtotal,jdbcType=DOUBLE}, #{item.pd_acceptqty,jdbcType=DOUBLE},
|
|
|
#{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},
|
|
|
#{item.pd_sdid,jdbcType=INTEGER}, #{item.companyId,jdbcType=INTEGER}, #{item.updaterId,jdbcType=INTEGER},
|
|
|
@@ -398,6 +369,7 @@
|
|
|
PD_UNIT = #{item.pd_unit},
|
|
|
PD_QTY = #{item.pd_qty},
|
|
|
PD_PRICE = #{item.pd_price},
|
|
|
+ PD_TAXPRICE = #{item.pd_taxprice},
|
|
|
PD_TOTAL = #{item.pd_total},
|
|
|
PD_TAXRATE = #{item.pd_taxrate},
|
|
|
PD_TAXTOTAL = #{item.pd_taxtotal},
|
|
|
@@ -437,10 +409,10 @@
|
|
|
|
|
|
|
|
|
<update id="calcPurchase" parameterType="long" >
|
|
|
- update purchasedetail set pd_netprice = PD_PRICE/(1+pd_taxrate/100) where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
- update purchasedetail set pd_total = PD_PRICE*pd_qty,pd_nettotal = pd_netprice*pd_inqty where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
- update purchase set pu_total = (select sum(pd_total) from prodiodetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
- update purchase set p_nettotal = (select sum(pd_nettotal) from prodiodetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchasedetail set pd_taxprice = ifnull(PD_PRICE,0)/(1+ifnull(pd_taxrate,0)/100) where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchasedetail set pd_total = ifnull(PD_PRICE,0)*ifnull(pd_qty,0),pd_taxtotal = pd_taxprice*ifnull(pd_qty,0) where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchase set pu_total = (select sum(pd_total) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchase set PU_TAXTOTAL = (select sum(pd_taxtotal) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
</update>
|
|
|
|
|
|
|