KwsEntCertificateDao.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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.sckw.system.dao.KwsEntCertificateDao">
  4. <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsEntCertificate">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="ent_id" jdbcType="BIGINT" property="entId" />
  7. <result column="type" jdbcType="INTEGER" property="type" />
  8. <result column="code" jdbcType="VARCHAR" property="code" />
  9. <result column="certificate_main" jdbcType="VARCHAR" property="certificateMain" />
  10. <result column="certificate_revolt" jdbcType="VARCHAR" property="certificateRevolt" />
  11. <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
  12. <result column="remark" jdbcType="VARCHAR" property="remark" />
  13. <result column="status" jdbcType="INTEGER" property="status" />
  14. <result column="create_by" jdbcType="BIGINT" property="createBy" />
  15. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  16. <result column="update_by" jdbcType="BIGINT" property="updateBy" />
  17. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  18. <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
  19. </resultMap>
  20. <sql id="Base_Column_List">
  21. id, ent_id, type, code, certificate_main, certificate_revolt, remark, status, create_by,
  22. create_time, update_by, update_time, del_flag, expire_time
  23. </sql>
  24. <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  25. select
  26. <include refid="Base_Column_List" />
  27. from kws_ent_certificate
  28. where id = #{id,jdbcType=BIGINT}
  29. </select>
  30. <select id="selectByEntId" resultType="com.sckw.system.model.KwsEntCertificate">
  31. select a.* from kws_ent_certificate a where a.ent_id = #{id} and a.del_flag = 0
  32. </select>
  33. <select id="findByEntType" resultType="com.sckw.system.model.KwsEntCertificate">
  34. select a.* from kws_ent_certificate a where a.ent_id = #{entId} and a.type = #{type} and a.del_flag = 0 and a.status = 0
  35. </select>
  36. <select id="findPrevious" resultType="com.sckw.system.model.KwsEntCertificate">
  37. select a.* from kws_ent_certificate a where a.ent_id = #{entId} and a.type = #{type} and a.del_flag = 0 and a.status in (0, 1)
  38. </select>
  39. <insert id="insert" parameterType="com.sckw.system.model.KwsEntCertificate">
  40. insert into kws_ent_certificate
  41. <trim prefix="(" suffix=")" suffixOverrides=",">
  42. <if test="id != null">
  43. id,
  44. </if>
  45. <if test="entId != null">
  46. ent_id,
  47. </if>
  48. <if test="type != null">
  49. type,
  50. </if>
  51. <if test="code != null">
  52. code,
  53. </if>
  54. <if test="certificateMain != null">
  55. certificate_main,
  56. </if>
  57. <if test="certificateRevolt != null">
  58. certificate_revolt,
  59. </if>
  60. <if test="remark != null">
  61. remark,
  62. </if>
  63. <if test="status != null">
  64. status,
  65. </if>
  66. <if test="createBy != null">
  67. create_by,
  68. </if>
  69. <if test="createTime != null">
  70. create_time,
  71. </if>
  72. <if test="updateBy != null">
  73. update_by,
  74. </if>
  75. <if test="updateTime != null">
  76. update_time,
  77. </if>
  78. <if test="delFlag != null">
  79. del_flag,
  80. </if>
  81. <if test="expireTime != null">
  82. expire_time,
  83. </if>
  84. </trim>
  85. <trim prefix="values (" suffix=")" suffixOverrides=",">
  86. <if test="id != null">
  87. #{id,jdbcType=BIGINT},
  88. </if>
  89. <if test="entId != null">
  90. #{entId,jdbcType=BIGINT},
  91. </if>
  92. <if test="type != null">
  93. #{type,jdbcType=INTEGER},
  94. </if>
  95. <if test="code != null">
  96. #{code,jdbcType=VARCHAR},
  97. </if>
  98. <if test="certificateMain != null">
  99. #{certificateMain,jdbcType=VARCHAR},
  100. </if>
  101. <if test="certificateRevolt != null">
  102. #{certificateRevolt,jdbcType=VARCHAR},
  103. </if>
  104. <if test="remark != null">
  105. #{remark,jdbcType=VARCHAR},
  106. </if>
  107. <if test="status != null">
  108. #{status,jdbcType=INTEGER},
  109. </if>
  110. <if test="createBy != null">
  111. #{createBy,jdbcType=BIGINT},
  112. </if>
  113. <if test="createTime != null">
  114. #{createTime,jdbcType=TIMESTAMP},
  115. </if>
  116. <if test="updateBy != null">
  117. #{updateBy,jdbcType=BIGINT},
  118. </if>
  119. <if test="updateTime != null">
  120. #{updateTime,jdbcType=TIMESTAMP},
  121. </if>
  122. <if test="delFlag != null">
  123. #{delFlag,jdbcType=INTEGER},
  124. </if>
  125. <if test="expireTime != null">
  126. #{expireTime,jdbcType=TIMESTAMP},
  127. </if>
  128. </trim>
  129. </insert>
  130. <insert id="saveBatch">
  131. insert into kws_ent_certificate
  132. <trim prefix="(" suffix=")" suffixOverrides=",">
  133. id,
  134. ent_id,
  135. type,
  136. code,
  137. certificate_main,
  138. certificate_revolt,
  139. remark,
  140. status,
  141. create_by,
  142. create_time,
  143. update_by,
  144. update_time,
  145. del_flag,
  146. expire_time
  147. </trim>
  148. values
  149. <foreach collection="list" item="item" separator=",">
  150. <trim prefix="(" suffix=")" suffixOverrides=",">
  151. #{item.id,jdbcType=BIGINT},
  152. #{item.entId,jdbcType=BIGINT},
  153. #{item.type,jdbcType=INTEGER},
  154. #{item.code,jdbcType=VARCHAR},
  155. #{item.certificateMain,jdbcType=VARCHAR},
  156. #{item.certificateRevolt,jdbcType=VARCHAR},
  157. #{item.remark,jdbcType=VARCHAR},
  158. #{item.status,jdbcType=INTEGER},
  159. #{item.createBy,jdbcType=BIGINT},
  160. #{item.createTime,jdbcType=TIMESTAMP},
  161. #{item.updateBy,jdbcType=BIGINT},
  162. #{item.updateTime,jdbcType=TIMESTAMP},
  163. #{item.delFlag,jdbcType=INTEGER},
  164. #{item.expireTime,jdbcType=TIMESTAMP},
  165. </trim>
  166. </foreach>
  167. </insert>
  168. <update id="update" parameterType="com.sckw.system.model.KwsEntCertificate">
  169. update kws_ent_certificate
  170. <set>
  171. <if test="entId != null">
  172. ent_id = #{entId,jdbcType=BIGINT},
  173. </if>
  174. <if test="type != null">
  175. type = #{type,jdbcType=INTEGER},
  176. </if>
  177. <if test="code != null">
  178. code = #{code,jdbcType=VARCHAR},
  179. </if>
  180. <if test="certificateMain != null">
  181. certificate_main = #{certificateMain,jdbcType=VARCHAR},
  182. </if>
  183. <if test="certificateRevolt != null">
  184. certificate_revolt = #{certificateRevolt,jdbcType=VARCHAR},
  185. </if>
  186. <if test="remark != null">
  187. remark = #{remark,jdbcType=VARCHAR},
  188. </if>
  189. <if test="status != null">
  190. status = #{status,jdbcType=INTEGER},
  191. </if>
  192. <if test="createBy != null">
  193. create_by = #{createBy,jdbcType=BIGINT},
  194. </if>
  195. <if test="createTime != null">
  196. create_time = #{createTime,jdbcType=TIMESTAMP},
  197. </if>
  198. <if test="updateBy != null">
  199. update_by = #{updateBy,jdbcType=BIGINT},
  200. </if>
  201. <if test="updateTime != null">
  202. update_time = #{updateTime,jdbcType=TIMESTAMP},
  203. </if>
  204. <if test="delFlag != null">
  205. del_flag = #{delFlag,jdbcType=INTEGER},
  206. </if>
  207. <if test="expireTime != null">
  208. expire_time = #{expireTime,jdbcType=TIMESTAMP},
  209. </if>
  210. </set>
  211. where id = #{id,jdbcType=BIGINT}
  212. </update>
  213. </mapper>