VendorkindMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.usoftchina.saas.document.mapper.VendorkindMapper">
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Vendorkind">
  5. <id column="vk_id" jdbcType="INTEGER" property="id" />
  6. <result column="vk_name" jdbcType="VARCHAR" property="vk_name" />
  7. <result column="vk_recordid" jdbcType="INTEGER" property="vk_recordid" />
  8. <result column="vk_recorder" jdbcType="VARCHAR" property="vk_recorder" />
  9. <result column="vk_date" jdbcType="TIMESTAMP" property="vk_date" />
  10. <result column="companyId" jdbcType="INTEGER" property="companyId" />
  11. <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
  12. <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
  13. </resultMap>
  14. <sql id="Base_Column_List">
  15. vk_id, vk_name, vk_recordid, vk_recorder, vk_date, companyId, updaterId, updateTime
  16. </sql>
  17. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  18. select
  19. <include refid="Base_Column_List" />
  20. from vendorkind
  21. where vk_id = #{id}
  22. </select>
  23. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  24. delete from vendorkind
  25. where vk_id = #{id}
  26. </delete>
  27. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
  28. <selectKey resultType="java.lang.Long" keyProperty="id">
  29. SELECT LAST_INSERT_ID() AS ID
  30. </selectKey>
  31. insert into vendorkind (vk_name, vk_recordid,
  32. vk_recorder, vk_date, companyId,
  33. updaterId, updateTime)
  34. values (#{vk_name,jdbcType=VARCHAR}, #{vk_recordid,jdbcType=INTEGER},
  35. #{vk_recorder,jdbcType=VARCHAR}, #{vk_date,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER},
  36. #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP})
  37. </insert>
  38. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
  39. <selectKey resultType="java.lang.Long" keyProperty="id">
  40. SELECT LAST_INSERT_ID() AS ID
  41. </selectKey>
  42. insert into vendorkind
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="vk_name != null">
  45. vk_name,
  46. </if>
  47. <if test="vk_recordid != null">
  48. vk_recordid,
  49. </if>
  50. <if test="vk_recorder != null">
  51. vk_recorder,
  52. </if>
  53. <if test="vk_date != null">
  54. vk_date,
  55. </if>
  56. <if test="companyId != null">
  57. companyId,
  58. </if>
  59. <if test="updaterId != null">
  60. updaterId,
  61. </if>
  62. <if test="updateTime != null">
  63. updateTime,
  64. </if>
  65. </trim>
  66. <trim prefix="values (" suffix=")" suffixOverrides=",">
  67. <if test="vk_name != null">
  68. #{vk_name,jdbcType=VARCHAR},
  69. </if>
  70. <if test="vk_recordid != null">
  71. #{vk_recordid,jdbcType=INTEGER},
  72. </if>
  73. <if test="vk_recorder != null">
  74. #{vk_recorder,jdbcType=VARCHAR},
  75. </if>
  76. <if test="vk_date != null">
  77. #{vk_date,jdbcType=TIMESTAMP},
  78. </if>
  79. <if test="companyId != null">
  80. #{companyId,jdbcType=INTEGER},
  81. </if>
  82. <if test="updaterId != null">
  83. #{updaterId,jdbcType=INTEGER},
  84. </if>
  85. <if test="updateTime != null">
  86. #{updateTime,jdbcType=TIMESTAMP},
  87. </if>
  88. </trim>
  89. </insert>
  90. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
  91. update vendorkind
  92. <set>
  93. <if test="vk_name != null">
  94. vk_name = #{vk_name,jdbcType=VARCHAR},
  95. </if>
  96. <if test="vk_recordid != null">
  97. vk_recordid = #{vk_recordid,jdbcType=INTEGER},
  98. </if>
  99. <if test="vk_recorder != null">
  100. vk_recorder = #{vk_recorder,jdbcType=VARCHAR},
  101. </if>
  102. <if test="vk_date != null">
  103. vk_date = #{vk_date,jdbcType=TIMESTAMP},
  104. </if>
  105. <if test="companyId != null">
  106. companyId = #{companyId,jdbcType=INTEGER},
  107. </if>
  108. <if test="updaterId != null">
  109. updaterId = #{updaterId,jdbcType=INTEGER},
  110. </if>
  111. <if test="updateTime != null">
  112. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  113. </if>
  114. </set>
  115. where vk_id = #{id}
  116. </update>
  117. <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Vendorkind">
  118. update vendorkind
  119. set vk_name = #{vk_name,jdbcType=VARCHAR},
  120. vk_recordid = #{vk_recordid,jdbcType=INTEGER},
  121. vk_recorder = #{vk_recorder,jdbcType=VARCHAR},
  122. vk_date = #{vk_date,jdbcType=TIMESTAMP},
  123. companyId = #{companyId,jdbcType=INTEGER},
  124. updaterId = #{updaterId,jdbcType=INTEGER},
  125. updateTime = #{updateTime,jdbcType=TIMESTAMP}
  126. where vk_id = #{id}
  127. </update>
  128. <select id="selectAll" resultMap="BaseResultMap">
  129. SELECT * FROM VENDORKIND where companyId = #{companyId} ORDER BY VK_ID DESC
  130. </select>
  131. <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
  132. SELECT VK_NAME display, VK_NAME value FROM VENDORKIND WHERE COMPANYID=#{companyId}
  133. </select>
  134. <select id="selectCountByName" resultType="int">
  135. SELECT COUNT(*) FROM VENDORKIND
  136. <where>
  137. <if test="name!=null">
  138. and VK_NAME=#{name}
  139. </if>
  140. <if test="companyId!=0 and companyId!=null">
  141. and COMPANYID=#{companyId}
  142. </if>
  143. <if test="id!=0 and id!=null">
  144. and vk_id != #{id}
  145. </if>
  146. </where>
  147. </select>
  148. <select id="getCountFromVendor" resultType="int">
  149. SELECT COUNT(*) FROM VENDOR WHERE VE_TYPE = (SELECT VK_NAME FROM VENDORKIND WHERE VK_ID = #{id}) AND companyId = #{companyId}
  150. </select>
  151. </mapper>