VideoMapper.xml 3.7 KB

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