ChannelRoomMapper.xml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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.operation.ChannelRoomMapper" >
  4. <delete id="deleteByChannelId" parameterType="integer">
  5. DELETE FROM channel_room WHERE channel_id = #{id}
  6. </delete>
  7. <select id="listUidByChannelId" resultType="long">
  8. SELECT uid FROM channel_room WHERE channel_id = #{id}
  9. </select>
  10. <insert id="insertChannelRoom">
  11. INSERT INTO channel_room
  12. (channel_id, uid)
  13. VALUES
  14. <foreach item='value' index='index' collection='list' separator=','>
  15. (#{id}, #{value})
  16. </foreach>
  17. </insert>
  18. <select id="listByChannelId" resultType="com.juxiao.xchat.module.xbd.domain.operation.ChannelRoom">
  19. SELECT
  20. r.uid,
  21. r.room_id AS roomId,
  22. r.tag_id AS tagId,
  23. r.room_tag AS roomTag,
  24. r.avatar AS avatar,
  25. r.type AS type,
  26. r.title AS title,
  27. u.erban_no AS erbanNo
  28. FROM room r
  29. LEFT JOIN users u ON u.uid = r.uid
  30. LEFT JOIN channel_room cr ON cr.uid = r.uid
  31. WHERE cr.channel_id = #{channelId}
  32. </select>
  33. <delete id="deleteChannelRoomByChannelIdAndUid">
  34. DELETE FROM channel_room WHERE channel_id = #{channelId} AND uid = #{uid}
  35. </delete>
  36. </mapper>