LiveVideoMapper.xml 4.8 KB

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