ImLiveRoomReservationMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.ym.mec.biz.dal.dao.ImLiveRoomReservationDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.ImLiveRoomReservation">
  5. <id column="id_" jdbcType="INTEGER" property="id"/>
  6. <result column="room_uid_" jdbcType="VARCHAR" property="roomUid"/>
  7. <result column="user_id_" jdbcType="INTEGER" property="userId"/>
  8. <result column="push_state_" jdbcType="INTEGER" property="pushState"/>
  9. <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
  10. </resultMap>
  11. <sql id="Base_Column_List">
  12. id_
  13. , room_uid_, user_id_, push_state_, create_time_
  14. </sql>
  15. <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
  16. parameterType="com.ym.mec.biz.dal.entity.ImLiveRoomReservation">
  17. insert into im_live_room_reservation(room_uid_, user_id_, push_state_, create_time_)
  18. values
  19. <foreach collection="entities" item="entity" separator=",">
  20. (#{entity.roomUid}, #{entity.userId}, #{entity.pushState}, #{entity.createTime})
  21. </foreach>
  22. </insert>
  23. <select id="queryPageStudent" resultType="com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomVo">
  24. select distinct a.id_ AS id,
  25. a.tenant_id_ AS tenantId,
  26. t.name_ AS tenantName,
  27. t.logo_ AS tenantLogo,
  28. a.room_uid_ AS roomUid,
  29. a.room_title_ AS roomTitle,
  30. a.live_remark_ AS liveRemark,
  31. a.speaker_id_ AS speakerId,
  32. b.real_name_ AS speakerName,
  33. b.im_token_ as imToken,
  34. b.avatar_ AS speakerPic,
  35. a.live_start_time_ AS liveStartTime,
  36. a.live_state_ AS liveState,
  37. a.room_state_ AS roomState,
  38. c.real_name_ AS createdByName,
  39. a.pre_template_ AS preTemplate,
  40. a.room_config_ AS roomConfig,
  41. a.popularize_ AS popularize,
  42. a.popularize_type_ AS popularizeType,
  43. IF(d.user_id_ is null, 0, 1) as reserve
  44. from (
  45. select *
  46. from im_live_broadcast_room
  47. where popularize_type_ = 'ALL'
  48. union all
  49. select *
  50. from im_live_broadcast_room as a
  51. inner join from im_live_room_purview as b on a.room_uid_ = b.room_uid_
  52. where b.user_id_ = #{param.userId}
  53. ) as a
  54. left join tenant_info AS t on a.tenant_id_ = t.id_
  55. left join sys_user AS b on a.speaker_id_ = b.id_
  56. left join sys_user AS c on a.created_by_ = c.id_
  57. left join im_live_room_reservation as d on a.room_uid_ = d.room_uid_ and d.user_id_ = #{param.userId}
  58. <where>
  59. a.room_state_ in(0, 2)
  60. <if test="param.tenantId != null ">
  61. AND a.tenant_id_ = #{param.tenantId}
  62. </if>
  63. <if test="param.liveState != null">
  64. and a.live_state_ = #{param.liveState}
  65. </if>
  66. <if test="param.startTime != null">
  67. <![CDATA[ AND a.live_start_time_ >= #{param.startTime} ]]>
  68. </if>
  69. <if test="param.endTime != null">
  70. <![CDATA[ AND a.live_start_time_ <= #{param.endTime} ]]>
  71. </if>
  72. <if test="param.popularize != null">
  73. and a.popularize_ = #{param.popularize}
  74. </if>
  75. <if test="param.roomUid != null">
  76. and a.room_uid_ = #{param.roomUid}
  77. </if>
  78. </where>
  79. </select>
  80. <select id="selectCountRoomReservation" resultType="com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomVo">
  81. select
  82. lbr.room_uid_ as roomUid,
  83. count(1) as roomReservationNum
  84. from im_live_room_reservation lbr
  85. <where>
  86. <if test="roomIdList != null and roomIdList.size() != 0">
  87. and lbr.room_uid_ in
  88. <foreach collection="roomIdList" separator="," close=")" open="(" item="item" >
  89. #{item}
  90. </foreach>
  91. </if>
  92. </where>
  93. group by lbr.room_uid_
  94. </select>
  95. <select id="queryMusicGroupIds" resultType="string">
  96. select group_concat(music_group_id_)
  97. from student_registration
  98. where user_id_ = #{userId}
  99. and music_group_status_ != 'QUIT'
  100. group by user_id_
  101. </select>
  102. </mapper>