LiveVideoMapper.xml 4.5 KB

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