ImLiveRoomReservationMapper.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. case when d.user_id_ is null then 0 else 1 end as reserve
  43. from im_live_broadcast_room as a
  44. left join tenant_info AS t on a.tenant_id_ = t.id_
  45. left join sys_user AS b on a.speaker_id_ = b.id_
  46. left join sys_user AS c on a.created_by_ = c.id_
  47. left join im_live_room_reservation as d on a.room_uid_ = d.room_uid_ and d.user_id_ = #{param.userId}
  48. <where>
  49. a.room_state_ in(0, 2)
  50. <if test="param.tenantId != null ">
  51. AND a.tenant_id_ = #{param.tenantId}
  52. </if>
  53. <if test="param.liveState != null">
  54. and a.live_state_ = #{param.liveState}
  55. </if>
  56. <if test="param.startTime != null">
  57. <![CDATA[ AND a.live_start_time_ >= #{param.startTime} ]]>
  58. </if>
  59. <if test="param.endTime != null">
  60. <![CDATA[ AND a.live_start_time_ <= #{param.endTime} ]]>
  61. </if>
  62. </where>
  63. </select>
  64. </mapper>