LiveVideoMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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.LiveVideoMapper">
  6. <resultMap type="LiveVideo" id="LiveVideoResult">
  7. <result property="videoId" column="video_id" />
  8. <result property="liveId" column="live_id" />
  9. <result property="videoUrl" column="video_url" />
  10. <result property="videoType" column="video_type" />
  11. <result property="sort" column="sort" />
  12. <result property="createTime" column="create_time" />
  13. <result property="createBy" column="create_by" />
  14. <result property="updateBy" column="update_by" />
  15. <result property="updateTime" column="update_time" />
  16. <result property="duration" column="duration" />
  17. <result property="remark" column="remark" />
  18. <result property="fileSize" column="file_size" />
  19. <result property="finishStatus" column="finish_status" />
  20. <result property="companyIds" column="company_ids" typeHandler="com.fs.live.domain.handler.CompanyIdsTypeHandler" />
  21. </resultMap>
  22. <sql id="selectLiveVideoVo">
  23. select video_id, live_id, video_url, video_type, sort, create_time, create_by, update_by, update_time, remark,duration,file_size,finish_status,company_ids from live_video
  24. </sql>
  25. <select id="selectLiveVideoList" parameterType="LiveVideo" resultMap="LiveVideoResult">
  26. <include refid="selectLiveVideoVo"/>
  27. <where>
  28. <if test="liveId != null "> and live_id = #{liveId}</if>
  29. <if test="videoUrl != null and videoUrl != ''"> and video_url = #{videoUrl}</if>
  30. <if test="videoType != null "> and video_type = #{videoType}</if>
  31. <if test="sort != null "> and sort = #{sort}</if>
  32. <if test="remark != null "> and remark like CONCAT('%',#{remark},'%')</if>
  33. <if test="finishStatus != null "> and finish_status = #{finishStatus}</if>
  34. <if test="companyId != null">
  35. and (company_ids IS NULL OR company_ids = '' OR company_ids = '[]' OR JSON_CONTAINS(company_ids, CAST(#{companyId} AS JSON), '$'))
  36. </if>
  37. </where>
  38. </select>
  39. <select id="selectLiveVideoByVideoId" parameterType="Long" resultMap="LiveVideoResult">
  40. <include refid="selectLiveVideoVo"/>
  41. where video_id = #{videoId}
  42. </select>
  43. <select id="selectLiveVideoByVideoIdAndCompanyIdAndCompanyUserId" resultMap="LiveVideoResult">
  44. <include refid="selectLiveVideoVo"/>
  45. where video_id = #{videoId} and company_id = #{companyId} and company_user_id = #{companyUserId}
  46. </select>
  47. <insert id="insertLiveVideo" parameterType="LiveVideo" useGeneratedKeys="true" keyProperty="videoId">
  48. insert into live_video
  49. <trim prefix="(" suffix=")" suffixOverrides=",">
  50. <if test="liveId != null">live_id,</if>
  51. <if test="videoUrl != null">video_url,</if>
  52. <if test="videoType != null">video_type,</if>
  53. <if test="sort != null">sort,</if>
  54. <if test="createTime != null">create_time,</if>
  55. <if test="createBy != null">create_by,</if>
  56. <if test="updateBy != null">update_by,</if>
  57. <if test="updateTime != null">update_time,</if>
  58. <if test="remark != null">remark,</if>
  59. <if test="duration != null">duration,</if>
  60. <if test="fileSize != null">file_size,</if>
  61. <if test="finishStatus != null">finish_status,</if>
  62. <if test="companyIds != null">company_ids,</if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides=",">
  65. <if test="liveId != null">#{liveId},</if>
  66. <if test="videoUrl != null">#{videoUrl},</if>
  67. <if test="videoType != null">#{videoType},</if>
  68. <if test="sort != null">#{sort},</if>
  69. <if test="createTime != null">#{createTime},</if>
  70. <if test="createBy != null">#{createBy},</if>
  71. <if test="updateBy != null">#{updateBy},</if>
  72. <if test="updateTime != null">#{updateTime},</if>
  73. <if test="remark != null">#{remark},</if>
  74. <if test="duration != null">#{duration},</if>
  75. <if test="fileSize != null">#{fileSize},</if>
  76. <if test="finishStatus != null">#{finishStatus},</if>
  77. <if test="companyIds != null">#{companyIds, typeHandler=com.fs.live.domain.handler.CompanyIdsTypeHandler},</if>
  78. </trim>
  79. </insert>
  80. <update id="updateLiveVideo" parameterType="LiveVideo">
  81. update live_video
  82. <trim prefix="SET" suffixOverrides=",">
  83. <if test="liveId != null">live_id = #{liveId},</if>
  84. <if test="videoUrl != null">video_url = #{videoUrl},</if>
  85. <if test="videoType != null">video_type = #{videoType},</if>
  86. <if test="duration != null">duration = #{duration},</if>
  87. <if test="sort != null">sort = #{sort},</if>
  88. <if test="createTime != null">create_time = #{createTime},</if>
  89. <if test="createBy != null">create_by = #{createBy},</if>
  90. <if test="updateBy != null">update_by = #{updateBy},</if>
  91. <if test="updateTime != null">update_time = #{updateTime},</if>
  92. <if test="remark != null">remark = #{remark},</if>
  93. <if test="fileSize != null">file_size = #{fileSize},</if>
  94. <if test="finishStatus != null">finish_status = #{finishStatus},</if>
  95. <if test="companyIds != null">company_ids = #{companyIds, typeHandler=com.fs.live.domain.handler.CompanyIdsTypeHandler},</if>
  96. </trim>
  97. where video_id = #{videoId}
  98. </update>
  99. <delete id="deleteLiveVideoByVideoId" parameterType="Long">
  100. delete from live_video where video_id = #{videoId}
  101. </delete>
  102. <delete id="deleteLiveVideoByVideoIds" parameterType="String">
  103. delete from live_video where video_id in
  104. <foreach item="videoId" collection="array" open="(" separator="," close=")">
  105. #{videoId}
  106. </foreach>
  107. </delete>
  108. </mapper>