VideoLessonGroupDetailMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. <include refid="userDetail"/>
  66. FROM sys_user
  67. WHERE id_ IN
  68. (SELECT student_id_
  69. FROM video_lesson_purchase_record
  70. WHERE video_lesson_group_id_ = #{param.videoLessonGroupId})
  71. </select>
  72. <insert id="insertVideoLesson" parameterType="java.util.List">
  73. INSERT INTO video_lesson_group_detail (video_lesson_group_id_,video_title_,video_content_,video_url_,cover_url_,teacher_id_)
  74. VALUES
  75. <foreach collection="list" item="item" index="index" separator=",">
  76. (#{item.videoLessonGroupId}, #{item.videoTitle}, #{item.videoContent},
  77. #{item.videoUrl}, #{item.coverUrl}, #{item.teacherId})
  78. </foreach>
  79. </insert>
  80. <update id="updateDetail" parameterType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupDetailUpVo">
  81. UPDATE video_lesson_group_detail
  82. <set>
  83. <if test="videoLessonGroupId !=null">video_lesson_group_id_ = #{videoLessonGroupId},</if>
  84. <if test="videoTitle !=null and videoTitle !=''">video_title_ = #{videoTitle},</if>
  85. <if test="videoContent !=null and videoContent !=''">video_content_ = #{videoContent},</if>
  86. <if test="videoUrl !=null and videoUrl !=''">video_url_ = #{videoUrl},</if>
  87. <if test="coverUrl !=null and coverUrl !=''">cover_url_ = #{coverUrl},</if>
  88. <if test="updateBy !=null">update_by_ = #{updateBy},</if>
  89. update_time_ = SYSDATE()
  90. </set>
  91. WHERE id_ = #{id}
  92. </update>
  93. <delete id="deleteByGroupId" parameterType="java.lang.Long">
  94. DELETE
  95. FROM video_lesson_group_detail
  96. WHERE video_lesson_group_id_ = #{groupId}
  97. </delete>
  98. </mapper>