LiveMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.live.mapper.LiveMapper">
  6. <resultMap type="Live" id="LiveResult">
  7. <result property="liveId" column="live_id" />
  8. <result property="companyId" column="company_id" />
  9. <result property="companyUserId" column="company_user_id" />
  10. <result property="talentId" column="talent_id" />
  11. <result property="liveName" column="live_name" />
  12. <result property="liveDesc" column="live_desc" />
  13. <result property="showType" column="show_type" />
  14. <result property="status" column="status" />
  15. <result property="anchorId" column="anchor_id" />
  16. <result property="liveType" column="live_type" />
  17. <result property="startTime" column="start_time" />
  18. <result property="finishTime" column="finish_time" />
  19. <result property="liveImgUrl" column="live_img_url" />
  20. <result property="liveConfig" column="live_config" />
  21. <result property="isShow" column="is_show" />
  22. <result property="isDel" column="is_del" />
  23. <result property="qwQrCode" column="qw_qr_code" />
  24. <result property="rtmpUrl" column="rtmp_url" />
  25. <result property="createTime" column="create_time" />
  26. <result property="createBy" column="create_by" />
  27. <result property="updateBy" column="update_by" />
  28. <result property="updateTime" column="update_time" />
  29. <result property="remark" column="remark" />
  30. <result property="configJson" column="config_json" />
  31. <result property="isAudit" column="is_audit" />
  32. <result property="idCardUrl" column="id_card_url" />
  33. </resultMap>
  34. <sql id="selectLiveVo">
  35. select live_id, company_id, company_user_id,talent_id, live_name, is_audit, live_desc, show_type, status, anchor_id, live_type, start_time, finish_time,
  36. live_img_url, live_config, id_card_url, is_show, is_del, qw_qr_code, rtmp_url, flv_hls_url,
  37. create_time, create_by, update_by, update_time, remark,config_json from live
  38. </sql>
  39. <select id="liveList" parameterType="Live" resultMap="LiveResult">
  40. select a.live_id, a.company_id, a.company_user_id,talent_id, a.live_name, a.is_audit, a.live_desc, a.show_type, a.status, a.anchor_id,
  41. a.live_type, a.start_time, a.finish_time, a.live_img_url, a.live_config, a.id_card_url, a.is_show, a.is_del, a.qw_qr_code, a.rtmp_url,
  42. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url from live
  43. a
  44. left join live_video b on a.live_id = b.live_id
  45. where 1=1 and is_del = 0 and is_show = 1 and status = 2
  46. order by create_time desc
  47. </select>
  48. <select id="selectLiveList" parameterType="Live" resultMap="LiveResult">
  49. select a.live_id, a.company_id, a.company_user_id,talent_id, a.live_name, a.is_audit, a.live_desc, a.show_type, a.status, a.anchor_id,
  50. a.live_type, a.start_time, a.finish_time, a.live_img_url, a.live_config, a.id_card_url, a.is_show, a.is_del, a.qw_qr_code, a.rtmp_url,
  51. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url from live
  52. a
  53. left join live_video b on a.live_id = b.live_id
  54. where 1=1 and is_del = 0
  55. <if test="companyId != null "> and company_id = #{companyId}</if>
  56. <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
  57. <if test="talentId != null "> and talent_id = #{talentId}</if>
  58. <if test="liveName != null and liveName != ''"> and live_name like concat('%', #{liveName}, '%')</if>
  59. <if test="liveDesc != null and liveDesc != ''"> and live_desc = #{liveDesc}</if>
  60. <if test="showType != null "> and show_type = #{showType}</if>
  61. <if test="status != null "> and status = #{status}</if>
  62. <if test="anchorId != null "> and anchor_id = #{anchorId}</if>
  63. <if test="liveType != null "> and live_type = #{liveType}</if>
  64. <if test="startTime != null "> and start_time = #{startTime}</if>
  65. <if test="finishTime != null "> and finish_time = #{finishTime}</if>
  66. <if test="liveImgUrl != null and liveImgUrl != ''"> and live_img_url = #{liveImgUrl}</if>
  67. <if test="liveConfig != null and liveConfig != ''"> and live_config = #{liveConfig}</if>
  68. <if test="isShow != null "> and is_show = #{isShow}</if>
  69. <if test="qwQrCode != null and qwQrCode != ''"> and qw_qr_code = #{qwQrCode}</if>
  70. <if test="rtmpUrl != null and rtmpUrl != ''"> and rtmp_url = #{rtmpUrl}</if>
  71. <if test="flvHlsUrl != null and flvHlsUrl != ''"> and flv_hls_url = #{flvHlsUrl}</if>
  72. <if test="isAudit != null and isAudit != ''"> and is_audit = #{isAudit}</if>
  73. order by create_time desc
  74. </select>
  75. <select id="selectLiveByLiveId" parameterType="Long" resultMap="LiveResult">
  76. <include refid="selectLiveVo"/>
  77. where live_id = #{liveId}
  78. </select>
  79. <select id="selectLiveByLiveIdAndCompanyIdAndCompanyUserId" resultMap="LiveResult">
  80. <include refid="selectLiveVo"/>
  81. where live_id = #{liveId} and company_id = #{companyId} and company_user_id = #{companyUserId}
  82. </select>
  83. <select id="selectLiveToStudent" resultType="com.fs.live.domain.Live">
  84. <include refid="selectLiveVo"/>
  85. where 1=1
  86. <if test="status != null and status != ''">
  87. AND status = #{status}
  88. </if>
  89. <if test="liveName != null and liveName != null">
  90. AND live_name like concat('%', #{liveName}, '%')
  91. </if>
  92. <if test="startTime != null and startTime != '' and finishTime != null and finishTime != ''">
  93. AND start_time BETWEEN #{startTime} AND #{finishTime}
  94. </if>
  95. </select>
  96. <insert id="insertLive" parameterType="Live" useGeneratedKeys="true" keyProperty="liveId">
  97. insert into live
  98. <trim prefix="(" suffix=")" suffixOverrides=",">
  99. <if test="companyId != null">company_id,</if>
  100. <if test="companyUserId != null">company_user_id,</if>
  101. <if test="talentId != null">talent_id,</if>
  102. <if test="liveName != null">live_name,</if>
  103. <if test="liveDesc != null">live_desc,</if>
  104. <if test="showType != null">show_type,</if>
  105. <if test="status != null">status,</if>
  106. <if test="anchorId != null">anchor_id,</if>
  107. <if test="liveType != null">live_type,</if>
  108. <if test="startTime != null">start_time,</if>
  109. <if test="finishTime != null">finish_time,</if>
  110. <if test="liveImgUrl != null">live_img_url,</if>
  111. <if test="liveConfig != null">live_config,</if>
  112. <if test="isShow != null">is_show,</if>
  113. <if test="isDel != null">is_del,</if>
  114. <if test="qwQrCode != null">qw_qr_code,</if>
  115. <if test="rtmpUrl != null">rtmp_url,</if>
  116. <if test="createTime != null">create_time,</if>
  117. <if test="createBy != null">create_by,</if>
  118. <if test="updateBy != null">update_by,</if>
  119. <if test="updateTime != null">update_time,</if>
  120. <if test="remark != null">remark,</if>
  121. <if test="configJson != null">config_json,</if>
  122. <if test="flvHlsUrl != null">flv_hls_url,</if>
  123. <if test="isAudit != null">is_audit,</if>
  124. <if test="idCardUrl != null">id_card_url,</if>
  125. </trim>
  126. <trim prefix="values (" suffix=")" suffixOverrides=",">
  127. <if test="companyId != null">#{companyId},</if>
  128. <if test="companyUserId != null">#{companyUserId},</if>
  129. <if test="talentId != null">#{talentId},</if>
  130. <if test="liveName != null">#{liveName},</if>
  131. <if test="liveDesc != null">#{liveDesc},</if>
  132. <if test="showType != null">#{showType},</if>
  133. <if test="status != null">#{status},</if>
  134. <if test="anchorId != null">#{anchorId},</if>
  135. <if test="liveType != null">#{liveType},</if>
  136. <if test="startTime != null">#{startTime},</if>
  137. <if test="finishTime != null">#{finishTime},</if>
  138. <if test="liveImgUrl != null">#{liveImgUrl},</if>
  139. <if test="liveConfig != null">#{liveConfig},</if>
  140. <if test="isShow != null">#{isShow},</if>
  141. <if test="isDel != null">#{isDel},</if>
  142. <if test="qwQrCode != null">#{qwQrCode},</if>
  143. <if test="rtmpUrl != null">#{rtmpUrl},</if>
  144. <if test="createTime != null">#{createTime},</if>
  145. <if test="createBy != null">#{createBy},</if>
  146. <if test="updateBy != null">#{updateBy},</if>
  147. <if test="updateTime != null">#{updateTime},</if>
  148. <if test="remark != null">#{remark},</if>
  149. <if test="configJson != null">#{configJson},</if>
  150. <if test="flvHlsUrl != null">#{flvHlsUrl},</if>
  151. <if test="isAudit != null">#{isAudit},</if>
  152. <if test="idCardUrl != null">#{idCardUrl},</if>
  153. </trim>
  154. </insert>
  155. <update id="updateLive" parameterType="Live">
  156. update live
  157. <trim prefix="SET" suffixOverrides=",">
  158. <if test="talentId != null">talent_id = #{talentId},</if>
  159. <if test="liveName != null">live_name = #{liveName},</if>
  160. <if test="liveDesc != null">live_desc = #{liveDesc},</if>
  161. <if test="showType != null">show_type = #{showType},</if>
  162. <if test="status != null">status = #{status},</if>
  163. <if test="anchorId != null">anchor_id = #{anchorId},</if>
  164. <if test="liveType != null">live_type = #{liveType},</if>
  165. <if test="startTime != null">start_time = #{startTime},</if>
  166. <if test="finishTime != null">finish_time = #{finishTime},</if>
  167. <if test="finishTime == null">finish_time = NULL,</if>
  168. <if test="liveImgUrl != null">live_img_url = #{liveImgUrl},</if>
  169. <if test="liveConfig != null">live_config = #{liveConfig},</if>
  170. <if test="isShow != null">is_show = #{isShow},</if>
  171. <if test="isDel != null">is_del = #{isDel},</if>
  172. <if test="qwQrCode != null">qw_qr_code = #{qwQrCode},</if>
  173. <if test="rtmpUrl != null">rtmp_url = #{rtmpUrl},</if>
  174. <if test="createTime != null">create_time = #{createTime},</if>
  175. <if test="createBy != null">create_by = #{createBy},</if>
  176. <if test="updateBy != null">update_by = #{updateBy},</if>
  177. <if test="updateTime != null">update_time = #{updateTime},</if>
  178. <if test="remark != null">remark = #{remark},</if>
  179. <if test="configJson != null">config_json = #{configJson},</if>
  180. <if test="flvHlsUrl != null">flv_hls_url = #{flvHlsUrl},</if>
  181. <if test="isAudit != null">is_audit = #{isAudit},</if>
  182. <if test="idCardUrl != null">id_card_url = #{idCardUrl},</if>
  183. </trim>
  184. where live_id = #{liveId}
  185. </update>
  186. <delete id="deleteLiveByLiveId" parameterType="Long">
  187. delete from live where live_id = #{liveId}
  188. </delete>
  189. <delete id="deleteLiveByLiveIds" parameterType="String">
  190. delete from live where live_id in
  191. <foreach item="liveId" collection="array" open="(" separator="," close=")">
  192. #{liveId}
  193. </foreach>
  194. </delete>
  195. <update id="updateBatchLiveList" parameterType="com.fs.live.vo.LiveListVo">
  196. update live set is_show = #{liveVo.isShow},status = 3,finish_time = NOW() where live_id in
  197. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  198. #{liveId}
  199. </foreach>
  200. </update>
  201. <update id="deleteBatchLiveList" parameterType="com.fs.live.vo.LiveListVo">
  202. update live set is_del = 1
  203. WHERE company_id = #{liveVo.companyId} and company_user_id = #{liveVo.companyUserId} and live_id IN
  204. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  205. #{liveId}
  206. </foreach>
  207. </update>
  208. <update id="handleShelfOrUnAdmin" parameterType="com.fs.live.vo.LiveListVo">
  209. update live set is_show = #{liveVo.isShow},status = 3,finish_time = NOW() where live_id in
  210. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  211. #{liveId}
  212. </foreach>
  213. </update>
  214. <update id="handleDeleteSelectedAdmin" parameterType="com.fs.live.vo.LiveListVo">
  215. update live set is_del = 1
  216. WHERE live_id IN
  217. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  218. #{liveId}
  219. </foreach>
  220. </update>
  221. </mapper>