ProjectMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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.kede.common.dao.ProjectMapper">
  4. <resultMap id="BaseResultMap" type="com.kede.common.model.Project">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="name" jdbcType="VARCHAR" property="name" />
  12. <result column="amount" jdbcType="DECIMAL" property="amount" />
  13. <result column="thumbnail_url" jdbcType="VARCHAR" property="thumbnailUrl" />
  14. <result column="status" jdbcType="INTEGER" property="status" />
  15. <result column="sort" jdbcType="INTEGER" property="sort" />
  16. <result column="release_status" jdbcType="INTEGER" property="releaseStatus" />
  17. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  18. <result column="release_time" jdbcType="TIMESTAMP" property="releaseTime" />
  19. <result column="host" jdbcType="INTEGER" property="host" />
  20. <result column="type" jdbcType="INTEGER" property="type" />
  21. <result column="commodity_url" jdbcType="VARCHAR" property="commodityUrl" />
  22. </resultMap>
  23. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.kede.common.model.Project">
  24. <!--
  25. WARNING - @mbg.generated
  26. This element is automatically generated by MyBatis Generator, do not modify.
  27. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  28. -->
  29. <result column="content" jdbcType="LONGVARCHAR" property="content" />
  30. </resultMap>
  31. <sql id="Base_Column_List">
  32. <!--
  33. WARNING - @mbg.generated
  34. This element is automatically generated by MyBatis Generator, do not modify.
  35. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  36. -->
  37. id, `name`, amount, thumbnail_url, `status`, sort, release_status, create_time, release_time,
  38. `host`, `type`, commodity_url
  39. </sql>
  40. <sql id="Blob_Column_List">
  41. <!--
  42. WARNING - @mbg.generated
  43. This element is automatically generated by MyBatis Generator, do not modify.
  44. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  45. -->
  46. content
  47. </sql>
  48. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
  49. <!--
  50. WARNING - @mbg.generated
  51. This element is automatically generated by MyBatis Generator, do not modify.
  52. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  53. -->
  54. select
  55. <include refid="Base_Column_List" />
  56. ,
  57. <include refid="Blob_Column_List" />
  58. from project
  59. where id = #{id,jdbcType=INTEGER}
  60. </select>
  61. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  62. <!--
  63. WARNING - @mbg.generated
  64. This element is automatically generated by MyBatis Generator, do not modify.
  65. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  66. -->
  67. delete from project
  68. where id = #{id,jdbcType=INTEGER}
  69. </delete>
  70. <insert id="insert" parameterType="com.kede.common.model.Project">
  71. <!--
  72. WARNING - @mbg.generated
  73. This element is automatically generated by MyBatis Generator, do not modify.
  74. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  75. -->
  76. insert into project (id, `name`, amount,
  77. thumbnail_url, `status`, sort,
  78. release_status, create_time, release_time,
  79. `host`, `type`, commodity_url,
  80. content)
  81. values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL},
  82. #{thumbnailUrl,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
  83. #{releaseStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{releaseTime,jdbcType=TIMESTAMP},
  84. #{host,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{commodityUrl,jdbcType=VARCHAR},
  85. #{content,jdbcType=LONGVARCHAR})
  86. </insert>
  87. <insert id="insertSelective" parameterType="com.kede.common.model.Project">
  88. <!--
  89. WARNING - @mbg.generated
  90. This element is automatically generated by MyBatis Generator, do not modify.
  91. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  92. -->
  93. insert into project
  94. <trim prefix="(" suffix=")" suffixOverrides=",">
  95. <if test="id != null">
  96. id,
  97. </if>
  98. <if test="name != null">
  99. `name`,
  100. </if>
  101. <if test="amount != null">
  102. amount,
  103. </if>
  104. <if test="thumbnailUrl != null">
  105. thumbnail_url,
  106. </if>
  107. <if test="status != null">
  108. `status`,
  109. </if>
  110. <if test="sort != null">
  111. sort,
  112. </if>
  113. <if test="releaseStatus != null">
  114. release_status,
  115. </if>
  116. <if test="createTime != null">
  117. create_time,
  118. </if>
  119. <if test="releaseTime != null">
  120. release_time,
  121. </if>
  122. <if test="host != null">
  123. `host`,
  124. </if>
  125. <if test="type != null">
  126. `type`,
  127. </if>
  128. <if test="commodityUrl != null">
  129. commodity_url,
  130. </if>
  131. <if test="content != null">
  132. content,
  133. </if>
  134. </trim>
  135. <trim prefix="values (" suffix=")" suffixOverrides=",">
  136. <if test="id != null">
  137. #{id,jdbcType=INTEGER},
  138. </if>
  139. <if test="name != null">
  140. #{name,jdbcType=VARCHAR},
  141. </if>
  142. <if test="amount != null">
  143. #{amount,jdbcType=DECIMAL},
  144. </if>
  145. <if test="thumbnailUrl != null">
  146. #{thumbnailUrl,jdbcType=VARCHAR},
  147. </if>
  148. <if test="status != null">
  149. #{status,jdbcType=INTEGER},
  150. </if>
  151. <if test="sort != null">
  152. #{sort,jdbcType=INTEGER},
  153. </if>
  154. <if test="releaseStatus != null">
  155. #{releaseStatus,jdbcType=INTEGER},
  156. </if>
  157. <if test="createTime != null">
  158. #{createTime,jdbcType=TIMESTAMP},
  159. </if>
  160. <if test="releaseTime != null">
  161. #{releaseTime,jdbcType=TIMESTAMP},
  162. </if>
  163. <if test="host != null">
  164. #{host,jdbcType=INTEGER},
  165. </if>
  166. <if test="type != null">
  167. #{type,jdbcType=INTEGER},
  168. </if>
  169. <if test="commodityUrl != null">
  170. #{commodityUrl,jdbcType=VARCHAR},
  171. </if>
  172. <if test="content != null">
  173. #{content,jdbcType=LONGVARCHAR},
  174. </if>
  175. </trim>
  176. </insert>
  177. <update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.Project">
  178. <!--
  179. WARNING - @mbg.generated
  180. This element is automatically generated by MyBatis Generator, do not modify.
  181. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  182. -->
  183. update project
  184. <set>
  185. <if test="name != null">
  186. `name` = #{name,jdbcType=VARCHAR},
  187. </if>
  188. <if test="amount != null">
  189. amount = #{amount,jdbcType=DECIMAL},
  190. </if>
  191. <if test="thumbnailUrl != null">
  192. thumbnail_url = #{thumbnailUrl,jdbcType=VARCHAR},
  193. </if>
  194. <if test="status != null">
  195. `status` = #{status,jdbcType=INTEGER},
  196. </if>
  197. <if test="sort != null">
  198. sort = #{sort,jdbcType=INTEGER},
  199. </if>
  200. <if test="releaseStatus != null">
  201. release_status = #{releaseStatus,jdbcType=INTEGER},
  202. </if>
  203. <if test="createTime != null">
  204. create_time = #{createTime,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="releaseTime != null">
  207. release_time = #{releaseTime,jdbcType=TIMESTAMP},
  208. </if>
  209. <if test="host != null">
  210. `host` = #{host,jdbcType=INTEGER},
  211. </if>
  212. <if test="type != null">
  213. `type` = #{type,jdbcType=INTEGER},
  214. </if>
  215. <if test="commodityUrl != null">
  216. commodity_url = #{commodityUrl,jdbcType=VARCHAR},
  217. </if>
  218. <if test="content != null">
  219. content = #{content,jdbcType=LONGVARCHAR},
  220. </if>
  221. </set>
  222. where id = #{id,jdbcType=INTEGER}
  223. </update>
  224. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.kede.common.model.Project">
  225. <!--
  226. WARNING - @mbg.generated
  227. This element is automatically generated by MyBatis Generator, do not modify.
  228. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  229. -->
  230. update project
  231. set `name` = #{name,jdbcType=VARCHAR},
  232. amount = #{amount,jdbcType=DECIMAL},
  233. thumbnail_url = #{thumbnailUrl,jdbcType=VARCHAR},
  234. `status` = #{status,jdbcType=INTEGER},
  235. sort = #{sort,jdbcType=INTEGER},
  236. release_status = #{releaseStatus,jdbcType=INTEGER},
  237. create_time = #{createTime,jdbcType=TIMESTAMP},
  238. release_time = #{releaseTime,jdbcType=TIMESTAMP},
  239. `host` = #{host,jdbcType=INTEGER},
  240. `type` = #{type,jdbcType=INTEGER},
  241. commodity_url = #{commodityUrl,jdbcType=VARCHAR},
  242. content = #{content,jdbcType=LONGVARCHAR}
  243. where id = #{id,jdbcType=INTEGER}
  244. </update>
  245. <update id="updateByPrimaryKey" parameterType="com.kede.common.model.Project">
  246. <!--
  247. WARNING - @mbg.generated
  248. This element is automatically generated by MyBatis Generator, do not modify.
  249. This element was generated on Mon Apr 12 17:24:38 CST 2021.
  250. -->
  251. update project
  252. set `name` = #{name,jdbcType=VARCHAR},
  253. amount = #{amount,jdbcType=DECIMAL},
  254. thumbnail_url = #{thumbnailUrl,jdbcType=VARCHAR},
  255. `status` = #{status,jdbcType=INTEGER},
  256. sort = #{sort,jdbcType=INTEGER},
  257. release_status = #{releaseStatus,jdbcType=INTEGER},
  258. create_time = #{createTime,jdbcType=TIMESTAMP},
  259. release_time = #{releaseTime,jdbcType=TIMESTAMP},
  260. `host` = #{host,jdbcType=INTEGER},
  261. `type` = #{type,jdbcType=INTEGER},
  262. commodity_url = #{commodityUrl,jdbcType=VARCHAR}
  263. where id = #{id,jdbcType=INTEGER}
  264. </update>
  265. <select id="selectProjectList" resultType="com.kede.common.model.projectBo">
  266. select a.id,a.name,a.amount,a.thumbnail_url thumbnailUrl,a.status,a.sort,a.content,a.release_status releaseStatus,
  267. a.host,a.commodity_url commodityUrl ,b.name typeName,a.`type` ,
  268. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes, date_format(a.release_time,'%Y-%m-%d %H:%i:%S')releaseTimes
  269. from project a left join project_type b on a.`type` =b.id where 1=1
  270. <if test="name != null">
  271. and a.name like concat('%',#{name},'%')
  272. </if>
  273. <if test="releaseStatus != null">
  274. and a.release_status = #{releaseStatus}
  275. </if>
  276. <if test="host != null">
  277. and a.host = #{host}
  278. </if>
  279. <if test="startTime != null and endTime !=null">
  280. and a.create_time between #{startTime} and #{endTime}
  281. </if>
  282. <if test="page_sql !=null">
  283. ${page_sql}
  284. </if>
  285. </select>
  286. <select id="selectProjectCount" resultType="java.lang.Integer">
  287. select count(*)
  288. from project where 1=1
  289. <if test="name != null">
  290. and name like concat('%',#{name},'%')
  291. </if>
  292. <if test="releaseStatus != null">
  293. and a.release_status = #{releaseStatus}
  294. </if>
  295. <if test="host != null">
  296. and a.host = #{host}
  297. </if>
  298. <if test="startTime != null and endTime !=null">
  299. and create_time between #{startTime} and #{endTime}
  300. </if>
  301. </select>
  302. <select id="getProject" parameterType="java.lang.Integer" resultType="com.kede.common.model.projectBo">
  303. select a.id,a.name,a.amount,a.thumbnail_url thumbnailUrl,a.status,a.sort,a.content,a.release_status releaseStatus,
  304. a.host,a.commodity_url commodityUrl ,b.name typeName,a.`type` ,
  305. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimes, date_format(a.release_time,'%Y-%m-%d %H:%i:%S')releaseTimes
  306. from project a left join project_type b on a.`type` =b.id where 1=1
  307. and a.id = #{id,jdbcType=INTEGER}
  308. </select>
  309. </mapper>