| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- <?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.CustomerMapper">
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Customer">
- <id column="cu_id" jdbcType="INTEGER" property="id" />
- <result column="cu_code" jdbcType="VARCHAR" property="cu_code" />
- <result column="cu_name" jdbcType="VARCHAR" property="cu_name" />
- <result column="cu_uu" jdbcType="VARCHAR" property="cu_uu" />
- <result column="cu_type" jdbcType="VARCHAR" property="cu_type" />
- <result column="cu_begindate" jdbcType="TIMESTAMP" property="cu_begindate" />
- <result column="cu_beginaramount" jdbcType="DOUBLE" property="cu_beginaramount" />
- <result column="cu_beginprerecamount" jdbcType="DOUBLE" property="cu_beginprerecamount" />
- <result column="cu_promisedays" jdbcType="DOUBLE" property="cu_promisedays" />
- <result column="cu_taxrate" jdbcType="DOUBLE" property="cu_taxrate" />
- <result column="cu_sellerid" jdbcType="INTEGER" property="cu_sellerid" />
- <result column="cu_sellercode" jdbcType="VARCHAR" property="cu_sellercode" />
- <result column="cu_sellername" jdbcType="VARCHAR" property="cu_sellername" />
- <result column="cu_credit" jdbcType="DOUBLE" property="cu_credit" />
- <result column="cu_status" jdbcType="VARCHAR" property="cu_status" />
- <result column="cu_statuscode" jdbcType="VARCHAR" property="cu_statuscode" />
- <result column="cu_recordmanid" jdbcType="INTEGER" property="cu_recordmanid" />
- <result column="cu_recordman" jdbcType="VARCHAR" property="cu_recordman" />
- <result column="cu_recorddate" jdbcType="TIMESTAMP" property="cu_recorddate" />
- <result column="companyid" jdbcType="INTEGER" property="companyId" />
- <result column="updaterid" jdbcType="INTEGER" property="updaterId" />
- <result column="updatetime" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="cu_text1" jdbcType="VARCHAR" property="cu_text1" />
- <result column="cu_text2" jdbcType="VARCHAR" property="cu_text2" />
- <result column="cu_text3" jdbcType="VARCHAR" property="cu_text3" />
- <result column="cu_text4" jdbcType="VARCHAR" property="cu_text4" />
- <result column="cu_text5" jdbcType="VARCHAR" property="cu_text5" />
- <result column="cu_leftamount" jdbcType="DOUBLE" property="cu_leftamount" />
- <result column="cu_recamount" jdbcType="DOUBLE" property="cu_recamount" />
- </resultMap>
- <sql id="Base_Column_List">
- cu_id, cu_code, cu_name, cu_uu, cu_type, cu_begindate, cu_beginaramount, cu_beginprerecamount,
- cu_promisedays, cu_taxrate, cu_sellerid, cu_sellercode, cu_sellername, cu_credit,
- cu_status, cu_statuscode, cu_recordmanid, cu_recordman, cu_recorddate, companyid,
- updaterid, updatetime, cu_text1, cu_text2, cu_text3, cu_text4, cu_text5, cu_leftamount,
- cu_recamount
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from customer
- where cu_id = #{cu_id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from customer
- where cu_id = #{cu_id,jdbcType=INTEGER}
- </delete>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Customer">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into customer
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="cu_code != null">
- cu_code,
- </if>
- <if test="cu_name != null">
- cu_name,
- </if>
- <if test="cu_uu != null">
- cu_uu,
- </if>
- <if test="cu_type != null">
- cu_type,
- </if>
- <if test="cu_begindate != null">
- cu_begindate,
- </if>
- <if test="cu_beginaramount != null">
- cu_beginaramount,
- </if>
- <if test="cu_beginprerecamount != null">
- cu_beginprerecamount,
- </if>
- <if test="cu_promisedays != null">
- cu_promisedays,
- </if>
- <if test="cu_taxrate != null">
- cu_taxrate,
- </if>
- <if test="cu_sellerid != null">
- cu_sellerid,
- </if>
- <if test="cu_sellercode != null">
- cu_sellercode,
- </if>
- <if test="cu_sellername != null">
- cu_sellername,
- </if>
- <if test="cu_credit != null">
- cu_credit,
- </if>
- <if test="cu_status != null">
- cu_status,
- </if>
- <if test="cu_statuscode != null">
- cu_statuscode,
- </if>
- <if test="cu_recordmanid != null">
- cu_recordmanid,
- </if>
- <if test="cu_recordman != null">
- cu_recordman,
- </if>
- <if test="cu_recorddate != null">
- cu_recorddate,
- </if>
- <if test="companyId != null">
- companyid,
- </if>
- <if test="updaterId != null">
- updaterid,
- </if>
- <if test="updateTime != null">
- updatetime,
- </if>
- <if test="cu_text1 != null">
- cu_text1,
- </if>
- <if test="cu_text2 != null">
- cu_text2,
- </if>
- <if test="cu_text3 != null">
- cu_text3,
- </if>
- <if test="cu_text4 != null">
- cu_text4,
- </if>
- <if test="cu_text5 != null">
- cu_text5,
- </if>
- <if test="cu_leftamount != null">
- cu_leftamount,
- </if>
- <if test="cu_recamount != null">
- cu_recamount,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="cu_code != null">
- #{cu_code,jdbcType=VARCHAR},
- </if>
- <if test="cu_name != null">
- #{cu_name,jdbcType=VARCHAR},
- </if>
- <if test="cu_uu != null">
- #{cu_uu,jdbcType=VARCHAR},
- </if>
- <if test="cu_type != null">
- #{cu_type,jdbcType=VARCHAR},
- </if>
- <if test="cu_begindate != null">
- #{cu_begindate,jdbcType=TIMESTAMP},
- </if>
- <if test="cu_beginaramount != null">
- #{cu_beginaramount,jdbcType=DOUBLE},
- </if>
- <if test="cu_beginprerecamount != null">
- #{cu_beginprerecamount,jdbcType=DOUBLE},
- </if>
- <if test="cu_promisedays != null">
- #{cu_promisedays,jdbcType=DOUBLE},
- </if>
- <if test="cu_taxrate != null">
- #{cu_taxrate,jdbcType=DOUBLE},
- </if>
- <if test="cu_sellerid != null">
- #{cu_sellerid,jdbcType=INTEGER},
- </if>
- <if test="cu_sellercode != null">
- #{cu_sellercode,jdbcType=VARCHAR},
- </if>
- <if test="cu_sellername != null">
- #{cu_sellername,jdbcType=VARCHAR},
- </if>
- <if test="cu_credit != null">
- #{cu_credit,jdbcType=DOUBLE},
- </if>
- <if test="cu_status != null">
- #{cu_status,jdbcType=VARCHAR},
- </if>
- <if test="cu_statuscode != null">
- #{cu_statuscode,jdbcType=VARCHAR},
- </if>
- <if test="cu_recordmanid != null">
- #{cu_recordmanid,jdbcType=INTEGER},
- </if>
- <if test="cu_recordman != null">
- #{cu_recordman,jdbcType=VARCHAR},
- </if>
- <if test="cu_recorddate != null">
- #{cu_recorddate,jdbcType=TIMESTAMP},
- </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="cu_text1 != null">
- #{cu_text1,jdbcType=VARCHAR},
- </if>
- <if test="cu_text2 != null">
- #{cu_text2,jdbcType=VARCHAR},
- </if>
- <if test="cu_text3 != null">
- #{cu_text3,jdbcType=VARCHAR},
- </if>
- <if test="cu_text4 != null">
- #{cu_text4,jdbcType=VARCHAR},
- </if>
- <if test="cu_text5 != null">
- #{cu_text5,jdbcType=VARCHAR},
- </if>
- <if test="cu_leftamount != null">
- #{cu_leftamount,jdbcType=DOUBLE},
- </if>
- <if test="cu_recamount != null">
- #{cu_recamount,jdbcType=DOUBLE},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Customer">
- update customer
- <set>
- <if test="cu_code != null">
- cu_code = #{cu_code,jdbcType=VARCHAR},
- </if>
- <if test="cu_name != null">
- cu_name = #{cu_name,jdbcType=VARCHAR},
- </if>
- <if test="cu_uu != null">
- cu_uu = #{cu_uu,jdbcType=VARCHAR},
- </if>
- <if test="cu_type != null">
- cu_type = #{cu_type,jdbcType=VARCHAR},
- </if>
- <if test="cu_begindate != null">
- cu_begindate = #{cu_begindate,jdbcType=TIMESTAMP},
- </if>
- <if test="cu_beginaramount != null">
- cu_beginaramount = #{cu_beginaramount,jdbcType=DOUBLE},
- </if>
- <if test="cu_beginprerecamount != null">
- cu_beginprerecamount = #{cu_beginprerecamount,jdbcType=DOUBLE},
- </if>
- <if test="cu_promisedays != null">
- cu_promisedays = #{cu_promisedays,jdbcType=DOUBLE},
- </if>
- <if test="cu_taxrate != null">
- cu_taxrate = #{cu_taxrate,jdbcType=DOUBLE},
- </if>
- <if test="cu_sellerid != null">
- cu_sellerid = #{cu_sellerid,jdbcType=INTEGER},
- </if>
- <if test="cu_sellercode != null">
- cu_sellercode = #{cu_sellercode,jdbcType=VARCHAR},
- </if>
- <if test="cu_sellername != null">
- cu_sellername = #{cu_sellername,jdbcType=VARCHAR},
- </if>
- <if test="cu_credit != null">
- cu_credit = #{cu_credit,jdbcType=DOUBLE},
- </if>
- <if test="cu_status != null">
- cu_status = #{cu_status,jdbcType=VARCHAR},
- </if>
- <if test="cu_statuscode != null">
- cu_statuscode = #{cu_statuscode,jdbcType=VARCHAR},
- </if>
- <if test="cu_recordmanid != null">
- cu_recordmanid = #{cu_recordmanid,jdbcType=INTEGER},
- </if>
- <if test="cu_recordman != null">
- cu_recordman = #{cu_recordman,jdbcType=VARCHAR},
- </if>
- <if test="cu_recorddate != null">
- cu_recorddate = #{cu_recorddate,jdbcType=TIMESTAMP},
- </if>
- <if test="companyId != null">
- companyid = #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null">
- updaterid = #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null">
- updatetime = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="cu_text1 != null">
- cu_text1 = #{cu_text1,jdbcType=VARCHAR},
- </if>
- <if test="cu_text2 != null">
- cu_text2 = #{cu_text2,jdbcType=VARCHAR},
- </if>
- <if test="cu_text3 != null">
- cu_text3 = #{cu_text3,jdbcType=VARCHAR},
- </if>
- <if test="cu_text4 != null">
- cu_text4 = #{cu_text4,jdbcType=VARCHAR},
- </if>
- <if test="cu_text5 != null">
- cu_text5 = #{cu_text5,jdbcType=VARCHAR},
- </if>
- <if test="cu_leftamount != null">
- cu_leftamount = #{cu_leftamount,jdbcType=DOUBLE},
- </if>
- <if test="cu_recamount != null">
- cu_recamount = #{cu_recamount,jdbcType=DOUBLE},
- </if>
- </set>
- where cu_id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Customer">
- update customer
- set cu_code = #{cu_code,jdbcType=VARCHAR},
- cu_name = #{cu_name,jdbcType=VARCHAR},
- cu_uu = #{cu_uu,jdbcType=VARCHAR},
- cu_type = #{cu_type,jdbcType=VARCHAR},
- cu_begindate = #{cu_begindate,jdbcType=TIMESTAMP},
- cu_beginaramount = #{cu_beginaramount,jdbcType=DOUBLE},
- cu_beginprerecamount = #{cu_beginprerecamount,jdbcType=DOUBLE},
- cu_promisedays = #{cu_promisedays,jdbcType=DOUBLE},
- cu_taxrate = #{cu_taxrate,jdbcType=DOUBLE},
- cu_sellerid = #{cu_sellerid,jdbcType=INTEGER},
- cu_sellercode = #{cu_sellercode,jdbcType=VARCHAR},
- cu_sellername = #{cu_sellername,jdbcType=VARCHAR},
- cu_credit = #{cu_credit,jdbcType=DOUBLE},
- cu_status = #{cu_status,jdbcType=VARCHAR},
- cu_statuscode = #{cu_statuscode,jdbcType=VARCHAR},
- cu_recordmanid = #{cu_recordmanid,jdbcType=INTEGER},
- cu_recordman = #{cu_recordman,jdbcType=VARCHAR},
- cu_recorddate = #{cu_recorddate,jdbcType=TIMESTAMP},
- companyid = #{companyid,jdbcType=INTEGER},
- updaterid = #{updaterid,jdbcType=INTEGER},
- updatetime = #{updatetime,jdbcType=TIMESTAMP},
- cu_text1 = #{cu_text1,jdbcType=VARCHAR},
- cu_text2 = #{cu_text2,jdbcType=VARCHAR},
- cu_text3 = #{cu_text3,jdbcType=VARCHAR},
- cu_text4 = #{cu_text4,jdbcType=VARCHAR},
- cu_text5 = #{cu_text5,jdbcType=VARCHAR},
- cu_leftamount = #{cu_leftamount,jdbcType=DOUBLE},
- cu_recamount = #{cu_recamount,jdbcType=DOUBLE}
- where cu_id = #{id,jdbcType=INTEGER}
- </update>
- <select id="validateCodeWhenInsert" resultType="int">
- select count(1) from customer where cu_code = #{code} and companyId =#{companyId}
- </select>
- <select id="validateCodeWhenUpdate" resultType="int" >
- select count(1) from customer where cu_code = #{code} and cu_id != #{id} and companyId =#{companyId}
- </select>
- <select id="selectCodeById" parameterType="java.lang.Long" resultType="string">
- select
- cu_code
- from customer
- where cu_id = #{id,jdbcType=INTEGER}
- </select>
- </mapper>
|