ApiCommentPictureMapper.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.kmall.api.dao.ApiCommentPictureMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.api.entity.CommentPictureVo" id="commentPictureMap">
  6. <result property="id" column="id"/>
  7. <result property="comment_id" column="comment_id"/>
  8. <result property="pic_url" column="pic_url"/>
  9. <result property="sort_order" column="sort_order"/>
  10. </resultMap>
  11. <select id="queryObject" resultMap="commentPictureMap">
  12. select * from mall_comment_picture where id = #{value}
  13. </select>
  14. <select id="queryList" resultMap="commentPictureMap">
  15. select * from mall_comment_picture
  16. where 1 = 1
  17. <if test="comment_id != null">
  18. and comment_id = #{comment_id}
  19. </if>
  20. <choose>
  21. <when test="sidx != null and sidx.trim() != ''">
  22. order by ${sidx} ${order}
  23. </when>
  24. <otherwise>
  25. order by id desc
  26. </otherwise>
  27. </choose>
  28. <if test="offset != null and limit != null">
  29. limit #{offset}, #{limit}
  30. </if>
  31. </select>
  32. <select id="queryTotal" resultType="int">
  33. select count(*) from mall_comment_picture
  34. </select>
  35. <insert id="save" parameterType="com.kmall.api.entity.CommentPictureVo" useGeneratedKeys="true" keyProperty="id">
  36. insert into mall_comment_picture
  37. (
  38. `comment_id`,
  39. `pic_url`,
  40. `sort_order`
  41. )
  42. values
  43. (
  44. #{comment_id},
  45. #{pic_url},
  46. #{sort_order}
  47. )
  48. </insert>
  49. <update id="update" parameterType="com.kmall.api.entity.CommentPictureVo">
  50. update mall_comment_picture
  51. <set>
  52. <if test="comment_id != null">`comment_id` = #{comment_id},</if>
  53. <if test="pic_url != null">`pic_url` = #{pic_url},</if>
  54. <if test="sort_order != null">`sort_order` = #{sort_order}</if>
  55. </set>
  56. where id = #{id}
  57. </update>
  58. <delete id="delete">
  59. delete from mall_comment_picture where id = #{value}
  60. </delete>
  61. <delete id="deleteBatch">
  62. delete from mall_comment_picture where id in
  63. <foreach item="id" collection="array" open="(" separator="," close=")">
  64. #{id}
  65. </foreach>
  66. </delete>
  67. </mapper>