JtCommodityCommentMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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.goafanti.common.dao.JtCommodityCommentMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtCommodityComment">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="commodity_id" jdbcType="VARCHAR" property="commodityId" />
  12. <result column="uid" jdbcType="VARCHAR" property="uid" />
  13. <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
  14. <result column="content" jdbcType="VARCHAR" property="content" />
  15. <result column="star" jdbcType="INTEGER" property="star" />
  16. <result column="ip" jdbcType="VARCHAR" property="ip" />
  17. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  18. </resultMap>
  19. <sql id="Example_Where_Clause">
  20. <!--
  21. WARNING - @mbg.generated
  22. This element is automatically generated by MyBatis Generator, do not modify.
  23. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  24. -->
  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. <!--
  55. WARNING - @mbg.generated
  56. This element is automatically generated by MyBatis Generator, do not modify.
  57. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  58. -->
  59. <where>
  60. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  61. <if test="criteria.valid">
  62. <trim prefix="(" prefixOverrides="and" suffix=")">
  63. <foreach collection="criteria.criteria" item="criterion">
  64. <choose>
  65. <when test="criterion.noValue">
  66. and ${criterion.condition}
  67. </when>
  68. <when test="criterion.singleValue">
  69. and ${criterion.condition} #{criterion.value}
  70. </when>
  71. <when test="criterion.betweenValue">
  72. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  73. </when>
  74. <when test="criterion.listValue">
  75. and ${criterion.condition}
  76. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  77. #{listItem}
  78. </foreach>
  79. </when>
  80. </choose>
  81. </foreach>
  82. </trim>
  83. </if>
  84. </foreach>
  85. </where>
  86. </sql>
  87. <sql id="Base_Column_List">
  88. <!--
  89. WARNING - @mbg.generated
  90. This element is automatically generated by MyBatis Generator, do not modify.
  91. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  92. -->
  93. id, commodity_id, uid, order_no, content, star, ip, create_time
  94. </sql>
  95. <select id="selectByExample" parameterType="com.goafanti.common.model.JtCommodityCommentExample" resultMap="BaseResultMap">
  96. <!--
  97. WARNING - @mbg.generated
  98. This element is automatically generated by MyBatis Generator, do not modify.
  99. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  100. -->
  101. select
  102. <if test="distinct">
  103. distinct
  104. </if>
  105. <include refid="Base_Column_List" />
  106. from jt_commodity_comment
  107. <if test="_parameter != null">
  108. <include refid="Example_Where_Clause" />
  109. </if>
  110. <if test="orderByClause != null">
  111. order by ${orderByClause}
  112. </if>
  113. </select>
  114. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  115. <!--
  116. WARNING - @mbg.generated
  117. This element is automatically generated by MyBatis Generator, do not modify.
  118. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  119. -->
  120. select
  121. <include refid="Base_Column_List" />
  122. from jt_commodity_comment
  123. where id = #{id,jdbcType=VARCHAR}
  124. </select>
  125. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  126. <!--
  127. WARNING - @mbg.generated
  128. This element is automatically generated by MyBatis Generator, do not modify.
  129. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  130. -->
  131. delete from jt_commodity_comment
  132. where id = #{id,jdbcType=VARCHAR}
  133. </delete>
  134. <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtCommodityCommentExample">
  135. <!--
  136. WARNING - @mbg.generated
  137. This element is automatically generated by MyBatis Generator, do not modify.
  138. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  139. -->
  140. delete from jt_commodity_comment
  141. <if test="_parameter != null">
  142. <include refid="Example_Where_Clause" />
  143. </if>
  144. </delete>
  145. <insert id="insert" parameterType="com.goafanti.common.model.JtCommodityComment">
  146. <!--
  147. WARNING - @mbg.generated
  148. This element is automatically generated by MyBatis Generator, do not modify.
  149. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  150. -->
  151. insert into jt_commodity_comment (id, commodity_id, uid,
  152. order_no, content, star,
  153. ip, create_time)
  154. values (#{id,jdbcType=VARCHAR}, #{commodityId,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  155. #{orderNo,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{star,jdbcType=INTEGER},
  156. #{ip,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  157. </insert>
  158. <insert id="insertSelective" parameterType="com.goafanti.common.model.JtCommodityComment">
  159. <!--
  160. WARNING - @mbg.generated
  161. This element is automatically generated by MyBatis Generator, do not modify.
  162. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  163. -->
  164. insert into jt_commodity_comment
  165. <trim prefix="(" suffix=")" suffixOverrides=",">
  166. <if test="id != null">
  167. id,
  168. </if>
  169. <if test="commodityId != null">
  170. commodity_id,
  171. </if>
  172. <if test="uid != null">
  173. uid,
  174. </if>
  175. <if test="orderNo != null">
  176. order_no,
  177. </if>
  178. <if test="content != null">
  179. content,
  180. </if>
  181. <if test="star != null">
  182. star,
  183. </if>
  184. <if test="ip != null">
  185. ip,
  186. </if>
  187. <if test="createTime != null">
  188. create_time,
  189. </if>
  190. </trim>
  191. <trim prefix="values (" suffix=")" suffixOverrides=",">
  192. <if test="id != null">
  193. #{id,jdbcType=VARCHAR},
  194. </if>
  195. <if test="commodityId != null">
  196. #{commodityId,jdbcType=VARCHAR},
  197. </if>
  198. <if test="uid != null">
  199. #{uid,jdbcType=VARCHAR},
  200. </if>
  201. <if test="orderNo != null">
  202. #{orderNo,jdbcType=VARCHAR},
  203. </if>
  204. <if test="content != null">
  205. #{content,jdbcType=VARCHAR},
  206. </if>
  207. <if test="star != null">
  208. #{star,jdbcType=INTEGER},
  209. </if>
  210. <if test="ip != null">
  211. #{ip,jdbcType=VARCHAR},
  212. </if>
  213. <if test="createTime != null">
  214. #{createTime,jdbcType=TIMESTAMP},
  215. </if>
  216. </trim>
  217. </insert>
  218. <select id="countByExample" parameterType="com.goafanti.common.model.JtCommodityCommentExample" resultType="java.lang.Long">
  219. <!--
  220. WARNING - @mbg.generated
  221. This element is automatically generated by MyBatis Generator, do not modify.
  222. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  223. -->
  224. select count(*) from jt_commodity_comment
  225. <if test="_parameter != null">
  226. <include refid="Example_Where_Clause" />
  227. </if>
  228. </select>
  229. <update id="updateByExampleSelective" parameterType="map">
  230. <!--
  231. WARNING - @mbg.generated
  232. This element is automatically generated by MyBatis Generator, do not modify.
  233. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  234. -->
  235. update jt_commodity_comment
  236. <set>
  237. <if test="record.id != null">
  238. id = #{record.id,jdbcType=VARCHAR},
  239. </if>
  240. <if test="record.commodityId != null">
  241. commodity_id = #{record.commodityId,jdbcType=VARCHAR},
  242. </if>
  243. <if test="record.uid != null">
  244. uid = #{record.uid,jdbcType=VARCHAR},
  245. </if>
  246. <if test="record.orderNo != null">
  247. order_no = #{record.orderNo,jdbcType=VARCHAR},
  248. </if>
  249. <if test="record.content != null">
  250. content = #{record.content,jdbcType=VARCHAR},
  251. </if>
  252. <if test="record.star != null">
  253. star = #{record.star,jdbcType=INTEGER},
  254. </if>
  255. <if test="record.ip != null">
  256. ip = #{record.ip,jdbcType=VARCHAR},
  257. </if>
  258. <if test="record.createTime != null">
  259. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  260. </if>
  261. </set>
  262. <if test="_parameter != null">
  263. <include refid="Update_By_Example_Where_Clause" />
  264. </if>
  265. </update>
  266. <update id="updateByExample" parameterType="map">
  267. <!--
  268. WARNING - @mbg.generated
  269. This element is automatically generated by MyBatis Generator, do not modify.
  270. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  271. -->
  272. update jt_commodity_comment
  273. set id = #{record.id,jdbcType=VARCHAR},
  274. commodity_id = #{record.commodityId,jdbcType=VARCHAR},
  275. uid = #{record.uid,jdbcType=VARCHAR},
  276. order_no = #{record.orderNo,jdbcType=VARCHAR},
  277. content = #{record.content,jdbcType=VARCHAR},
  278. star = #{record.star,jdbcType=INTEGER},
  279. ip = #{record.ip,jdbcType=VARCHAR},
  280. create_time = #{record.createTime,jdbcType=TIMESTAMP}
  281. <if test="_parameter != null">
  282. <include refid="Update_By_Example_Where_Clause" />
  283. </if>
  284. </update>
  285. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtCommodityComment">
  286. <!--
  287. WARNING - @mbg.generated
  288. This element is automatically generated by MyBatis Generator, do not modify.
  289. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  290. -->
  291. update jt_commodity_comment
  292. <set>
  293. <if test="commodityId != null">
  294. commodity_id = #{commodityId,jdbcType=VARCHAR},
  295. </if>
  296. <if test="uid != null">
  297. uid = #{uid,jdbcType=VARCHAR},
  298. </if>
  299. <if test="orderNo != null">
  300. order_no = #{orderNo,jdbcType=VARCHAR},
  301. </if>
  302. <if test="content != null">
  303. content = #{content,jdbcType=VARCHAR},
  304. </if>
  305. <if test="star != null">
  306. star = #{star,jdbcType=INTEGER},
  307. </if>
  308. <if test="ip != null">
  309. ip = #{ip,jdbcType=VARCHAR},
  310. </if>
  311. <if test="createTime != null">
  312. create_time = #{createTime,jdbcType=TIMESTAMP},
  313. </if>
  314. </set>
  315. where id = #{id,jdbcType=VARCHAR}
  316. </update>
  317. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtCommodityComment">
  318. <!--
  319. WARNING - @mbg.generated
  320. This element is automatically generated by MyBatis Generator, do not modify.
  321. This element was generated on Thu Jul 19 10:59:39 CST 2018.
  322. -->
  323. update jt_commodity_comment
  324. set commodity_id = #{commodityId,jdbcType=VARCHAR},
  325. uid = #{uid,jdbcType=VARCHAR},
  326. order_no = #{orderNo,jdbcType=VARCHAR},
  327. content = #{content,jdbcType=VARCHAR},
  328. star = #{star,jdbcType=INTEGER},
  329. ip = #{ip,jdbcType=VARCHAR},
  330. create_time = #{createTime,jdbcType=TIMESTAMP}
  331. where id = #{id,jdbcType=VARCHAR}
  332. </update>
  333. <select id="getCommentCount" resultType="java.lang.Integer">
  334. select count(0) from jt_commodity_comment
  335. where commodity_id=#{1}
  336. and ((#{0}=0 and (star =4 or star=5)) or (#{0}=1 and (star = 3)) or (#{0} =2 and (star=1 or star=2)) )
  337. </select>
  338. <select id="searchCommentByCommodityId" resultType="com.goafanti.comment.bo.CommentDetailResult">
  339. select jcc.create_time as createTime,
  340. jcc.content,jcc.star,u.identify_name as commenter
  341. from jt_commodity_comment jcc
  342. left join user u on jcc.uid=u.id
  343. where jcc.commodity_id=#{commodityId,jdbcType=VARCHAR}
  344. order by jcc.create_time desc
  345. <if test="page_sql!=null">
  346. ${page_sql}
  347. </if>
  348. </select>
  349. <select id="searchCommentCountByCommodityId" resultType="java.lang.Integer">
  350. select count(0)
  351. from jt_commodity_comment jcc
  352. left join user u on jcc.uid=u.id
  353. where jcc.commodity_id=#{commodityId,jdbcType=VARCHAR}
  354. </select>
  355. </mapper>