ImLiveRoomReservationMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.os_ AS os,
  29. a.room_uid_ AS roomUid,
  30. a.room_title_ AS roomTitle,
  31. a.live_remark_ AS liveRemark,
  32. a.speaker_id_ AS speakerId,
  33. b.real_name_ AS speakerName,
  34. b.im_token_ as imToken,
  35. b.avatar_ AS speakerPic,
  36. a.live_start_time_ AS liveStartTime,
  37. a.live_state_ AS liveState,
  38. a.room_state_ AS roomState,
  39. c.real_name_ AS createdByName,
  40. a.pre_template_ AS preTemplate,
  41. a.room_config_ AS roomConfig,
  42. a.popularize_ AS popularize,
  43. a.created_time_ AS createdTime,
  44. a.service_provider_ as serviceProvider,
  45. a.popularize_type_ AS popularizeType,
  46. a.view_mode_ AS viewMode,
  47. a.shopping_title_ AS shoppingTitle,
  48. IF(d.user_id_ is null, 0, 1) as reserve
  49. from (
  50. select *
  51. from im_live_broadcast_room
  52. where popularize_type_ = 'ALL'
  53. union all
  54. select a.*
  55. from im_live_broadcast_room as a
  56. inner join im_live_room_purview as b on a.room_uid_ = b.room_uid_
  57. where b.user_id_ = #{param.userId}
  58. ) as a
  59. left join tenant_info AS t on a.tenant_id_ = t.id_
  60. left join sys_user AS b on a.speaker_id_ = b.id_
  61. left join sys_user AS c on a.created_by_ = c.id_
  62. left join im_live_room_reservation as d on a.room_uid_ = d.room_uid_ and d.user_id_ = #{param.userId}
  63. <where>
  64. a.room_state_ in(0, 2)
  65. <if test="param.tenantId != null ">
  66. AND a.tenant_id_ = #{param.tenantId}
  67. </if>
  68. <if test="param.liveState != null">
  69. and a.live_state_ = #{param.liveState}
  70. </if>
  71. <if test="param.startTime != null">
  72. <![CDATA[ AND a.live_start_time_ >= #{param.startTime} ]]>
  73. </if>
  74. <if test="param.endTime != null">
  75. <![CDATA[ AND a.live_start_time_ <= #{param.endTime} ]]>
  76. </if>
  77. <if test="param.popularize != null">
  78. and a.popularize_ = #{param.popularize}
  79. </if>
  80. <if test="param.roomUid != null">
  81. and a.room_uid_ = #{param.roomUid}
  82. </if>
  83. </where>
  84. </select>
  85. <select id="selectCountRoomReservation" resultType="com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomVo">
  86. select
  87. lbr.room_uid_ as roomUid,
  88. count(1) as roomReservationNum
  89. from im_live_room_reservation lbr
  90. <where>
  91. <if test="roomIdList != null and roomIdList.size() != 0">
  92. and lbr.room_uid_ in
  93. <foreach collection="roomIdList" separator="," close=")" open="(" item="item" >
  94. #{item}
  95. </foreach>
  96. </if>
  97. </where>
  98. group by lbr.room_uid_
  99. </select>
  100. <select id="queryMusicGroupIds" resultType="string">
  101. select group_concat(music_group_id_)
  102. from student_registration
  103. where user_id_ = #{userId}
  104. and music_group_status_ != 'QUIT'
  105. group by user_id_
  106. </select>
  107. </mapper>