CustomerkindMapper.xml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.CustomerkindMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Customerkind" >
  5. <id column="ck_id" property="id" jdbcType="INTEGER" />
  6. <result column="ck_name" property="ck_name" jdbcType="VARCHAR" />
  7. <result column="ck_recordid" property="ck_recordid" jdbcType="INTEGER" />
  8. <result column="ck_recorder" property="ck_recorder" jdbcType="VARCHAR" />
  9. <result column="ck_date" property="ck_date" jdbcType="TIMESTAMP" />
  10. <result column="companyId" property="companyId" jdbcType="INTEGER" />
  11. <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
  12. <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
  13. </resultMap>
  14. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  15. select
  16. <include refid="Base_Column_List" />
  17. from customerkind
  18. where ck_id = #{id}
  19. </select>
  20. <sql id="Base_Column_List" >
  21. ck_id, ck_name, ck_recordid, ck_recorder, ck_date, companyId, updaterId, updateTime
  22. </sql>
  23. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  24. delete from customerkind
  25. where ck_id = #{id}
  26. </delete>
  27. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Customerkind" >
  28. insert into customerkind (ck_name, ck_recordid,
  29. ck_recorder, ck_date, companyId,
  30. updaterId, updateTime)
  31. values (#{ck_name,jdbcType=VARCHAR}, #{ck_recordid,jdbcType=INTEGER},
  32. #{ck_recorder,jdbcType=VARCHAR}, #{ck_date,jdbcType=TIMESTAMP}, #{companyId,jdbcType=INTEGER},
  33. #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP})
  34. </insert>
  35. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Customerkind" >
  36. insert into customerkind
  37. <trim prefix="(" suffix=")" suffixOverrides="," >
  38. <if test="ck_name != null" >
  39. ck_name,
  40. </if>
  41. <if test="ck_recordid != null" >
  42. ck_recordid,
  43. </if>
  44. <if test="ck_recorder != null" >
  45. ck_recorder,
  46. </if>
  47. <if test="ck_date != null" >
  48. ck_date,
  49. </if>
  50. <if test="companyId != null" >
  51. companyId,
  52. </if>
  53. <if test="updaterId != null" >
  54. updaterId,
  55. </if>
  56. <if test="updateTime != null" >
  57. updateTime,
  58. </if>
  59. </trim>
  60. <trim prefix="values (" suffix=")" suffixOverrides="," >
  61. <if test="ck_name != null" >
  62. #{ck_name,jdbcType=VARCHAR},
  63. </if>
  64. <if test="ck_recordid != null" >
  65. #{ck_recordid,jdbcType=INTEGER},
  66. </if>
  67. <if test="ck_recorder != null" >
  68. #{ck_recorder,jdbcType=VARCHAR},
  69. </if>
  70. <if test="ck_date != null" >
  71. #{ck_date,jdbcType=TIMESTAMP},
  72. </if>
  73. <if test="companyId != null" >
  74. #{companyId,jdbcType=INTEGER},
  75. </if>
  76. <if test="updaterId != null" >
  77. #{updaterId,jdbcType=INTEGER},
  78. </if>
  79. <if test="updateTime != null" >
  80. #{updateTime,jdbcType=TIMESTAMP},
  81. </if>
  82. </trim>
  83. </insert>
  84. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Customerkind" >
  85. update customerkind
  86. <set >
  87. <if test="ck_name != null" >
  88. ck_name = #{ck_name,jdbcType=VARCHAR},
  89. </if>
  90. <if test="ck_recordid != null" >
  91. ck_recordid = #{ck_recordid,jdbcType=INTEGER},
  92. </if>
  93. <if test="ck_recorder != null" >
  94. ck_recorder = #{ck_recorder,jdbcType=VARCHAR},
  95. </if>
  96. <if test="ck_date != null" >
  97. ck_date = #{ck_date,jdbcType=TIMESTAMP},
  98. </if>
  99. <if test="companyId != null" >
  100. companyId = #{companyId,jdbcType=INTEGER},
  101. </if>
  102. <if test="updaterId != null" >
  103. updaterId = #{updaterId,jdbcType=INTEGER},
  104. </if>
  105. <if test="updateTime != null" >
  106. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  107. </if>
  108. </set>
  109. where ck_id = #{id}
  110. </update>
  111. <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Customerkind" >
  112. update customerkind
  113. set ck_name = #{ck_name,jdbcType=VARCHAR},
  114. ck_recordid = #{ck_recordid,jdbcType=INTEGER},
  115. ck_recorder = #{ck_recorder,jdbcType=VARCHAR},
  116. ck_date = #{ck_date,jdbcType=TIMESTAMP},
  117. companyId = #{companyId,jdbcType=INTEGER},
  118. updaterId = #{updaterId,jdbcType=INTEGER},
  119. updateTime = #{updateTime,jdbcType=TIMESTAMP}
  120. where ck_id = #{id}
  121. </update>
  122. <select id="selectAll" resultMap="BaseResultMap">
  123. SELECT * FROM CUSTOMERKIND
  124. </select>
  125. <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
  126. SELECT ck_name display,ck_name value FROM CUSTOMERKIND WHERE COMPANYID=#{companyId}
  127. </select>
  128. <select id="selectCountByName" resultType="int">
  129. SELECT count(*) FROM CUSTOMERKIND
  130. <where>
  131. <if test="name!=null">
  132. and CK_NAME=#{name}
  133. </if>
  134. <if test="companyId!=0 and companyId!=null">
  135. and companyId=#{companyId}
  136. </if>
  137. <if test="id!=0 and id != null">
  138. and ck_id != #{id}
  139. </if>
  140. </where>
  141. </select>
  142. </mapper>