LiveVideoMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. </resultMap>
  21. <sql id="selectLiveVideoVo">
  22. select video_id, live_id, video_url, video_type, sort, create_time, create_by, update_by, update_time, remark,duration,file_size,finish_status from live_video
  23. </sql>
  24. <select id="selectLiveVideoList" parameterType="LiveVideo" resultMap="LiveVideoResult">
  25. <include refid="selectLiveVideoVo"/>
  26. <where>
  27. <if test="liveId != null "> and live_id = #{liveId}</if>
  28. <if test="videoUrl != null and videoUrl != ''"> and video_url = #{videoUrl}</if>
  29. <if test="videoType != null "> and video_type = #{videoType}</if>
  30. <if test="sort != null "> and sort = #{sort}</if>
  31. <if test="remark != null "> and remark like CONCAT('%',#{remark},'%')</if>
  32. <if test="finishStatus != null "> and finish_status = #{finishStatus}</if>
  33. </where>
  34. </select>
  35. <select id="selectLiveVideoByVideoId" parameterType="Long" resultMap="LiveVideoResult">
  36. <include refid="selectLiveVideoVo"/>
  37. where video_id = #{videoId}
  38. </select>
  39. <select id="selectLiveVideoByVideoIdAndCompanyIdAndCompanyUserId" resultMap="LiveVideoResult">
  40. <include refid="selectLiveVideoVo"/>
  41. where video_id = #{videoId} and company_id = #{companyId} and company_user_id = #{companyUserId}
  42. </select>
  43. <insert id="insertLiveVideo" parameterType="LiveVideo" useGeneratedKeys="true" keyProperty="videoId">
  44. insert into live_video
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="liveId != null">live_id,</if>
  47. <if test="videoUrl != null">video_url,</if>
  48. <if test="videoType != null">video_type,</if>
  49. <if test="sort != null">sort,</if>
  50. <if test="createTime != null">create_time,</if>
  51. <if test="createBy != null">create_by,</if>
  52. <if test="updateBy != null">update_by,</if>
  53. <if test="updateTime != null">update_time,</if>
  54. <if test="remark != null">remark,</if>
  55. <if test="duration != null">duration,</if>
  56. <if test="fileSize != null">file_size,</if>
  57. <if test="finishStatus != null">finish_status,</if>
  58. </trim>
  59. <trim prefix="values (" suffix=")" suffixOverrides=",">
  60. <if test="liveId != null">#{liveId},</if>
  61. <if test="videoUrl != null">#{videoUrl},</if>
  62. <if test="videoType != null">#{videoType},</if>
  63. <if test="sort != null">#{sort},</if>
  64. <if test="createTime != null">#{createTime},</if>
  65. <if test="createBy != null">#{createBy},</if>
  66. <if test="updateBy != null">#{updateBy},</if>
  67. <if test="updateTime != null">#{updateTime},</if>
  68. <if test="remark != null">#{remark},</if>
  69. <if test="duration != null">#{duration},</if>
  70. <if test="fileSize != null">#{fileSize},</if>
  71. <if test="finishStatus != null">#{finishStatus},</if>
  72. </trim>
  73. </insert>
  74. <update id="updateLiveVideo" parameterType="LiveVideo">
  75. update live_video
  76. <trim prefix="SET" suffixOverrides=",">
  77. <if test="liveId != null">live_id = #{liveId},</if>
  78. <if test="videoUrl != null">video_url = #{videoUrl},</if>
  79. <if test="videoType != null">video_type = #{videoType},</if>
  80. <if test="duration != null">duration = #{duration},</if>
  81. <if test="sort != null">sort = #{sort},</if>
  82. <if test="createTime != null">create_time = #{createTime},</if>
  83. <if test="createBy != null">create_by = #{createBy},</if>
  84. <if test="updateBy != null">update_by = #{updateBy},</if>
  85. <if test="updateTime != null">update_time = #{updateTime},</if>
  86. <if test="remark != null">remark = #{remark},</if>
  87. <if test="fileSize != null">file_size = #{fileSize},</if>
  88. <if test="finishStatus != null">finish_status = #{finishStatus},</if>
  89. </trim>
  90. where video_id = #{videoId}
  91. </update>
  92. <delete id="deleteLiveVideoByVideoId" parameterType="Long">
  93. delete from live_video where video_id = #{videoId}
  94. </delete>
  95. <delete id="deleteLiveVideoByVideoIds" parameterType="String">
  96. delete from live_video where video_id in
  97. <foreach item="videoId" collection="array" open="(" separator="," close=")">
  98. #{videoId}
  99. </foreach>
  100. </delete>
  101. </mapper>