BBusiDezhiVideoMapper.xml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.ruoyi.dezhi.mapper.BBusiDezhiVideoMapper">
  6. <resultMap type="BBusiDezhiVideo" id="BBusiDezhiVideoResult">
  7. <result property="id" column="id" />
  8. <result property="packId" column="pack_id" />
  9. <result property="sectionId" column="section_id" />
  10. <result property="chapterId" column="chapter_id" />
  11. <result property="plays" column="plays" />
  12. <result property="played" column="played" />
  13. <result property="clicked" column="clicked" />
  14. <result property="sectionName" column="section_name" />
  15. <result property="sectionIntro" column="section_intro" />
  16. <result property="sectionTime" column="section_time" />
  17. <result property="sectionSort" column="section_sort" />
  18. <result property="sectionTearcher" column="section_tearcher" />
  19. <result property="sectionImaurl" column="section_imaurl" />
  20. <result property="sectionUrl" column="section_url" />
  21. <result property="sectionAliid" column="section_aliId" />
  22. <result property="from" column="from" />
  23. </resultMap>
  24. <sql id="selectBBusiDezhiVideoVo">
  25. select id, pack_id, section_id, chapter_id, plays, played, clicked, section_name, section_intro, section_time, section_sort, section_tearcher,
  26. section_imaurl, section_url,
  27. section_aliId, `from` from b_busi_dezhi_video
  28. </sql>
  29. <select id="selectBBusiDezhiVideoList" parameterType="BBusiDezhiVideo" resultMap="BBusiDezhiVideoResult">
  30. <include refid="selectBBusiDezhiVideoVo" />
  31. where 1=1
  32. <if test="packId != null and packId != ''"> and pack_id = #{packId}</if>
  33. <if test="sectionId != null and sectionId != ''"> and section_id = #{sectionId}</if>
  34. <if test="chapterId != null and chapterId != ''"> and chapter_id = #{chapterId}</if>
  35. <if test="plays != null "> and plays = #{plays}</if>
  36. <if test="played != null "> and played = #{played}</if>
  37. <if test="clicked != null "> and clicked = #{clicked}</if>
  38. <if test="sectionName != null and sectionName != ''"> and section_name like concat('%', #{sectionName}, '%')</if>
  39. <if test="sectionIntro != null and sectionIntro != ''"> and section_intro = #{sectionIntro}</if>
  40. <if test="sectionTime != null and sectionTime != ''"> and section_time = #{sectionTime}</if>
  41. <if test="sectionSort != null and sectionSort != ''"> and section_sort = #{sectionSort}</if>
  42. <if test="sectionTearcher != null and sectionTearcher != ''"> and section_tearcher = #{sectionTearcher}</if>
  43. <if test="sectionImaurl != null and sectionImaurl != ''"> and section_imaurl = #{sectionImaurl}</if>
  44. <if test="sectionUrl != null and sectionUrl != ''"> and section_url = #{sectionUrl}</if>
  45. <if test="sectionAliid != null and sectionAliid != ''"> and section_aliId = #{sectionAliid}</if>
  46. <if test="from != null and from != ''"> and `from` = #{from}</if>
  47. <if test="course != null">
  48. and pack_id in (
  49. SELECT DISTINCT pack_id FROM b_busi_dezhi_video_package WHERE course = #{course}
  50. )
  51. </if>
  52. </select>
  53. <select id="selectBBusiDezhiVideoById" parameterType="Long" resultMap="BBusiDezhiVideoResult">
  54. <include refid="selectBBusiDezhiVideoVo" />
  55. where id = #{id}
  56. </select>
  57. <select id="selectVideoList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
  58. select a.*,b.grade, b.pack_imgurl as img from b_busi_dezhi_video a
  59. left join b_busi_dezhi_video_package b on a.pack_id=b.pack_id
  60. LEFT JOIN b_busi_dezhi_video_package_chapter t2 ON a.chapter_id = t2.chapter_id
  61. <where>
  62. <if test="packId != null and packId != ''"> and a.pack_id = #{packId}</if>
  63. <if test="course != null and course != ''"> and b.course = #{course}</if>
  64. <if test="grade != null and grade != ''"> and b.grade = #{grade}</if>
  65. <if test="gradeLimit != null"> and b.grade &lt;= #{gradeLimit}</if>
  66. <if test="version != null and version != ''"> and b.version = #{version}</if>
  67. <if test="sectionName != null and sectionName != ''"> and a.section_name like concat('%', #{sectionName}, '%')</if>
  68. </where>
  69. ORDER BY t2.id, CAST(a.section_sort AS UNSIGNED)
  70. </select>
  71. <select id="selectVideoList2" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
  72. select a.*,b.pack_imgurl as img
  73. from b_busi_dezhi_video a
  74. join b_busi_dezhi_video_package b on a.pack_id=b.pack_id
  75. WHERE a.section_aliId IS NOT NULL and b.pack_imgurl IS NOT NULL and not (b.pack_imgurl) AND b.pack_imgurl != ''
  76. <if test="course != null and course != ''"> and b.course = #{course}</if>
  77. ORDER BY RAND()
  78. LIMIT 10
  79. </select>
  80. <select id="searchInfoByPackId" parameterType="String" resultType="com.alibaba.fastjson.JSONObject">
  81. select t2.chapter_name,t1.* from b_busi_dezhi_video t1
  82. inner join
  83. b_busi_dezhi_video_package_chapter t2 on t1.chapter_id = t2.chapter_id
  84. where t1.pack_id = #{packId}
  85. ORDER BY t2.id, CAST(t1.section_sort AS UNSIGNED)
  86. </select>
  87. <insert id="insertBBusiDezhiVideo" parameterType="BBusiDezhiVideo" useGeneratedKeys="true" keyProperty="id">
  88. insert into b_busi_dezhi_video
  89. <trim prefix="(" suffix=")" suffixOverrides=",">
  90. <if test="packId != null">pack_id,</if>
  91. <if test="sectionId != null and sectionId != ''">section_id,</if>
  92. <if test="chapterId != null">chapter_id,</if>
  93. <if test="plays != null">plays,</if>
  94. <if test="played != null">played,</if>
  95. <if test="clicked != null">clicked,</if>
  96. <if test="sectionName != null">section_name,</if>
  97. <if test="sectionIntro != null">section_intro,</if>
  98. <if test="sectionTime != null">section_time,</if>
  99. <if test="sectionSort != null">section_sort,</if>
  100. <if test="sectionTearcher != null">section_tearcher,</if>
  101. <if test="sectionImaurl != null">section_imaurl,</if>
  102. <if test="sectionUrl != null">section_url,</if>
  103. <if test="sectionAliid != null">section_aliId,</if>
  104. <if test="from != null">`from`,</if>
  105. </trim>
  106. <trim prefix="values (" suffix=")" suffixOverrides=",">
  107. <if test="packId != null">#{packId},</if>
  108. <if test="sectionId != null and sectionId != ''">#{sectionId},</if>
  109. <if test="chapterId != null">#{chapterId},</if>
  110. <if test="plays != null">#{plays},</if>
  111. <if test="played != null">#{played},</if>
  112. <if test="clicked != null">#{clicked},</if>
  113. <if test="sectionName != null">#{sectionName},</if>
  114. <if test="sectionIntro != null">#{sectionIntro},</if>
  115. <if test="sectionTime != null">#{sectionTime},</if>
  116. <if test="sectionSort != null">#{sectionSort},</if>
  117. <if test="sectionTearcher != null">#{sectionTearcher},</if>
  118. <if test="sectionImaurl != null">#{sectionImaurl},</if>
  119. <if test="sectionUrl != null">#{sectionUrl},</if>
  120. <if test="sectionAliid != null">#{sectionAliid},</if>
  121. <if test="from != null">#{from},</if>
  122. </trim>
  123. </insert>
  124. <update id="updateBBusiDezhiVideo" parameterType="BBusiDezhiVideo">
  125. update b_busi_dezhi_video
  126. <trim prefix="SET" suffixOverrides=",">
  127. <if test="packId != null">pack_id = #{packId},</if>
  128. <if test="sectionId != null and sectionId != ''">section_id = #{sectionId},</if>
  129. <if test="chapterId != null">chapter_id = #{chapterId},</if>
  130. <if test="plays != null">plays = #{plays},</if>
  131. <if test="played != null">played = #{played},</if>
  132. <if test="clicked != null">clicked = #{clicked},</if>
  133. <if test="sectionName != null">section_name = #{sectionName},</if>
  134. <if test="sectionIntro != null">section_intro = #{sectionIntro},</if>
  135. <if test="sectionTime != null">section_time = #{sectionTime},</if>
  136. <if test="sectionSort != null">section_sort = #{sectionSort},</if>
  137. <if test="sectionTearcher != null">section_tearcher = #{sectionTearcher},</if>
  138. <if test="sectionImaurl != null">section_imaurl = #{sectionImaurl},</if>
  139. <if test="sectionUrl != null">section_url = #{sectionUrl},</if>
  140. <if test="sectionAliid != null">section_aliId = #{sectionAliid},</if>
  141. <if test="from != null">`from` = #{from},</if>
  142. </trim>
  143. where id = #{id}
  144. </update>
  145. <delete id="deleteBBusiDezhiVideoById" parameterType="Long">
  146. delete from b_busi_dezhi_video where id = #{id}
  147. </delete>
  148. <delete id="deleteBBusiDezhiVideoByIds" parameterType="String">
  149. delete from b_busi_dezhi_video where id in
  150. <foreach item="id" collection="array" open="(" separator="," close=")">
  151. #{id}
  152. </foreach>
  153. </delete>
  154. </mapper>