MomentsPicMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.juxiao.xchat.module.xbd.mapper.circle.MomentsPicMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.circle.MomentsPic" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="moments_id" property="momentsId" jdbcType="INTEGER" />
  7. <result column="pic" property="pic" jdbcType="VARCHAR" />
  8. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  9. </resultMap>
  10. <sql id="Base_Column_List" >
  11. id, moments_id, pic, create_time
  12. </sql>
  13. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  14. select
  15. <include refid="Base_Column_List" />
  16. from moments_pic
  17. where id = #{id,jdbcType=INTEGER}
  18. </select>
  19. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsPic" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  20. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  21. SELECT LAST_INSERT_ID()
  22. </selectKey>
  23. insert into moments_pic (moments_id, pic, create_time
  24. )
  25. values (#{momentsId,jdbcType=INTEGER}, #{pic,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
  26. )
  27. </insert>
  28. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsPic" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
  29. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
  30. SELECT LAST_INSERT_ID()
  31. </selectKey>
  32. insert into moments_pic
  33. <trim prefix="(" suffix=")" suffixOverrides="," >
  34. <if test="momentsId != null" >
  35. moments_id,
  36. </if>
  37. <if test="pic != null" >
  38. pic,
  39. </if>
  40. <if test="createTime != null" >
  41. create_time,
  42. </if>
  43. </trim>
  44. <trim prefix="values (" suffix=")" suffixOverrides="," >
  45. <if test="momentsId != null" >
  46. #{momentsId,jdbcType=INTEGER},
  47. </if>
  48. <if test="pic != null" >
  49. #{pic,jdbcType=VARCHAR},
  50. </if>
  51. <if test="createTime != null" >
  52. #{createTime,jdbcType=TIMESTAMP},
  53. </if>
  54. </trim>
  55. </insert>
  56. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsPic" >
  57. update moments_pic
  58. <set >
  59. <if test="momentsId != null" >
  60. moments_id = #{momentsId,jdbcType=INTEGER},
  61. </if>
  62. <if test="pic != null" >
  63. pic = #{pic,jdbcType=VARCHAR},
  64. </if>
  65. <if test="createTime != null" >
  66. create_time = #{createTime,jdbcType=TIMESTAMP},
  67. </if>
  68. </set>
  69. where id = #{id,jdbcType=INTEGER}
  70. </update>
  71. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.circle.MomentsPic" >
  72. update moments_pic
  73. set moments_id = #{momentsId,jdbcType=INTEGER},
  74. pic = #{pic,jdbcType=VARCHAR},
  75. create_time = #{createTime,jdbcType=TIMESTAMP}
  76. where id = #{id,jdbcType=INTEGER}
  77. </update>
  78. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  79. delete from moments_pic
  80. where id = #{id,jdbcType=INTEGER}
  81. </delete>
  82. <select id="countByMomentsPic" resultType="java.lang.Integer">
  83. select count(*) from moments_pic where moments_id = #{momentsId}
  84. </select>
  85. <select id="selectMomentsPicByMomentsId" resultMap="BaseResultMap">
  86. select
  87. <include refid="Base_Column_List" />
  88. from moments_pic
  89. where moments_id = #{momentsId}
  90. </select>
  91. <delete id="deleteByMomentsId">
  92. delete from moments_pic where moments_id = #{momentsId}
  93. </delete>
  94. </mapper>