LiveMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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="trainingPeriodId" column="training_period_id" />
  11. <result property="talentId" column="talent_id" />
  12. <result property="liveName" column="live_name" />
  13. <result property="liveDesc" column="live_desc" />
  14. <result property="showType" column="show_type" />
  15. <result property="status" column="status" />
  16. <result property="anchorId" column="anchor_id" />
  17. <result property="liveType" column="live_type" />
  18. <result property="startTime" column="start_time" />
  19. <result property="finishTime" column="finish_time" />
  20. <result property="liveImgUrl" column="live_img_url" />
  21. <result property="liveConfig" column="live_config" />
  22. <result property="isShow" column="is_show" />
  23. <result property="isDel" column="is_del" />
  24. <result property="qwQrCode" column="qw_qr_code" />
  25. <result property="rtmpUrl" column="rtmp_url" />
  26. <result property="createTime" column="create_time" />
  27. <result property="createBy" column="create_by" />
  28. <result property="updateBy" column="update_by" />
  29. <result property="updateTime" column="update_time" />
  30. <result property="remark" column="remark" />
  31. <result property="configJson" column="config_json" />
  32. <result property="isAudit" column="is_audit" />
  33. <result property="idCardUrl" column="id_card_url" />
  34. <result property="liveCodeUrl" column="live_code_url" />
  35. <result property="globalVisible" column="global_visible" />
  36. </resultMap>
  37. <sql id="selectLiveVo">
  38. select live_id, company_id, company_user_id, training_period_id, talent_id, live_name, is_audit, live_desc, show_type, status, anchor_id, live_type, start_time, finish_time,
  39. live_img_url, live_config, id_card_url, is_show, is_del, qw_qr_code, rtmp_url, flv_hls_url,
  40. create_time, create_by, update_by, update_time, remark,config_json,global_visible from live
  41. </sql>
  42. <select id="liveList" parameterType="Live" resultMap="LiveResult">
  43. 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,
  44. 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,
  45. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size,a.global_visible
  46. from live
  47. a
  48. left join live_video b on a.live_id = b.live_id
  49. left join company c on a.company_id = c.company_id
  50. where 1=1 and a.is_del = 0 and a.is_audit = 1 and a.is_show = 1 and a.status in (2,4) and b.video_type in (1,2)
  51. order by create_time desc
  52. </select>
  53. <select id="selectReadyStartLiveList" parameterType="Live" resultMap="LiveResult">
  54. 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,
  55. 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,
  56. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size,a.global_visible
  57. from live
  58. a
  59. left join live_video b on a.live_id = b.live_id
  60. left join company c on a.company_id = c.company_id
  61. where 1=1 and a.is_del = 0 and a.is_audit = 1 and a.is_show = 1 and a.status in (1) and b.video_type in (1,2)
  62. and a.start_time &lt;= NOW() + INTERVAL 5 MINUTE
  63. and a.start_time >= NOW()
  64. order by create_time desc
  65. </select>
  66. <select id="selectLiveList" parameterType="com.fs.live.domain.Live" resultMap="LiveResult">
  67. select a.live_id, a.company_id, a.company_user_id, a.training_period_id, a.talent_id, a.live_name, a.is_audit, a.live_desc, a.show_type, a.status, a.anchor_id,
  68. 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,
  69. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,a.global_visible
  70. ,c.live_code_url,IFNULL(d.company_name, '总台') AS company_name,b.file_size
  71. from live a
  72. left join live_video b on a.live_id = b.live_id
  73. left join live_company_code c on a.live_id = c.live_id
  74. and c.company_id = #{companyId}
  75. and c.company_user_id = #{companyUserId}
  76. left join company d on a.company_id = d.company_id
  77. where 1=1 and a.is_del = 0 and b.video_type in (1,2)
  78. <if test="excludeCampLive != null and excludeCampLive == true"> and a.training_period_id is null </if>
  79. <if test="onlyTrainingCampLive != null and onlyTrainingCampLive == true"> and a.training_period_id is not null </if>
  80. <if test="trainingPeriodId != null"> and a.training_period_id = #{trainingPeriodId}</if>
  81. <if test="companyId != null "> and (a.company_id = #{companyId} or a.company_id is null )</if>
  82. <if test="companyName != null and companyName != ''">
  83. and (
  84. (d.company_name like concat('%', #{companyName}, '%'))
  85. or
  86. (#{companyName} = '总台' and a.company_id is null)
  87. )
  88. </if>
  89. <if test="talentId != null "> and talent_id = #{talentId}</if>
  90. <if test="liveName != null and liveName != ''"> and live_name like concat('%', #{liveName}, '%')</if>
  91. <if test="liveDesc != null and liveDesc != ''"> and live_desc = #{liveDesc}</if>
  92. <if test="showType != null "> and show_type = #{showType}</if>
  93. <if test="status != null "> and a.status = #{status}</if>
  94. <if test="anchorId != null "> and anchor_id = #{anchorId}</if>
  95. <if test="liveType != null "> and live_type = #{liveType}</if>
  96. <if test="startTimeS != null "> and a.start_time &gt; STR_TO_DATE(#{startTimeS}, '%Y-%m-%d %H:%i:%s')</if>
  97. <if test="endTimeE != null "> and a.finish_time &lt; STR_TO_DATE(#{endTimeE}, '%Y-%m-%d %H:%i:%s')</if>
  98. <if test="finishTime != null "> and finish_time = #{finishTime}</if>
  99. <if test="liveImgUrl != null and liveImgUrl != ''"> and live_img_url = #{liveImgUrl}</if>
  100. <if test="liveConfig != null and liveConfig != ''"> and live_config = #{liveConfig}</if>
  101. <if test="isShow != null "> and a.is_show = #{isShow}</if>
  102. <if test="qwQrCode != null and qwQrCode != ''"> and qw_qr_code = #{qwQrCode}</if>
  103. <if test="rtmpUrl != null and rtmpUrl != ''"> and rtmp_url = #{rtmpUrl}</if>
  104. <if test="flvHlsUrl != null and flvHlsUrl != ''"> and flv_hls_url = #{flvHlsUrl}</if>
  105. <if test="isAudit != null "> and is_audit = #{isAudit}</if>
  106. <if test="beginTime != null and beginTime != ''"> and a.create_time &gt;= STR_TO_DATE(#{beginTime}, '%Y-%m-%d %H:%i:%s')</if>
  107. <if test="endTime != null and endTime != ''"> and a.create_time &lt;= STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s')</if>
  108. order by create_time desc
  109. </select>
  110. <select id="selectTrainingLiveAuditList" parameterType="com.fs.live.domain.Live" resultType="com.fs.live.vo.TrainingLiveAuditVO">
  111. select a.live_id as liveId, a.live_name as liveName, a.company_id as companyId,
  112. IFNULL(d.company_name,'总台') as companyName,
  113. a.training_period_id as trainingPeriodId,
  114. p.period_name as periodName, c.camp_name as campName,
  115. a.is_audit as isAudit, a.status, a.live_type as liveType,
  116. a.start_time as startTime, a.create_time as createTime
  117. from live a
  118. left join live_training_period p on a.training_period_id = p.period_id and p.is_del = 0
  119. left join live_training_camp c on p.camp_id = c.camp_id and c.is_del = 0
  120. left join company d on a.company_id = d.company_id
  121. where a.is_del = 0 and a.training_period_id is not null
  122. <if test="companyId != null">and a.company_id = #{companyId}</if>
  123. <if test="isAudit != null">and a.is_audit = #{isAudit}</if>
  124. <if test="liveName != null and liveName != ''">and a.live_name like concat('%', #{liveName}, '%')</if>
  125. order by a.create_time desc
  126. </select>
  127. <select id="selectLiveByLiveId" parameterType="Long" resultMap="LiveResult">
  128. <include refid="selectLiveVo"/>
  129. where live_id = #{liveId} and is_del = 0
  130. </select>
  131. <select id="selectLiveByLiveIdAndCompanyId" resultMap="LiveResult">
  132. <include refid="selectLiveVo"/>
  133. where live_id = #{liveId} and is_del = 0
  134. and (company_id = #{companyId} or company_id is null)
  135. </select>
  136. <select id="selectLiveByLiveIdAndCompanyIdAndCompanyUserId" resultMap="LiveResult">
  137. <include refid="selectLiveVo"/>
  138. where live_id = #{liveId} and company_id = #{companyId} and company_user_id = #{companyUserId}
  139. </select>
  140. <select id="selectLiveToStudent" resultType="com.fs.live.domain.Live">
  141. <include refid="selectLiveVo"/>
  142. where 1=1
  143. <if test="status != null and status != ''">
  144. AND status = #{status}
  145. </if>
  146. <if test="liveName != null and liveName != null">
  147. AND live_name like concat('%', #{liveName}, '%')
  148. </if>
  149. <if test="startTime != null and startTime != '' and finishTime != null and finishTime != ''">
  150. AND start_time BETWEEN #{startTime} AND #{finishTime}
  151. </if>
  152. </select>
  153. <insert id="insertLive" parameterType="Live" useGeneratedKeys="true" keyProperty="liveId">
  154. insert into live
  155. <trim prefix="(" suffix=")" suffixOverrides=",">
  156. <if test="companyId != null">company_id,</if>
  157. <if test="companyUserId != null">company_user_id,</if>
  158. <if test="trainingPeriodId != null">training_period_id,</if>
  159. <if test="talentId != null">talent_id,</if>
  160. <if test="liveName != null">live_name,</if>
  161. <if test="liveDesc != null">live_desc,</if>
  162. <if test="showType != null">show_type,</if>
  163. <if test="status != null">status,</if>
  164. <if test="anchorId != null">anchor_id,</if>
  165. <if test="liveType != null">live_type,</if>
  166. <if test="startTime != null">start_time,</if>
  167. <if test="finishTime != null">finish_time,</if>
  168. <if test="liveImgUrl != null">live_img_url,</if>
  169. <if test="liveConfig != null">live_config,</if>
  170. <if test="isShow != null">is_show,</if>
  171. <if test="isDel != null">is_del,</if>
  172. <if test="qwQrCode != null">qw_qr_code,</if>
  173. <if test="rtmpUrl != null">rtmp_url,</if>
  174. <if test="createTime != null">create_time,</if>
  175. <if test="createBy != null">create_by,</if>
  176. <if test="updateBy != null">update_by,</if>
  177. <if test="updateTime != null">update_time,</if>
  178. <if test="remark != null">remark,</if>
  179. <if test="configJson != null">config_json,</if>
  180. <if test="flvHlsUrl != null">flv_hls_url,</if>
  181. <if test="isAudit != null">is_audit,</if>
  182. <if test="idCardUrl != null">id_card_url,</if>
  183. <if test="globalVisible != null">global_visible,</if>
  184. </trim>
  185. <trim prefix="values (" suffix=")" suffixOverrides=",">
  186. <if test="companyId != null">#{companyId},</if>
  187. <if test="companyUserId != null">#{companyUserId},</if>
  188. <if test="trainingPeriodId != null">#{trainingPeriodId},</if>
  189. <if test="talentId != null">#{talentId},</if>
  190. <if test="liveName != null">#{liveName},</if>
  191. <if test="liveDesc != null">#{liveDesc},</if>
  192. <if test="showType != null">#{showType},</if>
  193. <if test="status != null">#{status},</if>
  194. <if test="anchorId != null">#{anchorId},</if>
  195. <if test="liveType != null">#{liveType},</if>
  196. <if test="startTime != null">#{startTime},</if>
  197. <if test="finishTime != null">#{finishTime},</if>
  198. <if test="liveImgUrl != null">#{liveImgUrl},</if>
  199. <if test="liveConfig != null">#{liveConfig},</if>
  200. <if test="isShow != null">#{isShow},</if>
  201. <if test="isDel != null">#{isDel},</if>
  202. <if test="qwQrCode != null">#{qwQrCode},</if>
  203. <if test="rtmpUrl != null">#{rtmpUrl},</if>
  204. <if test="createTime != null">#{createTime},</if>
  205. <if test="createBy != null">#{createBy},</if>
  206. <if test="updateBy != null">#{updateBy},</if>
  207. <if test="updateTime != null">#{updateTime},</if>
  208. <if test="remark != null">#{remark},</if>
  209. <if test="configJson != null">#{configJson},</if>
  210. <if test="flvHlsUrl != null">#{flvHlsUrl},</if>
  211. <if test="isAudit != null">#{isAudit},</if>
  212. <if test="idCardUrl != null">#{idCardUrl},</if>
  213. <if test="globalVisible != null">#{globalVisible},</if>
  214. </trim>
  215. </insert>
  216. <update id="updateLive" parameterType="Live">
  217. update live
  218. <trim prefix="SET" suffixOverrides=",">
  219. <if test="talentId != null">talent_id = #{talentId},</if>
  220. <if test="trainingPeriodId != null">training_period_id = #{trainingPeriodId},</if>
  221. <if test="liveName != null">live_name = #{liveName},</if>
  222. <if test="liveDesc != null">live_desc = #{liveDesc},</if>
  223. <if test="showType != null">show_type = #{showType},</if>
  224. <if test="status != null">status = #{status},</if>
  225. <if test="anchorId != null">anchor_id = #{anchorId},</if>
  226. <if test="liveType != null">live_type = #{liveType},</if>
  227. <if test="startTime != null">start_time = #{startTime},</if>
  228. <if test="finishTime != null">finish_time = #{finishTime},</if>
  229. <if test="finishTime == null">finish_time = NULL,</if>
  230. <if test="liveImgUrl != null">live_img_url = #{liveImgUrl},</if>
  231. <if test="liveConfig != null">live_config = #{liveConfig},</if>
  232. <if test="isShow != null">is_show = #{isShow},</if>
  233. <if test="isDel != null">is_del = #{isDel},</if>
  234. <if test="qwQrCode != null">qw_qr_code = #{qwQrCode},</if>
  235. <if test="rtmpUrl != null">rtmp_url = #{rtmpUrl},</if>
  236. <if test="createTime != null">create_time = #{createTime},</if>
  237. <if test="createBy != null">create_by = #{createBy},</if>
  238. <if test="updateBy != null">update_by = #{updateBy},</if>
  239. <if test="updateTime != null">update_time = #{updateTime},</if>
  240. <if test="remark != null">remark = #{remark},</if>
  241. <if test="configJson != null">config_json = #{configJson},</if>
  242. <if test="flvHlsUrl != null">flv_hls_url = #{flvHlsUrl},</if>
  243. <if test="isAudit != null">is_audit = #{isAudit},</if>
  244. <if test="idCardUrl != null">id_card_url = #{idCardUrl},</if>
  245. <if test="globalVisible != null">global_visible = #{globalVisible},</if>
  246. </trim>
  247. where live_id = #{liveId}
  248. </update>
  249. <delete id="deleteLiveByLiveId" parameterType="Long">
  250. delete from live where live_id = #{liveId}
  251. </delete>
  252. <delete id="deleteLiveByLiveIds" parameterType="String">
  253. delete from live where live_id in
  254. <foreach item="liveId" collection="array" open="(" separator="," close=")">
  255. #{liveId}
  256. </foreach>
  257. <if test="live != null">
  258. <if test="live.companyId != null"> and company_id = #{live.companyId}</if>
  259. </if>
  260. </delete>
  261. <update id="updateBatchLiveList" parameterType="com.fs.live.vo.LiveListVo">
  262. update live set is_show = #{liveVo.isShow},status = 3,finish_time = NOW() where live_id in
  263. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  264. #{liveId}
  265. </foreach>
  266. <if test="liveVo.companyId != null">
  267. <if test="liveVo.companyId != null"> and company_id = #{liveVo.companyId}</if>
  268. </if>
  269. </update>
  270. <update id="deleteBatchLiveList" parameterType="com.fs.live.vo.LiveListVo">
  271. update live set is_del = 1
  272. WHERE company_id = #{liveVo.companyId} and company_user_id = #{liveVo.companyUserId} and live_id IN
  273. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  274. #{liveId}
  275. </foreach>
  276. <if test="liveVo.companyId != null">
  277. <if test="liveVo.companyId != null"> and company_id = #{liveVo.companyId}</if>
  278. </if>
  279. </update>
  280. <update id="handleShelfOrUnAdmin" parameterType="com.fs.live.vo.LiveListVo">
  281. update live set is_show = #{liveVo.isShow},status = 3,finish_time = NOW() where live_id in
  282. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  283. #{liveId}
  284. </foreach>
  285. <if test="liveVo.companyId != null">
  286. <if test="liveVo.companyId != null"> and company_id = #{liveVo.companyId}</if>
  287. </if>
  288. </update>
  289. <update id="handleDeleteSelectedAdmin" parameterType="com.fs.live.vo.LiveListVo">
  290. update live set is_del = 1
  291. WHERE live_id IN
  292. <foreach item="liveId" collection="liveVo.liveIds" open="(" separator="," close=")">
  293. #{liveId}
  294. </foreach>
  295. <if test="liveVo.companyId != null">
  296. <if test="liveVo.companyId != null"> and company_id = #{liveVo.companyId}</if>
  297. </if>
  298. </update>
  299. <update id="updateLiveList">
  300. <foreach collection="liveList" item="live" separator=";">
  301. UPDATE live
  302. <set>
  303. <if test="live.liveName != null and live.liveName != ''">live_name = #{live.liveName},</if>
  304. <if test="live.liveType != null">live_type = #{live.liveType},</if>
  305. <if test="live.status != null">status = #{live.status},</if>
  306. <if test="live.startTime != null">start_time = #{live.startTime},</if>
  307. <if test="live.finishTime != null">finish_time = #{live.finishTime},</if>
  308. <if test="live.rtmpUrl != null and live.rtmpUrl != ''">rtmp_url = #{live.rtmpUrl},</if>
  309. <if test="live.flvHlsUrl != null and live.flvHlsUrl != ''">flv_hls_url = #{live.flvHlsUrl},</if>
  310. <if test="live.videoUrl != null and live.videoUrl != ''">video_url = #{live.videoUrl},</if>
  311. <if test="live.duration != null and live.duration != ''">duration = #{live.duration},</if>
  312. <if test="live.companyId != null">company_id = #{live.companyId},</if>
  313. <if test="live.companyUserId != null">company_user_id = #{live.companyUserId},</if>
  314. <if test="live.isAudit != null">is_audit = #{live.isAudit},</if>
  315. <if test="live.isShow != null">is_show = #{live.isShow},</if>
  316. <if test="live.isDel != null">is_del = #{live.isDel},</if>
  317. <if test="live.liveConfig != null and live.liveConfig != ''">live_config = #{live.liveConfig},</if>
  318. <if test="live.remark != null and live.remark != ''">remark = #{live.remark},</if>
  319. <if test="live.globalVisible != null and live.globalVisible != ''">global_visible = #{live.globalVisible},</if>
  320. update_time = NOW()
  321. </set>
  322. WHERE live_id = #{live.liveId}
  323. </foreach>
  324. </update>
  325. <update id="updateStatusAndTimeBatchById">
  326. <foreach collection="liveList" item="live" separator=";">
  327. UPDATE live
  328. <set>
  329. <if test="live.status != null">status = #{live.status},</if>
  330. update_time = NOW()
  331. </set>
  332. WHERE live_id = #{live.liveId}
  333. </foreach>
  334. </update>
  335. <select id="liveShowList" resultMap="LiveResult">
  336. 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,
  337. 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,
  338. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size
  339. from live
  340. a
  341. left join live_video b on a.live_id = b.live_id
  342. left join company c on a.company_id = c.company_id
  343. where 1=1 and a.is_del = 0 and a.is_audit = 1 and a.is_show = 1 and a.status in (2,4) and b.video_type in (1,2)
  344. and (
  345. <if test="companyIds != null and companyIds.size() > 0">
  346. a.company_id in
  347. <foreach collection="companyIds" item="id" open="(" separator="," close=")">
  348. #{id}
  349. </foreach>
  350. or
  351. </if>
  352. a.company_id is null)
  353. order by create_time desc
  354. </select>
  355. <select id="selectLiveShowReadyStartLiveList" resultMap="LiveResult">
  356. 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,
  357. 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,
  358. a.flv_hls_url, a.create_time, a.create_by, a.update_by, a.update_time, a.remark,config_json, b.video_url,c.company_name,b.file_size
  359. from live
  360. a
  361. left join live_video b on a.live_id = b.live_id
  362. left join company c on a.company_id = c.company_id
  363. where 1=1 and a.is_del = 0 and a.is_audit = 1 and a.is_show = 1 and a.status in (1) and b.video_type in (1,2)
  364. and a.start_time &lt;= NOW() + INTERVAL 5 MINUTE
  365. and a.start_time >= NOW()
  366. and (
  367. <if test="companyIds != null and companyIds.size() > 0">
  368. a.company_id in
  369. <foreach collection="companyIds" item="id" open="(" separator="," close=")">
  370. #{id}
  371. </foreach>
  372. or
  373. </if>
  374. a.company_id is null)
  375. order by create_time desc
  376. </select>
  377. <select id="selectLiveListNew" resultType="com.fs.live.domain.Live">
  378. <include refid="selectLiveVo"/>
  379. where is_audit = 1 and is_del = 0 and is_show = 1 and status != 3
  380. and training_period_id is null
  381. and (company_id = #{companyId} or company_id is null)
  382. <if test="liveName != null">
  383. and live_name like concat('%',#{liveName},'%')
  384. </if>
  385. </select>
  386. <select id="selectLiveIdsByCompanyParam" resultType="java.lang.Long">
  387. SELECT l.live_id
  388. FROM live l
  389. LEFT JOIN company c ON l.company_id = c.company_id
  390. LEFT JOIN live_user_first_entry lufe ON l.live_id = lufe.live_id
  391. WHERE l.is_del = 0
  392. AND l.is_audit = 1
  393. AND l.is_show = 1
  394. <if test="companyName != null and companyName != ''">
  395. AND (c.company_name LIKE CONCAT('%', #{companyName}, '%')
  396. OR (#{companyName} = '总台' AND l.company_id IS NULL))
  397. </if>
  398. <if test="startDate != null">
  399. AND DATE(l.start_time) &gt;= DATE(#{startDate})
  400. </if>
  401. <if test="endDate != null">
  402. AND DATE(l.start_time) &lt;= DATE(#{endDate})
  403. </if>
  404. <if test="companyIds != null and companyIds.size() > 0">
  405. AND lufe.company_id IN
  406. <foreach collection="companyIds" item="cid" open="(" separator="," close=")">
  407. #{cid}
  408. </foreach>
  409. </if>
  410. ORDER BY l.live_id
  411. </select>
  412. </mapper>