VideoMapper.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.caimei.mapper.cmMapper.VideoMapper">
  4. <insert id="insertVideo" keyColumn="id" keyProperty="id" parameterType="com.caimei.model.po.VideoPo" useGeneratedKeys="true">
  5. insert into cm_brand_video(authUserId, title, name, previewUrl, downloadUrl, auditStatus, status, createTime,
  6. auditBy, auditTime)
  7. values (#{authUserId}, #{title}, #{name}, #{previewUrl}, #{downloadUrl}, #{auditStatus}, #{status},
  8. #{createTime}, #{auditBy}, #{auditTime})
  9. </insert>
  10. <update id="updateVideoByVideoId">
  11. update cm_brand_video
  12. set title = #{title},
  13. status = #{status},
  14. auditStatus = #{auditStatus}
  15. where id = #{id}
  16. </update>
  17. <update id="updateVideoStatusByVideoId">
  18. update cm_brand_video
  19. set status = #{status}
  20. where id = #{videoId}
  21. </update>
  22. <update id="updateVideoAuditStatus">
  23. update cm_brand_video
  24. set status = #{status},
  25. auditStatus = #{auditStatus},
  26. invalidReason = #{invalidReason},
  27. auditBy = #{auditBy},
  28. auditTime = #{auditTime}
  29. where id = #{videoId}
  30. </update>
  31. <update id="updateVideoSelective">
  32. update cm_brand_video
  33. <set>
  34. <if test="title != null and title != ''">
  35. title = #{title},
  36. </if>
  37. <if test="previewUrl != null and previewUrl != ''">
  38. previewUrl = #{previewUrl},
  39. </if>
  40. <if test="downloadUrl != null and downloadUrl != ''">
  41. downloadUrl = #{downloadUrl},
  42. </if>
  43. <if test="name != null and name != ''">
  44. name = #{name},
  45. </if>
  46. <if test="status != null">
  47. status = #{status},
  48. </if>
  49. <if test="auditStatus != null">
  50. auditStatus = #{auditStatus},
  51. </if>
  52. </set>
  53. where id = #{id}
  54. </update>
  55. <delete id="deleteVideoByVideoId">
  56. delete from cm_brand_video where id = #{videoId}
  57. </delete>
  58. <select id="getVideoList" resultType="com.caimei.model.vo.VideoListVo">
  59. select a.id as videoId,a.title as videoTitle,a.name as videoName, a.previewUrl as videoPreviewUrl, a.downloadUrl
  60. as videoDownloadUrl,a.auditStatus,a.invalidReason,a.status,a.createTime,
  61. au.name as auditBy,a.auditTime
  62. from cm_brand_video a
  63. left join cm_brand_auth_user au on a.auditBy = au.authUserId
  64. where a.authUserId = #{authUserId}
  65. <if test="videoTitle != null and videoTitle != ''">
  66. and a.title like concat('%',#{videoTitle},'%')
  67. </if>
  68. <if test="auditStatus != null">
  69. and a.auditStatus = #{auditStatus}
  70. </if>
  71. <if test="status != null">
  72. and a.status = #{status}
  73. </if>
  74. <choose>
  75. <when test="listType == 2">
  76. order by a.auditStatus desc, a.createTime desc
  77. </when>
  78. <otherwise>
  79. order by a.createTime desc
  80. </otherwise>
  81. </choose>
  82. </select>
  83. <select id="getWxVideoList" resultType="com.caimei.model.vo.WxVideoListVo">
  84. select id as videoId, title as videoTitle,name as videoName, previewUrl as videoPreviewUrl, downloadUrl as
  85. videoDownloadUrl, date_format(createTime, '%Y-%m-%d') as createTime
  86. from cm_brand_video a
  87. where authUserId = #{authUserId}
  88. and status = 1
  89. <if test="videoTitle != null and videoTitle != ''">
  90. and title like concat('%',#{videoTitle},'%')
  91. </if>
  92. order by a.createTime desc
  93. </select>
  94. </mapper>