CommentDOMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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.cdu.lys.graduation.repository.dao.CommentDOMapper" >
  4. <resultMap id="BaseResultMap" type="com.cdu.lys.graduation.repository.entity.CommentDO" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="user_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  8. <arg column="order_num" jdbcType="VARCHAR" javaType="java.lang.String" />
  9. <arg column="service_score" jdbcType="INTEGER" javaType="java.lang.Integer" />
  10. <arg column="environment_score" jdbcType="INTEGER" javaType="java.lang.Integer" />
  11. <arg column="taste_score" jdbcType="INTEGER" javaType="java.lang.Integer" />
  12. <arg column="content" jdbcType="VARCHAR" javaType="java.lang.String" />
  13. <arg column="reply" jdbcType="VARCHAR" javaType="java.lang.String" />
  14. <arg column="is_reply" jdbcType="CHAR" javaType="java.lang.String" />
  15. <arg column="reply_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  16. <arg column="create_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  17. <arg column="update_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  18. <arg column="is_delete" jdbcType="CHAR" javaType="java.lang.String" />
  19. </constructor>
  20. </resultMap>
  21. <sql id="Example_Where_Clause" >
  22. <where >
  23. <foreach collection="oredCriteria" item="criteria" separator="or" >
  24. <if test="criteria.valid" >
  25. <trim prefix="(" suffix=")" prefixOverrides="and" >
  26. <foreach collection="criteria.criteria" item="criterion" >
  27. <choose >
  28. <when test="criterion.noValue" >
  29. and ${criterion.condition}
  30. </when>
  31. <when test="criterion.singleValue" >
  32. and ${criterion.condition} #{criterion.value}
  33. </when>
  34. <when test="criterion.betweenValue" >
  35. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  36. </when>
  37. <when test="criterion.listValue" >
  38. and ${criterion.condition}
  39. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  40. #{listItem}
  41. </foreach>
  42. </when>
  43. </choose>
  44. </foreach>
  45. </trim>
  46. </if>
  47. </foreach>
  48. </where>
  49. </sql>
  50. <sql id="Update_By_Example_Where_Clause" >
  51. <where >
  52. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  53. <if test="criteria.valid" >
  54. <trim prefix="(" suffix=")" prefixOverrides="and" >
  55. <foreach collection="criteria.criteria" item="criterion" >
  56. <choose >
  57. <when test="criterion.noValue" >
  58. and ${criterion.condition}
  59. </when>
  60. <when test="criterion.singleValue" >
  61. and ${criterion.condition} #{criterion.value}
  62. </when>
  63. <when test="criterion.betweenValue" >
  64. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  65. </when>
  66. <when test="criterion.listValue" >
  67. and ${criterion.condition}
  68. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  69. #{listItem}
  70. </foreach>
  71. </when>
  72. </choose>
  73. </foreach>
  74. </trim>
  75. </if>
  76. </foreach>
  77. </where>
  78. </sql>
  79. <sql id="Base_Column_List" >
  80. id, user_id, order_num, service_score, environment_score, taste_score, content, reply,
  81. is_reply, reply_time, create_time, update_time, is_delete
  82. </sql>
  83. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.cdu.lys.graduation.repository.entity.CommentDOExample" >
  84. select
  85. <if test="distinct" >
  86. distinct
  87. </if>
  88. 'true' as QUERYID,
  89. <include refid="Base_Column_List" />
  90. from tb_comment
  91. <if test="_parameter != null" >
  92. <include refid="Example_Where_Clause" />
  93. </if>
  94. <if test="orderByClause != null" >
  95. order by ${orderByClause}
  96. </if>
  97. </select>
  98. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  99. select
  100. <include refid="Base_Column_List" />
  101. from tb_comment
  102. where id = #{id,jdbcType=INTEGER}
  103. </select>
  104. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  105. delete from tb_comment
  106. where id = #{id,jdbcType=INTEGER}
  107. </delete>
  108. <delete id="deleteByExample" parameterType="com.cdu.lys.graduation.repository.entity.CommentDOExample" >
  109. delete from tb_comment
  110. <if test="_parameter != null" >
  111. <include refid="Example_Where_Clause" />
  112. </if>
  113. </delete>
  114. <insert id="insert" parameterType="com.cdu.lys.graduation.repository.entity.CommentDO" >
  115. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  116. SELECT LAST_INSERT_ID()
  117. </selectKey>
  118. insert into tb_comment (user_id, order_num, service_score,
  119. environment_score, taste_score, content,
  120. reply, is_reply, reply_time,
  121. create_time, update_time, is_delete
  122. )
  123. values (#{userId,jdbcType=INTEGER}, #{orderNum,jdbcType=VARCHAR}, #{serviceScore,jdbcType=INTEGER},
  124. #{environmentScore,jdbcType=INTEGER}, #{tasteScore,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR},
  125. #{reply,jdbcType=VARCHAR}, #{isReply,jdbcType=CHAR}, #{replyTime,jdbcType=TIMESTAMP},
  126. #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=CHAR}
  127. )
  128. </insert>
  129. <insert id="insertSelective" parameterType="com.cdu.lys.graduation.repository.entity.CommentDO" >
  130. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  131. SELECT LAST_INSERT_ID()
  132. </selectKey>
  133. insert into tb_comment
  134. <trim prefix="(" suffix=")" suffixOverrides="," >
  135. <if test="userId != null" >
  136. user_id,
  137. </if>
  138. <if test="orderNum != null" >
  139. order_num,
  140. </if>
  141. <if test="serviceScore != null" >
  142. service_score,
  143. </if>
  144. <if test="environmentScore != null" >
  145. environment_score,
  146. </if>
  147. <if test="tasteScore != null" >
  148. taste_score,
  149. </if>
  150. <if test="content != null" >
  151. content,
  152. </if>
  153. <if test="reply != null" >
  154. reply,
  155. </if>
  156. <if test="isReply != null" >
  157. is_reply,
  158. </if>
  159. <if test="replyTime != null" >
  160. reply_time,
  161. </if>
  162. <if test="createTime != null" >
  163. create_time,
  164. </if>
  165. <if test="updateTime != null" >
  166. update_time,
  167. </if>
  168. <if test="isDelete != null" >
  169. is_delete,
  170. </if>
  171. </trim>
  172. <trim prefix="values (" suffix=")" suffixOverrides="," >
  173. <if test="userId != null" >
  174. #{userId,jdbcType=INTEGER},
  175. </if>
  176. <if test="orderNum != null" >
  177. #{orderNum,jdbcType=VARCHAR},
  178. </if>
  179. <if test="serviceScore != null" >
  180. #{serviceScore,jdbcType=INTEGER},
  181. </if>
  182. <if test="environmentScore != null" >
  183. #{environmentScore,jdbcType=INTEGER},
  184. </if>
  185. <if test="tasteScore != null" >
  186. #{tasteScore,jdbcType=INTEGER},
  187. </if>
  188. <if test="content != null" >
  189. #{content,jdbcType=VARCHAR},
  190. </if>
  191. <if test="reply != null" >
  192. #{reply,jdbcType=VARCHAR},
  193. </if>
  194. <if test="isReply != null" >
  195. #{isReply,jdbcType=CHAR},
  196. </if>
  197. <if test="replyTime != null" >
  198. #{replyTime,jdbcType=TIMESTAMP},
  199. </if>
  200. <if test="createTime != null" >
  201. #{createTime,jdbcType=TIMESTAMP},
  202. </if>
  203. <if test="updateTime != null" >
  204. #{updateTime,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="isDelete != null" >
  207. #{isDelete,jdbcType=CHAR},
  208. </if>
  209. </trim>
  210. </insert>
  211. <select id="countByExample" parameterType="com.cdu.lys.graduation.repository.entity.CommentDOExample" resultType="java.lang.Integer" >
  212. select count(*) from tb_comment
  213. <if test="_parameter != null" >
  214. <include refid="Example_Where_Clause" />
  215. </if>
  216. </select>
  217. <update id="updateByExampleSelective" parameterType="map" >
  218. update tb_comment
  219. <set >
  220. <if test="record.id != null" >
  221. id = #{record.id,jdbcType=INTEGER},
  222. </if>
  223. <if test="record.userId != null" >
  224. user_id = #{record.userId,jdbcType=INTEGER},
  225. </if>
  226. <if test="record.orderNum != null" >
  227. order_num = #{record.orderNum,jdbcType=VARCHAR},
  228. </if>
  229. <if test="record.serviceScore != null" >
  230. service_score = #{record.serviceScore,jdbcType=INTEGER},
  231. </if>
  232. <if test="record.environmentScore != null" >
  233. environment_score = #{record.environmentScore,jdbcType=INTEGER},
  234. </if>
  235. <if test="record.tasteScore != null" >
  236. taste_score = #{record.tasteScore,jdbcType=INTEGER},
  237. </if>
  238. <if test="record.content != null" >
  239. content = #{record.content,jdbcType=VARCHAR},
  240. </if>
  241. <if test="record.reply != null" >
  242. reply = #{record.reply,jdbcType=VARCHAR},
  243. </if>
  244. <if test="record.isReply != null" >
  245. is_reply = #{record.isReply,jdbcType=CHAR},
  246. </if>
  247. <if test="record.replyTime != null" >
  248. reply_time = #{record.replyTime,jdbcType=TIMESTAMP},
  249. </if>
  250. <if test="record.createTime != null" >
  251. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  252. </if>
  253. <if test="record.updateTime != null" >
  254. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  255. </if>
  256. <if test="record.isDelete != null" >
  257. is_delete = #{record.isDelete,jdbcType=CHAR},
  258. </if>
  259. </set>
  260. <if test="_parameter != null" >
  261. <include refid="Update_By_Example_Where_Clause" />
  262. </if>
  263. </update>
  264. <update id="updateByExample" parameterType="map" >
  265. update tb_comment
  266. set id = #{record.id,jdbcType=INTEGER},
  267. user_id = #{record.userId,jdbcType=INTEGER},
  268. order_num = #{record.orderNum,jdbcType=VARCHAR},
  269. service_score = #{record.serviceScore,jdbcType=INTEGER},
  270. environment_score = #{record.environmentScore,jdbcType=INTEGER},
  271. taste_score = #{record.tasteScore,jdbcType=INTEGER},
  272. content = #{record.content,jdbcType=VARCHAR},
  273. reply = #{record.reply,jdbcType=VARCHAR},
  274. is_reply = #{record.isReply,jdbcType=CHAR},
  275. reply_time = #{record.replyTime,jdbcType=TIMESTAMP},
  276. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  277. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  278. is_delete = #{record.isDelete,jdbcType=CHAR}
  279. <if test="_parameter != null" >
  280. <include refid="Update_By_Example_Where_Clause" />
  281. </if>
  282. </update>
  283. <update id="updateByPrimaryKeySelective" parameterType="com.cdu.lys.graduation.repository.entity.CommentDO" >
  284. update tb_comment
  285. <set >
  286. <if test="userId != null" >
  287. user_id = #{userId,jdbcType=INTEGER},
  288. </if>
  289. <if test="orderNum != null" >
  290. order_num = #{orderNum,jdbcType=VARCHAR},
  291. </if>
  292. <if test="serviceScore != null" >
  293. service_score = #{serviceScore,jdbcType=INTEGER},
  294. </if>
  295. <if test="environmentScore != null" >
  296. environment_score = #{environmentScore,jdbcType=INTEGER},
  297. </if>
  298. <if test="tasteScore != null" >
  299. taste_score = #{tasteScore,jdbcType=INTEGER},
  300. </if>
  301. <if test="content != null" >
  302. content = #{content,jdbcType=VARCHAR},
  303. </if>
  304. <if test="reply != null" >
  305. reply = #{reply,jdbcType=VARCHAR},
  306. </if>
  307. <if test="isReply != null" >
  308. is_reply = #{isReply,jdbcType=CHAR},
  309. </if>
  310. <if test="replyTime != null" >
  311. reply_time = #{replyTime,jdbcType=TIMESTAMP},
  312. </if>
  313. <if test="createTime != null" >
  314. create_time = #{createTime,jdbcType=TIMESTAMP},
  315. </if>
  316. <if test="updateTime != null" >
  317. update_time = #{updateTime,jdbcType=TIMESTAMP},
  318. </if>
  319. <if test="isDelete != null" >
  320. is_delete = #{isDelete,jdbcType=CHAR},
  321. </if>
  322. </set>
  323. where id = #{id,jdbcType=INTEGER}
  324. </update>
  325. <update id="updateByPrimaryKey" parameterType="com.cdu.lys.graduation.repository.entity.CommentDO" >
  326. update tb_comment
  327. set user_id = #{userId,jdbcType=INTEGER},
  328. order_num = #{orderNum,jdbcType=VARCHAR},
  329. service_score = #{serviceScore,jdbcType=INTEGER},
  330. environment_score = #{environmentScore,jdbcType=INTEGER},
  331. taste_score = #{tasteScore,jdbcType=INTEGER},
  332. content = #{content,jdbcType=VARCHAR},
  333. reply = #{reply,jdbcType=VARCHAR},
  334. is_reply = #{isReply,jdbcType=CHAR},
  335. reply_time = #{replyTime,jdbcType=TIMESTAMP},
  336. create_time = #{createTime,jdbcType=TIMESTAMP},
  337. update_time = #{updateTime,jdbcType=TIMESTAMP},
  338. is_delete = #{isDelete,jdbcType=CHAR}
  339. where id = #{id,jdbcType=INTEGER}
  340. </update>
  341. </mapper>