| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <?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.AddressMapper">
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Address">
- <id column="ad_id" jdbcType="INTEGER" property="id" />
- <result column="ad_recorddate" jdbcType="TIMESTAMP" property="ad_recorddate" />
- <result column="companyId" jdbcType="INTEGER" property="companyId" />
- <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
- <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="ad_text1" jdbcType="VARCHAR" property="ad_text1" />
- <result column="ad_text2" jdbcType="VARCHAR" property="ad_text2" />
- <result column="ad_text3" jdbcType="VARCHAR" property="ad_text3" />
- <result column="ad_text4" jdbcType="VARCHAR" property="ad_text4" />
- <result column="ad_text5" jdbcType="VARCHAR" property="ad_text5" />
- </resultMap>
- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.document.entities.Address">
- <result column="ad_address" jdbcType="LONGVARCHAR" property="ad_address" />
- </resultMap>
- <sql id="Base_Column_List">
- ad_id, ad_recorddate, companyId, updaterId, updateTime, ad_text1, ad_text2, ad_text3,
- ad_text4, ad_text5
- </sql>
- <sql id="Blob_Column_List">
- ad_address
- </sql>
- <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Address">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into address (ad_recorddate, companyId,
- updaterId, updateTime, ad_text1,
- ad_text2, ad_text3, ad_text4,
- ad_text5, ad_address)
- values (#{ad_recorddate,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER},
- #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{ad_text1,jdbcType=VARCHAR},
- #{ad_text2,jdbcType=VARCHAR}, #{ad_text3,jdbcType=VARCHAR}, #{ad_text4,jdbcType=VARCHAR},
- #{ad_text5,jdbcType=VARCHAR}, #{ad_address,jdbcType=LONGVARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Address">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into address
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ad_recorddate != null">
- ad_recorddate,
- </if>
- <if test="companyId != null">
- companyId,
- </if>
- <if test="updaterId != null">
- updaterId,
- </if>
- <if test="updateTime != null">
- updateTime,
- </if>
- <if test="ad_text1 != null">
- ad_text1,
- </if>
- <if test="ad_text2 != null">
- ad_text2,
- </if>
- <if test="ad_text3 != null">
- ad_text3,
- </if>
- <if test="ad_text4 != null">
- ad_text4,
- </if>
- <if test="ad_text5 != null">
- ad_text5,
- </if>
- <if test="ad_address != null">
- ad_address,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ad_recorddate != null">
- #{ad_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="ad_text1 != null">
- #{ad_text1,jdbcType=VARCHAR},
- </if>
- <if test="ad_text2 != null">
- #{ad_text2,jdbcType=VARCHAR},
- </if>
- <if test="ad_text3 != null">
- #{ad_text3,jdbcType=VARCHAR},
- </if>
- <if test="ad_text4 != null">
- #{ad_text4,jdbcType=VARCHAR},
- </if>
- <if test="ad_text5 != null">
- #{ad_text5,jdbcType=VARCHAR},
- </if>
- <if test="ad_address != null">
- #{ad_address,jdbcType=LONGVARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Address">
- update address
- <set>
- <if test="ad_recorddate != null">
- ad_recorddate = #{ad_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="ad_text1 != null">
- ad_text1 = #{ad_text1,jdbcType=VARCHAR},
- </if>
- <if test="ad_text2 != null">
- ad_text2 = #{ad_text2,jdbcType=VARCHAR},
- </if>
- <if test="ad_text3 != null">
- ad_text3 = #{ad_text3,jdbcType=VARCHAR},
- </if>
- <if test="ad_text4 != null">
- ad_text4 = #{ad_text4,jdbcType=VARCHAR},
- </if>
- <if test="ad_text5 != null">
- ad_text5 = #{ad_text5,jdbcType=VARCHAR},
- </if>
- <if test="ad_address != null">
- ad_address = #{ad_address,jdbcType=LONGVARCHAR},
- </if>
- </set>
- where ad_id = #{id}
- </update>
- <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.document.entities.Address">
- update address
- set ad_recorddate = #{ad_recorddate,jdbcType=TIMESTAMP},
- companyId = #{companyId,jdbcType=INTEGER},
- updaterId = #{updaterId,jdbcType=INTEGER},
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- ad_text1 = #{ad_text1,jdbcType=VARCHAR},
- ad_text2 = #{ad_text2,jdbcType=VARCHAR},
- ad_text3 = #{ad_text3,jdbcType=VARCHAR},
- ad_text4 = #{ad_text4,jdbcType=VARCHAR},
- ad_text5 = #{ad_text5,jdbcType=VARCHAR},
- ad_address = #{ad_address,jdbcType=LONGVARCHAR}
- where ad_id = #{id}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Address">
- update address
- set ad_recorddate = #{ad_recorddate,jdbcType=TIMESTAMP},
- companyId = #{companyId,jdbcType=INTEGER},
- updaterId = #{updaterId,jdbcType=INTEGER},
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- ad_text1 = #{ad_text1,jdbcType=VARCHAR},
- ad_text2 = #{ad_text2,jdbcType=VARCHAR},
- ad_text3 = #{ad_text3,jdbcType=VARCHAR},
- ad_text4 = #{ad_text4,jdbcType=VARCHAR},
- ad_text5 = #{ad_text5,jdbcType=VARCHAR}
- where ad_id = #{id}
- </update>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from address
- where ad_id = #{id}
- </delete>
- <delete id="deleteByIds" parameterType="java.lang.String">
- delete from address
- where ad_id in (#{ids,jdbcType=VARCHAR})
- </delete>
- <select id="selectAll" resultMap="ResultMapWithBLOBs">
- SELECT * FROM ADDRESS where COMPANYID=#{companyId} ORDER BY AD_ID DESC
- </select>
- <select id="selectCountByName" resultType="int">
- SELECT count(*) FROM ADDRESS
- <where>
- <if test="name!=null">
- and ad_address=#{name}
- </if>
- <if test="companyId!=null">
- and companyId=#{companyId}
- </if>
- <if test="id!=null and id!=0">
- and ad_id!=#{id}
- </if>
- </where>
- </select>
- <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
- SELECT AD_ADDRESS display,AD_ADDRESS value FROM ADDRESS WHERE COMPANYID=#{companyId}
- </select>
- <select id="getCountFromPurchase" resultType="int">
- SELECT COUNT(*) FROM PURCHASE WHERE PU_SHIPADDRESSCODE = (SELECT AD_ADDRESS FROM ADDRESS WHERE AD_ID = #{id}) AND companyId = #{companyId}
- </select>
- </mapper>
|