|
|
@@ -760,4 +760,161 @@
|
|
|
<select id="checkStatus" resultType="int">
|
|
|
select count(1) from paybalance where ifnull(pb_statuscode,'')='AUDITED' and pb_id= #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--供应商应付-->
|
|
|
+ <resultMap id="VendApResultMap" type="com.usoftchina.saas.money.po.VendApamount">
|
|
|
+ <id column="va_id" jdbcType="INTEGER" property="id" />
|
|
|
+ <result column="va_vendid" jdbcType="INTEGER" property="va_vendid" />
|
|
|
+ <result column="va_vendcode" jdbcType="VARCHAR" property="va_vendcode" />
|
|
|
+ <result column="va_vendname" jdbcType="VARCHAR" property="va_vendname" />
|
|
|
+ <result column="va_currency" jdbcType="VARCHAR" property="va_currency" />
|
|
|
+ <result column="va_begindate" jdbcType="TIMESTAMP" property="va_begindate" />
|
|
|
+ <result column="va_beginapamount" jdbcType="DOUBLE" property="va_beginapamount" />
|
|
|
+ <result column="va_beginprepayamount" jdbcType="DOUBLE" property="va_beginprepayamount" />
|
|
|
+ <result column="va_preamount" jdbcType="DOUBLE" property="va_preamount" />
|
|
|
+ <result column="va_payamount" jdbcType="DOUBLE" property="va_payamount" />
|
|
|
+ <result column="va_leftamount" jdbcType="DOUBLE" property="va_leftamount" />
|
|
|
+ <result column="companyid" jdbcType="INTEGER" property="companyId" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="VendApamount_Column_List">
|
|
|
+ va_id,va_vendid,va_vendcode,va_vendname,va_currency,va_begindate,va_beginapamount,va_beginprepayamount,va_preamount,va_payamount,va_leftamount,companyid
|
|
|
+ </sql>
|
|
|
+ <select id="selectVendApByCondition" resultMap="VendApResultMap">
|
|
|
+ select
|
|
|
+ <include refid="VendApamount_Column_List" />
|
|
|
+ from VendApamount
|
|
|
+ <where>
|
|
|
+ <if test="con != null">
|
|
|
+ ${con}
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ and VendApamount.companyId = #{companyId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <!--供应商+币别应付余额更新-->
|
|
|
+ <update id="updateVendApamountByPrimaryKeySelective" parameterType="com.usoftchina.saas.money.po.VendApamount">
|
|
|
+ update VendApamount
|
|
|
+ <set>
|
|
|
+ <if test="va_vendid != null">
|
|
|
+ va_vendid = #{va_vendid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="va_vendcode != null">
|
|
|
+ va_vendcode = #{va_vendcode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="va_vendname != null">
|
|
|
+ va_vendname = #{va_vendname,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="va_currency != null">
|
|
|
+ va_currency = #{va_currency,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="va_begindate != null">
|
|
|
+ va_begindate = #{va_begindate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="va_beginapamount != null">
|
|
|
+ va_beginapamount = #{va_beginapamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_beginprepayamount != null">
|
|
|
+ va_beginprepayamount = #{va_beginprepayamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_payamount != null">
|
|
|
+ va_payamount = #{va_payamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_preamount != null">
|
|
|
+ va_preamount = #{va_preamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_leftamount != null">
|
|
|
+ va_leftamount = #{va_leftamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ companyid = #{companyId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where va_id = #{id}
|
|
|
+ </update>
|
|
|
+ <update id="updateVendleftamountByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
+ update vendor
|
|
|
+ <set>
|
|
|
+ ve_leftamount=ifnull((select sum(va_leftamount*(case when ifnull(cr_rate,0)=0 then 1 else ifnull(cr_rate,0) end ))
|
|
|
+ from VendApamount left join currencys on cr_name=va_currency and VendApamount.companyid=currencys.companyid
|
|
|
+ where VendApamount.companyid=vendor.companyid and va_vendid=#{ve_id,jdbcType=INTEGER}),0)
|
|
|
+ </set>
|
|
|
+ where ve_id = #{ve_id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+ <insert id="insertVendApamount" parameterType="com.usoftchina.saas.money.po.VendApamount">
|
|
|
+ <selectKey resultType="java.lang.Long" keyProperty="id">
|
|
|
+ SELECT LAST_INSERT_ID() AS ID
|
|
|
+ </selectKey>
|
|
|
+ insert into VendApamount
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="companyId != null">
|
|
|
+ companyId,
|
|
|
+ </if>
|
|
|
+ <if test="va_vendid != null">
|
|
|
+ va_vendid,
|
|
|
+ </if>
|
|
|
+ <if test="va_vendcode != null">
|
|
|
+ va_vendcode,
|
|
|
+ </if>
|
|
|
+ <if test="va_vendname != null">
|
|
|
+ va_vendname,
|
|
|
+ </if>
|
|
|
+ <if test="va_currency != null">
|
|
|
+ va_currency,
|
|
|
+ </if>
|
|
|
+ <if test="va_begindate != null">
|
|
|
+ va_begindate,
|
|
|
+ </if>
|
|
|
+ <if test="va_beginapamount != null">
|
|
|
+ va_beginapamount,
|
|
|
+ </if>
|
|
|
+ <if test="va_beginprepayamount != null">
|
|
|
+ va_beginprepayamount,
|
|
|
+ </if>
|
|
|
+ <if test="va_payamount != null">
|
|
|
+ va_payamount,
|
|
|
+ </if>
|
|
|
+ <if test="va_preamount != null" >
|
|
|
+ va_preamount,
|
|
|
+ </if>
|
|
|
+ <if test="va_leftamount != null" >
|
|
|
+ va_leftamount,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="companyId != null">
|
|
|
+ #{companyId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="va_vendid != null">
|
|
|
+ #{va_vendid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="va_vendcode != null">
|
|
|
+ #{va_vendcode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="va_vendname != null">
|
|
|
+ #{va_vendname,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="va_currency != null">
|
|
|
+ #{va_currency,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="va_begindate != null">
|
|
|
+ #{va_begindate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="va_beginapamount != null">
|
|
|
+ #{va_beginapamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_beginprepayamount != null">
|
|
|
+ #{va_beginprepayamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_payamount != null">
|
|
|
+ #{va_payamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_preamount != null" >
|
|
|
+ #{va_preamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="va_leftamount != null" >
|
|
|
+ #{va_leftamount,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
</mapper>
|