ProjectMapper.xml 13 KB

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