RoomMonitorConfigMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.juxiao.xchat.module.xbd.mapper.room.RoomMonitorConfigMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.room.RoomMonitorConfig">
  5. <id column="id" property="id" jdbcType="INTEGER"/>
  6. <result column="uid" property="uid" jdbcType="BIGINT"/>
  7. <result column="room" property="room" jdbcType="BIGINT"/>
  8. <result column="state" property="state" jdbcType="INTEGER"/>
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  10. <result column="request_id" property="requestId" jdbcType="VARCHAR"/>
  11. <result column="erban_no" property="erBanNo" jdbcType="BIGINT"/>
  12. <result column="title" property="title" jdbcType="VARCHAR"/>
  13. </resultMap>
  14. <sql id="Base_Column_List">
  15. r.id, r.uid, r.room, r.state, r.create_time,r.request_id
  16. </sql>
  17. <select id="selectByErbanNo" resultMap="BaseResultMap" >
  18. select
  19. <include refid="Base_Column_List"/>,u.erban_no,r1.title
  20. from room_monitor_config r
  21. join users u on r.uid=u.uid
  22. left join room r1 on r.room=r1.room_id
  23. <where>
  24. <if test="erBanNo != null ">
  25. and u.erban_no = #{erBanNo,jdbcType=INTEGER}
  26. </if>
  27. </where>
  28. order by r.state desc,r.create_time
  29. </select>
  30. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  31. select
  32. <include refid="Base_Column_List"/>
  33. from room_monitor_config r
  34. where id = #{id,jdbcType=INTEGER}
  35. </select>
  36. <select id="selectByRequestId" resultMap="BaseResultMap" >
  37. select
  38. <include refid="Base_Column_List"/>
  39. from room_monitor_config r
  40. where request_id = #{requestId,jdbcType=VARCHAR}
  41. </select>
  42. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  43. delete from room_monitor_config
  44. where id = #{id,jdbcType=INTEGER}
  45. </delete>
  46. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.room.RoomMonitorConfig">
  47. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER">
  48. SELECT LAST_INSERT_ID()
  49. </selectKey>
  50. insert into room_monitor_config (uid, room, state,
  51. create_time,request_id)
  52. values (#{uid,jdbcType=BIGINT}, #{room,jdbcType=BIGINT}, #{state,jdbcType=INTEGER},
  53. #{createTime,jdbcType=TIMESTAMP},#{requestId,jdbcType=VARCHAR})
  54. </insert>
  55. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.RoomMonitorConfig">
  56. <selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER">
  57. SELECT LAST_INSERT_ID()
  58. </selectKey>
  59. insert into room_monitor_config
  60. <trim prefix="(" suffix=")" suffixOverrides=",">
  61. <if test="uid != null">
  62. uid,
  63. </if>
  64. <if test="room != null">
  65. room,
  66. </if>
  67. <if test="state != null">
  68. state,
  69. </if>
  70. <if test="createTime != null">
  71. create_time,
  72. </if>
  73. <if test="requestId != null">
  74. request_id,
  75. </if>
  76. </trim>
  77. <trim prefix="values (" suffix=")" suffixOverrides=",">
  78. <if test="uid != null">
  79. #{uid,jdbcType=BIGINT},
  80. </if>
  81. <if test="room != null">
  82. #{room,jdbcType=BIGINT},
  83. </if>
  84. <if test="state != null">
  85. #{state,jdbcType=INTEGER},
  86. </if>
  87. <if test="createTime != null">
  88. #{createTime,jdbcType=TIMESTAMP},
  89. </if>
  90. <if test="requestId != null">
  91. #{requestId,jdbcType=VARCHAR},
  92. </if>
  93. </trim>
  94. </insert>
  95. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.room.RoomMonitorConfig">
  96. update room_monitor_config
  97. <set>
  98. <if test="uid != null">
  99. uid = #{uid,jdbcType=BIGINT},
  100. </if>
  101. <if test="room != null">
  102. room = #{room,jdbcType=BIGINT},
  103. </if>
  104. <if test="state != null">
  105. state = #{state,jdbcType=INTEGER},
  106. </if>
  107. <if test="createTime != null">
  108. create_time = #{createTime,jdbcType=TIMESTAMP},
  109. </if>
  110. <if test="requestId != null">
  111. request_id = #{requestId,jdbcType=VARCHAR},
  112. </if>
  113. </set>
  114. where id = #{id,jdbcType=INTEGER}
  115. </update>
  116. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.room.RoomMonitorConfig">
  117. update room_monitor_config
  118. set uid = #{uid,jdbcType=BIGINT},
  119. room = #{room,jdbcType=BIGINT},
  120. state = #{state,jdbcType=INTEGER},
  121. create_time = #{createTime,jdbcType=TIMESTAMP},
  122. request_id = #{requestId,jdbcType=VARCHAR}
  123. where id = #{id,jdbcType=INTEGER}
  124. </update>
  125. </mapper>