ImLiveRoomBlackMapper.xml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.ImLiveRoomBlackDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.ImLiveRoomBlack">
  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="type_" jdbcType="INTEGER" property="type"/>
  9. <result column="create_by_" jdbcType="INTEGER" property="createBy"/>
  10. <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id_
  14. , room_uid_, user_id_, type_, create_by_, create_time_
  15. </sql>
  16. <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
  17. parameterType="com.ym.mec.biz.dal.entity.ImLiveRoomBlack">
  18. insert into im_live_room_black(room_uid_, user_id_, type_, create_by_, create_time_)
  19. values
  20. <foreach collection="entities" item="entity" separator=",">
  21. (#{entity.roomUid}, #{entity.userId}, #{entity.type}, #{entity.createBy}, #{entity.createTime})
  22. </foreach>
  23. </insert>
  24. <select id="queryStudent" parameterType="object" resultType="com.ym.mec.auth.api.entity.SysUser">
  25. select id_ as id,
  26. username_ as username,
  27. real_name_ as realName,
  28. phone_ as phone
  29. from sys_user
  30. where find_in_set('STUDENT', user_type_)
  31. and lock_flag_ = 0
  32. and del_flag_ = 0
  33. and tenant_id_ = 1
  34. and id_ not in (select user_id_ from im_live_room_black where room_uid_ = #{param.roomUid})
  35. <if test="param.tenantId != null ">
  36. and tenant_id_ = #{param.tenantId}
  37. </if>
  38. <if test="param.search != null ">
  39. and (
  40. `id_` LIKE CONCAT('%', #{param.search},'%')
  41. OR `username_` LIKE CONCAT('%', #{param.search},'%')
  42. OR `phone_` LIKE CONCAT('%', #{param.search},'%')
  43. )
  44. </if>
  45. </select>
  46. <select id="queryBlackList" parameterType="map" resultType="com.ym.mec.biz.dal.vo.ImLiveRoomBlackVo">
  47. select a.user_id_,
  48. b.username_,
  49. b.real_name_,
  50. b.phone_,
  51. a.create_time_
  52. from im_live_room_black as a
  53. left join sys_user as b on a.user_id_ = b.id_
  54. where a.type_ = 0
  55. and a.room_uid_ = #{param.roomUid}
  56. <if test="param.search != null ">
  57. and (
  58. a.`user_id_` LIKE CONCAT('%', #{param.search},'%')
  59. OR b.`username_` LIKE CONCAT('%', #{param.search},'%')
  60. OR b.`phone_` LIKE CONCAT('%', #{param.search},'%')
  61. )
  62. </if>
  63. </select>
  64. </mapper>