VideoMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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, image, name, previewUrl, downloadUrl, auditStatus, status, createTime,
  6. auditBy, auditTime)
  7. values (#{authUserId}, #{title}, #{image}, #{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="image != null and image != ''">
  38. image = #{image},
  39. </if>
  40. <if test="previewUrl != null and previewUrl != ''">
  41. previewUrl = #{previewUrl},
  42. </if>
  43. <if test="downloadUrl != null and downloadUrl != ''">
  44. downloadUrl = #{downloadUrl},
  45. </if>
  46. <if test="name != null and name != ''">
  47. name = #{name},
  48. </if>
  49. <if test="status != null">
  50. status = #{status},
  51. </if>
  52. <if test="auditStatus != null">
  53. auditStatus = #{auditStatus},
  54. </if>
  55. </set>
  56. where id = #{id}
  57. </update>
  58. <update id="checkVideo">
  59. update cm_brand_video set checkFlag = 1 where id = #{videoId}
  60. </update>
  61. <delete id="deleteVideoByVideoId">
  62. delete from cm_brand_video where id = #{videoId}
  63. </delete>
  64. <select id="getVideoList" resultType="com.caimei.model.vo.VideoListVo">
  65. select a.id as videoId,a.title as videoTitle,a.image as videoImage, a.name as videoName, a.previewUrl as videoPreviewUrl, a.downloadUrl
  66. as videoDownloadUrl,a.auditStatus,a.invalidReason,a.status,a.createTime,
  67. au.name as auditBy,a.auditTime
  68. from cm_brand_video a
  69. left join cm_brand_auth_user au on a.auditBy = au.authUserId
  70. where a.authUserId = #{authUserId}
  71. <if test="videoTitle != null and videoTitle != ''">
  72. and a.title like concat('%',#{videoTitle},'%')
  73. </if>
  74. <if test="auditStatus != null">
  75. and a.auditStatus = #{auditStatus}
  76. </if>
  77. <if test="status != null">
  78. and a.status = #{status}
  79. </if>
  80. <choose>
  81. <when test="listType == 2">
  82. order by a.auditStatus desc, a.createTime desc
  83. </when>
  84. <otherwise>
  85. order by a.createTime desc
  86. </otherwise>
  87. </choose>
  88. </select>
  89. <select id="getWxVideoList" resultType="com.caimei.model.vo.WxVideoListVo">
  90. select id as videoId, title as videoTitle,image as videoImage, name as videoName, previewUrl as videoPreviewUrl,
  91. downloadUrl as
  92. videoDownloadUrl, date_format(createTime, '%Y-%m-%d') as createTime
  93. from cm_brand_video a
  94. where authUserId = #{authUserId}
  95. and status = 1
  96. <if test="videoTitle != null and videoTitle != ''">
  97. and title like concat('%',#{videoTitle},'%')
  98. </if>
  99. order by a.createTime desc
  100. </select>
  101. <select id="getVideoForm" resultType="com.caimei.model.po.VideoPo">
  102. select id, auditStatus
  103. from cm_brand_video
  104. where id = #{videoId}
  105. </select>
  106. </mapper>