| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?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.VendorkindMapper">
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Vendorkind">
- <id column="vk_id" jdbcType="INTEGER" property="id" />
- <result column="vk_name" jdbcType="VARCHAR" property="vk_name" />
- <result column="companyId" jdbcType="INTEGER" property="companyId" />
- <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
- <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
- </resultMap>
- <sql id="Base_Column_List">
- vk_id, vk_name, companyId, updaterId, updateTime
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from vendorkind
- where vk_id = #{id}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from vendorkind
- where vk_id = #{id}
- </delete>
- <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into vendorkind (vk_name, companyId,
- updaterId, updateTime)
- values (#{vk_name,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},
- #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into vendorkind
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="vk_name != null">
- vk_name,
- </if>
- <if test="companyId != null">
- companyId,
- </if>
- <if test="updaterId != null">
- updaterId,
- </if>
- <if test="updateTime != null">
- updateTime,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="vk_name != null">
- #{vk_name,jdbcType=VARCHAR},
- </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>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
- update vendorkind
- <set>
- <if test="vk_name != null">
- vk_name = #{vk_name,jdbcType=VARCHAR},
- </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>
- </set>
- where vk_id = #{id}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
- update vendorkind
- set vk_name = #{vk_name,jdbcType=VARCHAR},
- companyId = #{companyId,jdbcType=INTEGER},
- updaterId = #{updaterId,jdbcType=INTEGER},
- updateTime = #{updateTime,jdbcType=TIMESTAMP}
- where vk_id = #{id}
- </update>
- <select id="selectAll" resultMap="BaseResultMap">
- SELECT * FROM VENDORKIND where companyId = #{companyId} ORDER BY VK_ID DESC
- </select>
- <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
- SELECT VK_NAME display, VK_NAME value FROM VENDORKIND WHERE COMPANYID=#{companyId}
- </select>
- <select id="selectCountByName" resultType="int">
- SELECT COUNT(*) FROM VENDORKIND
- <where>
- <if test="name!=null">
- and VK_NAME=#{name}
- </if>
- <if test="companyId!=0 and companyId!=null">
- and COMPANYID=#{companyId}
- </if>
- <if test="id!=0 and id!=null">
- and vk_id != #{id}
- </if>
- </where>
- </select>
- <select id="getCountFromVendor" resultType="int">
- SELECT COUNT(*) FROM VENDOR WHERE VE_TYPE = (SELECT VK_NAME FROM VENDORKIND WHERE VK_ID = #{id}) AND companyId = #{companyId}
- </select>
- </mapper>
|