ImLiveRoomReservationMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 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
  51. where popularize_type_ = 'ORGAN'
  52. AND FIND_IN_SET(#{param.organId}, popularize_org_ids_)
  53. <if test="param.schoolId != null">
  54. union all
  55. select *
  56. from im_live_broadcast_room
  57. where popularize_type_ = 'SCHOOL'
  58. AND FIND_IN_SET(#{param.schoolId}, popularize_school_ids_)
  59. </if>
  60. <if test="param.teamIds != null">
  61. union all
  62. select *
  63. from im_live_broadcast_room as a
  64. where popularize_type_ = 'TEAM'
  65. and INTE_ARRAY(a.popularize_team_ids_, #{param.teamIds}) = 1
  66. </if>
  67. ) as a
  68. left join tenant_info AS t on a.tenant_id_ = t.id_
  69. left join sys_user AS b on a.speaker_id_ = b.id_
  70. left join sys_user AS c on a.created_by_ = c.id_
  71. left join im_live_room_reservation as d on a.room_uid_ = d.room_uid_ and d.user_id_ = #{param.userId}
  72. <where>
  73. a.room_state_ in(0, 2)
  74. <if test="param.tenantId != null ">
  75. AND a.tenant_id_ = #{param.tenantId}
  76. </if>
  77. <if test="param.liveState != null">
  78. and a.live_state_ = #{param.liveState}
  79. </if>
  80. <if test="param.startTime != null">
  81. <![CDATA[ AND a.live_start_time_ >= #{param.startTime} ]]>
  82. </if>
  83. <if test="param.endTime != null">
  84. <![CDATA[ AND a.live_start_time_ <= #{param.endTime} ]]>
  85. </if>
  86. <if test="param.popularize != null">
  87. and a.popularize_ = #{param.popularize}
  88. </if>
  89. </where>
  90. </select>
  91. <select id="selectCountRoomReservation" resultType="com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomVo">
  92. select
  93. lbr.room_uid_ as roomUid,
  94. count(1) as roomReservationNum
  95. from im_live_room_reservation lbr
  96. <where>
  97. <if test="roomIdList != null and roomIdList.size() != 0">
  98. and lbr.room_uid_ in
  99. <foreach collection="roomIdList" separator="," close=")" open="(" item="item" >
  100. #{item}
  101. </foreach>
  102. </if>
  103. </where>
  104. group by lbr.room_uid_
  105. </select>
  106. <select id="queryMusicGroupIds" resultType="string">
  107. select group_concat(music_group_id_)
  108. from student_registration
  109. where user_id_ = #{userId}
  110. and music_group_status_ != 'QUIT'
  111. group by user_id_
  112. </select>
  113. </mapper>