CmsSubjectMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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.macro.mall.mapper.CmsSubjectMapper">
  4. <resultMap id="BaseResultMap" type="com.macro.mall.model.CmsSubject">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="category_id" jdbcType="BIGINT" property="categoryId" />
  7. <result column="title" jdbcType="VARCHAR" property="title" />
  8. <result column="pic" jdbcType="VARCHAR" property="pic" />
  9. <result column="product_count" jdbcType="INTEGER" property="productCount" />
  10. <result column="recommend_status" jdbcType="INTEGER" property="recommendStatus" />
  11. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  12. <result column="collect_count" jdbcType="INTEGER" property="collectCount" />
  13. <result column="read_count" jdbcType="INTEGER" property="readCount" />
  14. <result column="comment_count" jdbcType="INTEGER" property="commentCount" />
  15. <result column="album_pics" jdbcType="VARCHAR" property="albumPics" />
  16. <result column="description" jdbcType="VARCHAR" property="description" />
  17. <result column="show_status" jdbcType="INTEGER" property="showStatus" />
  18. <result column="forward_count" jdbcType="INTEGER" property="forwardCount" />
  19. <result column="category_name" jdbcType="VARCHAR" property="categoryName" />
  20. </resultMap>
  21. <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.macro.mall.model.CmsSubject">
  22. <result column="content" jdbcType="LONGVARCHAR" property="content" />
  23. </resultMap>
  24. <sql id="Example_Where_Clause">
  25. <where>
  26. <foreach collection="oredCriteria" item="criteria" separator="or">
  27. <if test="criteria.valid">
  28. <trim prefix="(" prefixOverrides="and" suffix=")">
  29. <foreach collection="criteria.criteria" item="criterion">
  30. <choose>
  31. <when test="criterion.noValue">
  32. and ${criterion.condition}
  33. </when>
  34. <when test="criterion.singleValue">
  35. and ${criterion.condition} #{criterion.value}
  36. </when>
  37. <when test="criterion.betweenValue">
  38. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  39. </when>
  40. <when test="criterion.listValue">
  41. and ${criterion.condition}
  42. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  43. #{listItem}
  44. </foreach>
  45. </when>
  46. </choose>
  47. </foreach>
  48. </trim>
  49. </if>
  50. </foreach>
  51. </where>
  52. </sql>
  53. <sql id="Update_By_Example_Where_Clause">
  54. <where>
  55. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  56. <if test="criteria.valid">
  57. <trim prefix="(" prefixOverrides="and" suffix=")">
  58. <foreach collection="criteria.criteria" item="criterion">
  59. <choose>
  60. <when test="criterion.noValue">
  61. and ${criterion.condition}
  62. </when>
  63. <when test="criterion.singleValue">
  64. and ${criterion.condition} #{criterion.value}
  65. </when>
  66. <when test="criterion.betweenValue">
  67. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  68. </when>
  69. <when test="criterion.listValue">
  70. and ${criterion.condition}
  71. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  72. #{listItem}
  73. </foreach>
  74. </when>
  75. </choose>
  76. </foreach>
  77. </trim>
  78. </if>
  79. </foreach>
  80. </where>
  81. </sql>
  82. <sql id="Base_Column_List">
  83. id, category_id, title, pic, product_count, recommend_status, create_time, collect_count,
  84. read_count, comment_count, album_pics, description, show_status, forward_count, category_name
  85. </sql>
  86. <sql id="Blob_Column_List">
  87. content
  88. </sql>
  89. <select id="selectByExampleWithBLOBs" parameterType="com.macro.mall.model.CmsSubjectExample" resultMap="ResultMapWithBLOBs">
  90. select
  91. <if test="distinct">
  92. distinct
  93. </if>
  94. <include refid="Base_Column_List" />
  95. ,
  96. <include refid="Blob_Column_List" />
  97. from cms_subject
  98. <if test="_parameter != null">
  99. <include refid="Example_Where_Clause" />
  100. </if>
  101. <if test="orderByClause != null">
  102. order by ${orderByClause}
  103. </if>
  104. </select>
  105. <select id="selectByExample" parameterType="com.macro.mall.model.CmsSubjectExample" resultMap="BaseResultMap">
  106. select
  107. <if test="distinct">
  108. distinct
  109. </if>
  110. <include refid="Base_Column_List" />
  111. from cms_subject
  112. <if test="_parameter != null">
  113. <include refid="Example_Where_Clause" />
  114. </if>
  115. <if test="orderByClause != null">
  116. order by ${orderByClause}
  117. </if>
  118. </select>
  119. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
  120. select
  121. <include refid="Base_Column_List" />
  122. ,
  123. <include refid="Blob_Column_List" />
  124. from cms_subject
  125. where id = #{id,jdbcType=BIGINT}
  126. </select>
  127. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  128. delete from cms_subject
  129. where id = #{id,jdbcType=BIGINT}
  130. </delete>
  131. <delete id="deleteByExample" parameterType="com.macro.mall.model.CmsSubjectExample">
  132. delete from cms_subject
  133. <if test="_parameter != null">
  134. <include refid="Example_Where_Clause" />
  135. </if>
  136. </delete>
  137. <insert id="insert" parameterType="com.macro.mall.model.CmsSubject">
  138. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  139. SELECT LAST_INSERT_ID()
  140. </selectKey>
  141. insert into cms_subject (category_id, title, pic,
  142. product_count, recommend_status, create_time,
  143. collect_count, read_count, comment_count,
  144. album_pics, description, show_status,
  145. forward_count, category_name, content
  146. )
  147. values (#{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR},
  148. #{productCount,jdbcType=INTEGER}, #{recommendStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  149. #{collectCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}, #{commentCount,jdbcType=INTEGER},
  150. #{albumPics,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{showStatus,jdbcType=INTEGER},
  151. #{forwardCount,jdbcType=INTEGER}, #{categoryName,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
  152. )
  153. </insert>
  154. <insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubject">
  155. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
  156. SELECT LAST_INSERT_ID()
  157. </selectKey>
  158. insert into cms_subject
  159. <trim prefix="(" suffix=")" suffixOverrides=",">
  160. <if test="categoryId != null">
  161. category_id,
  162. </if>
  163. <if test="title != null">
  164. title,
  165. </if>
  166. <if test="pic != null">
  167. pic,
  168. </if>
  169. <if test="productCount != null">
  170. product_count,
  171. </if>
  172. <if test="recommendStatus != null">
  173. recommend_status,
  174. </if>
  175. <if test="createTime != null">
  176. create_time,
  177. </if>
  178. <if test="collectCount != null">
  179. collect_count,
  180. </if>
  181. <if test="readCount != null">
  182. read_count,
  183. </if>
  184. <if test="commentCount != null">
  185. comment_count,
  186. </if>
  187. <if test="albumPics != null">
  188. album_pics,
  189. </if>
  190. <if test="description != null">
  191. description,
  192. </if>
  193. <if test="showStatus != null">
  194. show_status,
  195. </if>
  196. <if test="forwardCount != null">
  197. forward_count,
  198. </if>
  199. <if test="categoryName != null">
  200. category_name,
  201. </if>
  202. <if test="content != null">
  203. content,
  204. </if>
  205. </trim>
  206. <trim prefix="values (" suffix=")" suffixOverrides=",">
  207. <if test="categoryId != null">
  208. #{categoryId,jdbcType=BIGINT},
  209. </if>
  210. <if test="title != null">
  211. #{title,jdbcType=VARCHAR},
  212. </if>
  213. <if test="pic != null">
  214. #{pic,jdbcType=VARCHAR},
  215. </if>
  216. <if test="productCount != null">
  217. #{productCount,jdbcType=INTEGER},
  218. </if>
  219. <if test="recommendStatus != null">
  220. #{recommendStatus,jdbcType=INTEGER},
  221. </if>
  222. <if test="createTime != null">
  223. #{createTime,jdbcType=TIMESTAMP},
  224. </if>
  225. <if test="collectCount != null">
  226. #{collectCount,jdbcType=INTEGER},
  227. </if>
  228. <if test="readCount != null">
  229. #{readCount,jdbcType=INTEGER},
  230. </if>
  231. <if test="commentCount != null">
  232. #{commentCount,jdbcType=INTEGER},
  233. </if>
  234. <if test="albumPics != null">
  235. #{albumPics,jdbcType=VARCHAR},
  236. </if>
  237. <if test="description != null">
  238. #{description,jdbcType=VARCHAR},
  239. </if>
  240. <if test="showStatus != null">
  241. #{showStatus,jdbcType=INTEGER},
  242. </if>
  243. <if test="forwardCount != null">
  244. #{forwardCount,jdbcType=INTEGER},
  245. </if>
  246. <if test="categoryName != null">
  247. #{categoryName,jdbcType=VARCHAR},
  248. </if>
  249. <if test="content != null">
  250. #{content,jdbcType=LONGVARCHAR},
  251. </if>
  252. </trim>
  253. </insert>
  254. <select id="countByExample" parameterType="com.macro.mall.model.CmsSubjectExample" resultType="java.lang.Long">
  255. select count(*) from cms_subject
  256. <if test="_parameter != null">
  257. <include refid="Example_Where_Clause" />
  258. </if>
  259. </select>
  260. <update id="updateByExampleSelective" parameterType="map">
  261. update cms_subject
  262. <set>
  263. <if test="record.id != null">
  264. id = #{record.id,jdbcType=BIGINT},
  265. </if>
  266. <if test="record.categoryId != null">
  267. category_id = #{record.categoryId,jdbcType=BIGINT},
  268. </if>
  269. <if test="record.title != null">
  270. title = #{record.title,jdbcType=VARCHAR},
  271. </if>
  272. <if test="record.pic != null">
  273. pic = #{record.pic,jdbcType=VARCHAR},
  274. </if>
  275. <if test="record.productCount != null">
  276. product_count = #{record.productCount,jdbcType=INTEGER},
  277. </if>
  278. <if test="record.recommendStatus != null">
  279. recommend_status = #{record.recommendStatus,jdbcType=INTEGER},
  280. </if>
  281. <if test="record.createTime != null">
  282. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  283. </if>
  284. <if test="record.collectCount != null">
  285. collect_count = #{record.collectCount,jdbcType=INTEGER},
  286. </if>
  287. <if test="record.readCount != null">
  288. read_count = #{record.readCount,jdbcType=INTEGER},
  289. </if>
  290. <if test="record.commentCount != null">
  291. comment_count = #{record.commentCount,jdbcType=INTEGER},
  292. </if>
  293. <if test="record.albumPics != null">
  294. album_pics = #{record.albumPics,jdbcType=VARCHAR},
  295. </if>
  296. <if test="record.description != null">
  297. description = #{record.description,jdbcType=VARCHAR},
  298. </if>
  299. <if test="record.showStatus != null">
  300. show_status = #{record.showStatus,jdbcType=INTEGER},
  301. </if>
  302. <if test="record.forwardCount != null">
  303. forward_count = #{record.forwardCount,jdbcType=INTEGER},
  304. </if>
  305. <if test="record.categoryName != null">
  306. category_name = #{record.categoryName,jdbcType=VARCHAR},
  307. </if>
  308. <if test="record.content != null">
  309. content = #{record.content,jdbcType=LONGVARCHAR},
  310. </if>
  311. </set>
  312. <if test="_parameter != null">
  313. <include refid="Update_By_Example_Where_Clause" />
  314. </if>
  315. </update>
  316. <update id="updateByExampleWithBLOBs" parameterType="map">
  317. update cms_subject
  318. set id = #{record.id,jdbcType=BIGINT},
  319. category_id = #{record.categoryId,jdbcType=BIGINT},
  320. title = #{record.title,jdbcType=VARCHAR},
  321. pic = #{record.pic,jdbcType=VARCHAR},
  322. product_count = #{record.productCount,jdbcType=INTEGER},
  323. recommend_status = #{record.recommendStatus,jdbcType=INTEGER},
  324. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  325. collect_count = #{record.collectCount,jdbcType=INTEGER},
  326. read_count = #{record.readCount,jdbcType=INTEGER},
  327. comment_count = #{record.commentCount,jdbcType=INTEGER},
  328. album_pics = #{record.albumPics,jdbcType=VARCHAR},
  329. description = #{record.description,jdbcType=VARCHAR},
  330. show_status = #{record.showStatus,jdbcType=INTEGER},
  331. forward_count = #{record.forwardCount,jdbcType=INTEGER},
  332. category_name = #{record.categoryName,jdbcType=VARCHAR},
  333. content = #{record.content,jdbcType=LONGVARCHAR}
  334. <if test="_parameter != null">
  335. <include refid="Update_By_Example_Where_Clause" />
  336. </if>
  337. </update>
  338. <update id="updateByExample" parameterType="map">
  339. update cms_subject
  340. set id = #{record.id,jdbcType=BIGINT},
  341. category_id = #{record.categoryId,jdbcType=BIGINT},
  342. title = #{record.title,jdbcType=VARCHAR},
  343. pic = #{record.pic,jdbcType=VARCHAR},
  344. product_count = #{record.productCount,jdbcType=INTEGER},
  345. recommend_status = #{record.recommendStatus,jdbcType=INTEGER},
  346. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  347. collect_count = #{record.collectCount,jdbcType=INTEGER},
  348. read_count = #{record.readCount,jdbcType=INTEGER},
  349. comment_count = #{record.commentCount,jdbcType=INTEGER},
  350. album_pics = #{record.albumPics,jdbcType=VARCHAR},
  351. description = #{record.description,jdbcType=VARCHAR},
  352. show_status = #{record.showStatus,jdbcType=INTEGER},
  353. forward_count = #{record.forwardCount,jdbcType=INTEGER},
  354. category_name = #{record.categoryName,jdbcType=VARCHAR}
  355. <if test="_parameter != null">
  356. <include refid="Update_By_Example_Where_Clause" />
  357. </if>
  358. </update>
  359. <update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.CmsSubject">
  360. update cms_subject
  361. <set>
  362. <if test="categoryId != null">
  363. category_id = #{categoryId,jdbcType=BIGINT},
  364. </if>
  365. <if test="title != null">
  366. title = #{title,jdbcType=VARCHAR},
  367. </if>
  368. <if test="pic != null">
  369. pic = #{pic,jdbcType=VARCHAR},
  370. </if>
  371. <if test="productCount != null">
  372. product_count = #{productCount,jdbcType=INTEGER},
  373. </if>
  374. <if test="recommendStatus != null">
  375. recommend_status = #{recommendStatus,jdbcType=INTEGER},
  376. </if>
  377. <if test="createTime != null">
  378. create_time = #{createTime,jdbcType=TIMESTAMP},
  379. </if>
  380. <if test="collectCount != null">
  381. collect_count = #{collectCount,jdbcType=INTEGER},
  382. </if>
  383. <if test="readCount != null">
  384. read_count = #{readCount,jdbcType=INTEGER},
  385. </if>
  386. <if test="commentCount != null">
  387. comment_count = #{commentCount,jdbcType=INTEGER},
  388. </if>
  389. <if test="albumPics != null">
  390. album_pics = #{albumPics,jdbcType=VARCHAR},
  391. </if>
  392. <if test="description != null">
  393. description = #{description,jdbcType=VARCHAR},
  394. </if>
  395. <if test="showStatus != null">
  396. show_status = #{showStatus,jdbcType=INTEGER},
  397. </if>
  398. <if test="forwardCount != null">
  399. forward_count = #{forwardCount,jdbcType=INTEGER},
  400. </if>
  401. <if test="categoryName != null">
  402. category_name = #{categoryName,jdbcType=VARCHAR},
  403. </if>
  404. <if test="content != null">
  405. content = #{content,jdbcType=LONGVARCHAR},
  406. </if>
  407. </set>
  408. where id = #{id,jdbcType=BIGINT}
  409. </update>
  410. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.macro.mall.model.CmsSubject">
  411. update cms_subject
  412. set category_id = #{categoryId,jdbcType=BIGINT},
  413. title = #{title,jdbcType=VARCHAR},
  414. pic = #{pic,jdbcType=VARCHAR},
  415. product_count = #{productCount,jdbcType=INTEGER},
  416. recommend_status = #{recommendStatus,jdbcType=INTEGER},
  417. create_time = #{createTime,jdbcType=TIMESTAMP},
  418. collect_count = #{collectCount,jdbcType=INTEGER},
  419. read_count = #{readCount,jdbcType=INTEGER},
  420. comment_count = #{commentCount,jdbcType=INTEGER},
  421. album_pics = #{albumPics,jdbcType=VARCHAR},
  422. description = #{description,jdbcType=VARCHAR},
  423. show_status = #{showStatus,jdbcType=INTEGER},
  424. forward_count = #{forwardCount,jdbcType=INTEGER},
  425. category_name = #{categoryName,jdbcType=VARCHAR},
  426. content = #{content,jdbcType=LONGVARCHAR}
  427. where id = #{id,jdbcType=BIGINT}
  428. </update>
  429. <update id="updateByPrimaryKey" parameterType="com.macro.mall.model.CmsSubject">
  430. update cms_subject
  431. set category_id = #{categoryId,jdbcType=BIGINT},
  432. title = #{title,jdbcType=VARCHAR},
  433. pic = #{pic,jdbcType=VARCHAR},
  434. product_count = #{productCount,jdbcType=INTEGER},
  435. recommend_status = #{recommendStatus,jdbcType=INTEGER},
  436. create_time = #{createTime,jdbcType=TIMESTAMP},
  437. collect_count = #{collectCount,jdbcType=INTEGER},
  438. read_count = #{readCount,jdbcType=INTEGER},
  439. comment_count = #{commentCount,jdbcType=INTEGER},
  440. album_pics = #{albumPics,jdbcType=VARCHAR},
  441. description = #{description,jdbcType=VARCHAR},
  442. show_status = #{showStatus,jdbcType=INTEGER},
  443. forward_count = #{forwardCount,jdbcType=INTEGER},
  444. category_name = #{categoryName,jdbcType=VARCHAR}
  445. where id = #{id,jdbcType=BIGINT}
  446. </update>
  447. </mapper>