| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.usoftchina.saas.document.mapper.VendApamountMapper">
- <resultMap id="VendApamountResultMapper" type="com.usoftchina.saas.document.entities.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_payamount" jdbcType="DOUBLE" property="va_payamount" />
- <result column="va_preamount" jdbcType="DOUBLE" property="va_preamount" />
- <result column="va_leftamount" jdbcType="DOUBLE" property="va_leftamount" />
- <result column="companyId" jdbcType="INTEGER" property="companyId" />
- <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
- <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="creatorName" jdbcType="VARCHAR" property="creatorName" />
- <result column="creatorId" jdbcType="INTEGER" property="creatorId" />
- <result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
- <result column="updaterName" jdbcType="VARCHAR" property="updaterName" />
- </resultMap>
- <resultMap id="VendApamountListResultMapper" type="com.usoftchina.saas.document.entities.VendApamountList">
- <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_payamount" jdbcType="DOUBLE" property="va_payamount" />
- <result column="va_preamount" jdbcType="DOUBLE" property="va_preamount" />
- <result column="va_leftamount" jdbcType="DOUBLE" property="va_leftamount" />
- </resultMap>
- <select id="getListDataByCondition" resultMap="VendApamountListResultMapper">
- SELECT * FROM VendApamount
- <where>
- <if test="condition!=null">
- ${condition}
- </if>
- AND VENDAPAMOUNT.COMPANYID = #{companyId}
- AND VENDAPAMOUNT.VA_BEGINDATE IS NOT NULL
- </where>
- order by VA_ID DESC
- </select>
- <sql id="Base_Column_List">
- va_id, va_vendid, va_vendcode, va_vendname, va_currency, va_begindate, va_beginapamount,
- va_beginprepayamount, va_payamount, va_preamount, va_leftamount, companyId, updaterId,
- updateTime, creatorName, creatorId, createTime, updaterName
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="VendApamountResultMapper">
- select
- <include refid="Base_Column_List" />
- from vendapamount
- where va_id = #{id}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from vendapamount
- where va_id = #{id}
- </delete>
- <select id="selectPeriod" resultType="string">
- select PD_DETNO from periodsdetail where companyid=#{companyId} and pd_detno is not null and pd_status=0 order by PD_DETNO LIMIT 1;
- </select>
- <select id="check" parameterMap="checkParamMap" statementType="CALLABLE">
- CALL SP_BEGINLIMIT(?, ?, ?, ?, ?,?)
- </select>
- <parameterMap id="checkParamMap" type="java.util.Map">
- <parameter property="v_type" jdbcType="VARCHAR" mode="IN" />
- <parameter property="v_id" jdbcType="INTEGER" mode="IN" />
- <parameter property="v_code" jdbcType="VARCHAR" mode="IN" />
- <parameter property="v_currency" jdbcType="VARCHAR" mode="IN" />
- <parameter property="v_companyid" jdbcType="INTEGER" mode="IN" />
- <parameter property="v_res" jdbcType="VARCHAR" mode="OUT" />
- </parameterMap>
- <select id="checkForImport" parameterMap="checkForImportParamMap" statementType="CALLABLE">
- CALL SP_CUSTARORVENDAPAFTER(?, ?)
- </select>
- <parameterMap id="checkForImportParamMap" type="java.util.Map">
- <parameter property="v_type" jdbcType="VARCHAR" mode="IN" />
- <parameter property="v_companyid" jdbcType="INTEGER" mode="IN" />
- </parameterMap>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.VendApamount">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into vendapamount
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <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>
- <if test="companyId != null">
- companyId,
- </if>
- <if test="updaterId != null">
- updaterId,
- </if>
- <if test="updateTime != null">
- updateTime,
- </if>
- <if test="creatorName != null">
- creatorName,
- </if>
- <if test="creatorId != null">
- creatorId,
- </if>
- <if test="createTime != null">
- createTime,
- </if>
- <if test="updaterName != null">
- updaterName,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <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>
- <if test="companyId != null">
- #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null">
- #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="creatorName != null">
- #{creatorName,jdbcType=VARCHAR},
- </if>
- <if test="creatorId != null">
- #{creatorId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updaterName != null">
- #{updaterName,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.VendApamount">
- update vendapamount
- <set>
- <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_leftamount != null">
- va_leftamount = #{va_leftamount,jdbcType=DOUBLE},
- </if>
- <if test="updaterId != null">
- updaterId = #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null">
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updaterName != null">
- updaterName = #{updaterName,jdbcType=VARCHAR},
- </if>
- </set>
- where va_id = #{id}
- </update>
- <select id="checkBeginData" resultType="int">
- SELECT COUNT(*) FROM periodsdetail
- <where>
- pd_status = 99
- <if test="pd_detno!=null">
- and pd_detno=#{pd_detno}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- </where>
- </select>
- <select id="hasVendNameByCode" resultType="int">
- SELECT COUNT(*) FROM vendor
- <where>
- ve_statuscode = 'ENABLE'
- <if test="vendCode!=null">
- and ve_code=#{vendCode}
- </if>
- <if test="vendName!=null">
- and ve_Name=#{vendName}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- </where>
- </select>
- <select id="getVendApamount" resultMap="VendApamountResultMapper">
- SELECT * FROM vendapamount
- <where>
- <if test="id!=null">
- and va_id=#{id}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- </where>
- </select>
- <select id="hasVendCode" resultType="int">
- SELECT COUNT(*) FROM vendor
- <where>
- ve_statuscode = 'ENABLE'
- <if test="name!=null">
- and VE_CODE=#{name}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- </where>
- </select>
- <select id="hasCurrency" resultType="int">
- SELECT COUNT(*) FROM currencys
- <where>
- <if test="name!=null">
- and cr_name=#{name}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- </where>
- </select>
- <select id="getVendApamountByVendCodeAndCurrency" resultMap="VendApamountResultMapper">
- SELECT * FROM vendapamount
- <where>
- <if test="vendcode!=null">
- and va_vendcode=#{vendcode}
- </if>
- <if test="currency!=null">
- and va_currency=#{currency}
- </if>
- <if test="id!=0">
- and va_id!=#{id}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- </where>
- </select>
- <update id="updateCodeAndNameByVendid">
- update vendapamount inner join vendor on ve_id=va_vendid and vendor.companyid=vendapamount.companyid
- set va_vendcode=ve_Code ,
- va_vendname=ve_name
- where va_vendid=#{ve_id}
- </update>
- <delete id="deleteByVendid" parameterType="java.lang.Long">
- delete from vendapamount
- where va_vendid = #{ve_id}
- </delete>
- <insert id="batchInsert" parameterType="java.util.List">
- INSERT INTO vendapamount (va_vendid, va_vendcode, va_vendname, va_currency, va_begindate, va_beginapamount,
- va_beginprepayamount, va_payamount, va_preamount, va_leftamount, companyId, creatorName, creatorId, createTime)
- VALUES
- <foreach collection="list" item="item" index="index" open="" close="" separator=",">
- (
- #{item.va_vendid,jdbcType=INTEGER},
- #{item.va_vendcode,jdbcType=VARCHAR}, #{item.va_vendname,jdbcType=VARCHAR}, #{item.va_currency,jdbcType=VARCHAR},
- #{item.va_begindate,jdbcType=TIMESTAMP}, #{item.va_beginapamount,jdbcType=DOUBLE}, #{item.va_beginprepayamount,jdbcType=DOUBLE},
- #{item.va_payamount,jdbcType=DOUBLE},#{item.va_preamount,jdbcType=DOUBLE}, #{item.va_leftamount,jdbcType=DOUBLE},
- #{item.companyId,jdbcType=INTEGER},#{item.creatorName,jdbcType=VARCHAR}, #{item.creatorId,jdbcType=INTEGER},
- #{item.createTime,jdbcType=TIMESTAMP}
- )
- </foreach>
- </insert>
- <update id="batchUpdate" parameterType="com.usoftchina.saas.document.entities.VendApamount">
- <foreach collection="list" item="item" index="index" separator=";">
- update vendapamount
- <set>
- <if test="item.va_beginapamount != null">
- va_beginapamount = #{item.va_beginapamount,jdbcType=DOUBLE},
- </if>
- <if test="item.va_beginprepayamount != null">
- va_beginprepayamount = #{item.va_beginprepayamount,jdbcType=DOUBLE},
- </if>
- <if test="item.va_leftamount != null">
- va_leftamount = #{item.va_leftamount,jdbcType=DOUBLE},
- </if>
- <if test="item.updaterId != null">
- updaterId = #{item.updaterId,jdbcType=INTEGER},
- </if>
- <if test="item.updateTime != null">
- updateTime = #{item.updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="item.updaterName != null">
- updaterName = #{item.updaterName,jdbcType=VARCHAR},
- </if>
- </set>
- where va_id = #{item.id}
- </foreach>
- </update>
- <select id="checkVerification" resultType="java.lang.Integer">
- select count(1) from subledger
- where sl_kind='期初余额' and sl_vendid=#{ve_id} and sl_currency=#{currency}
- and (ifnull(sl_yamount,0)!=0
- or exists(select 1 from verificationdet where vd_slid=sl_id)
- or exists(select 1 from verificationdetail where vcd_slid=sl_id))
- </select>
- </mapper>
|