UserPostMapper.xml 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.juxiao.xchat.module.system.mapper.UserPostMapper">
  6. <resultMap type="com.juxiao.xchat.module.system.domain.UserPost" id="UserPostResult">
  7. <result property="userId" column="user_id" />
  8. <result property="postId" column="post_id" />
  9. </resultMap>
  10. <delete id="deleteUserPostByUserId" parameterType="java.lang.Long">
  11. delete from sys_user_post where user_id=#{userId}
  12. </delete>
  13. <select id="countUserPostById" resultType="java.lang.Integer">
  14. select count(1) from sys_user_post where post_id=#{postId}
  15. </select>
  16. <delete id="deleteUserPost" parameterType="java.lang.Long">
  17. delete from sys_user_post where user_id in
  18. <foreach collection="array" item="userId" open="(" separator="," close=")">
  19. #{userId}
  20. </foreach>
  21. </delete>
  22. <insert id="batchUserPost">
  23. insert into sys_user_post(user_id, post_id) values
  24. <foreach item="item" index="index" collection="list" separator=",">
  25. (#{item.userId},#{item.postId})
  26. </foreach>
  27. </insert>
  28. </mapper>