VideoLessonGroupDetailMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDetailDao">
  5. <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail">
  6. <id column="id_" jdbcType="BIGINT" property="id" />
  7. <result column="video_lesson_group_id_" jdbcType="BIGINT" property="videoLessonGroupId" />
  8. <result column="video_title_" jdbcType="VARCHAR" property="videoTitle" />
  9. <result column="video_content_" jdbcType="VARCHAR" property="videoContent" />
  10. <result column="video_url_" jdbcType="VARCHAR" property="videoUrl" />
  11. <result column="cover_url_" jdbcType="VARCHAR" property="coverUrl" />
  12. <result column="charge_flag_" jdbcType="TINYINT" property="chargeFlag" />
  13. <result column="sort_number_" jdbcType="INTEGER" property="sortNumber" />
  14. <result column="teacher_id_" jdbcType="BIGINT" property="teacherId" />
  15. <result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
  16. <result column="update_by_" jdbcType="BIGINT" property="updateBy" />
  17. <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime" />
  18. </resultMap>
  19. <sql id="baseColumns">
  20. id_ AS id,
  21. video_lesson_group_id_ AS videoLessonGroupId,
  22. video_title_ AS videoTitle,
  23. video_content_ AS videoContent,
  24. video_url_ AS videoUrl,
  25. cover_url_ AS coverUrl,
  26. charge_flag_ AS chargeFlag,
  27. sort_number_ AS sortNumber,
  28. teacher_id_ AS teacherId,
  29. create_time_ AS createTime,
  30. update_by_ AS updateBy,
  31. update_time_ AS updateTime
  32. </sql>
  33. <sql id="groupDetail">
  34. id_ AS id,
  35. video_lesson_group_id_ AS videoLessonGroupId,
  36. video_title_ AS videoTitle,
  37. video_content_ AS videoContent,
  38. video_url_ AS videoUrl,
  39. cover_url_ AS coverUrl,
  40. charge_flag_ AS chargeFlag,
  41. sort_number_ AS sortNumber,
  42. teacher_id_ AS teacherId,
  43. create_time_ AS createTime,
  44. update_by_ AS updateBy,
  45. update_time_ AS updateTime
  46. </sql>
  47. <sql id="userDetail">
  48. username_ AS username,
  49. avatar_ AS avatar,
  50. gender_ AS gender,
  51. create_time_ AS createTime
  52. </sql>
  53. <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail">
  54. SELECT
  55. <include refid="baseColumns"/>
  56. FROM video_lesson_group_detail
  57. <where>
  58. <if test="param.videoLessonGroupId !=null">
  59. AND video_lesson_group_id_ = #{param.videoLessonGroupId}
  60. </if>
  61. </where>
  62. </select>
  63. <select id="selectPageStudent" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonPurchaseStudent">
  64. SELECT
  65. u.id_ AS userId,
  66. u.real_name_ AS realName,
  67. u.username_ AS username,
  68. u.avatar_ AS avatar,
  69. u.gender_ AS gender,
  70. o.pay_time_ AS createTime
  71. FROM video_lesson_purchase_record r
  72. LEFT JOIN sys_user u ON r.student_id_=u.id_
  73. LEFT JOIN user_order o ON r.order_no_=o.order_no_
  74. WHERE r.video_lesson_group_id_ = #{param.videoLessonGroupId}
  75. </select>
  76. <select id="selectPageAuth" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupDetailVo">
  77. SELECT
  78. d.id_ AS id,
  79. d.video_lesson_group_id_ AS videoLessonGroupId,
  80. d.video_title_ AS videoTitle,
  81. d.video_content_ AS videoContent,
  82. d.video_url_ AS videoUrl,
  83. d.cover_url_ AS coverUrl,
  84. d.charge_flag_ AS chargeFlag,
  85. d.sort_number_ AS sortNumber,
  86. d.teacher_id_ AS teacherId,
  87. u.username_ AS teacherName,
  88. u.real_name_ AS realName,
  89. u.phone_ AS teacherPhone,
  90. d.create_time_ AS createTime,
  91. d.update_by_ AS updateBy,
  92. d.update_time_ AS updateTime
  93. FROM video_lesson_group_detail d
  94. LEFT JOIN sys_user u ON d.teacher_id_=u.id_
  95. <where>
  96. <if test="param.videoLessonGroupId !=null">
  97. AND video_lesson_group_id_ = #{param.videoLessonGroupId}
  98. </if>
  99. </where>
  100. </select>
  101. <insert id="insertVideoLesson" parameterType="java.util.List">
  102. INSERT INTO video_lesson_group_detail (video_lesson_group_id_,video_title_,video_content_,video_url_,cover_url_,teacher_id_)
  103. VALUES
  104. <foreach collection="list" item="item" index="index" separator=",">
  105. (#{item.videoLessonGroupId}, #{item.videoTitle}, #{item.videoContent},
  106. #{item.videoUrl}, #{item.coverUrl}, #{item.teacherId})
  107. </foreach>
  108. </insert>
  109. <update id="updateDetail" parameterType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupDetailUpVo">
  110. UPDATE video_lesson_group_detail
  111. <set>
  112. <if test="videoLessonGroupId !=null">video_lesson_group_id_ = #{videoLessonGroupId},</if>
  113. <if test="videoTitle !=null and videoTitle !=''">video_title_ = #{videoTitle},</if>
  114. <if test="videoContent !=null and videoContent !=''">video_content_ = #{videoContent},</if>
  115. <if test="videoUrl !=null and videoUrl !=''">video_url_ = #{videoUrl},</if>
  116. <if test="coverUrl !=null and coverUrl !=''">cover_url_ = #{coverUrl},</if>
  117. <if test="updateBy !=null">update_by_ = #{updateBy},</if>
  118. update_time_ = SYSDATE()
  119. </set>
  120. WHERE id_ = #{id}
  121. </update>
  122. <delete id="deleteByGroupId" parameterType="java.lang.Long">
  123. DELETE
  124. FROM video_lesson_group_detail
  125. WHERE video_lesson_group_id_ = #{groupId}
  126. </delete>
  127. </mapper>