123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yonge.cooleshow.biz.dal.dao.VideoLessonGroupDetailDao">
- <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail">
- <id column="id_" jdbcType="BIGINT" property="id" />
- <result column="video_lesson_group_id_" jdbcType="BIGINT" property="videoLessonGroupId" />
- <result column="video_title_" jdbcType="VARCHAR" property="videoTitle" />
- <result column="video_content_" jdbcType="VARCHAR" property="videoContent" />
- <result column="video_url_" jdbcType="VARCHAR" property="videoUrl" />
- <result column="cover_url_" jdbcType="VARCHAR" property="coverUrl" />
- <result column="charge_flag_" jdbcType="TINYINT" property="chargeFlag" />
- <result column="sort_number_" jdbcType="INTEGER" property="sortNumber" />
- <result column="teacher_id_" jdbcType="BIGINT" property="teacherId" />
- <result column="create_time_" jdbcType="TIMESTAMP" property="createTime" />
- <result column="update_by_" jdbcType="BIGINT" property="updateBy" />
- <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime" />
- </resultMap>
- <sql id="baseColumns">
- id_ AS id,
- video_lesson_group_id_ AS videoLessonGroupId,
- video_title_ AS videoTitle,
- video_content_ AS videoContent,
- video_url_ AS videoUrl,
- cover_url_ AS coverUrl,
- charge_flag_ AS chargeFlag,
- sort_number_ AS sortNumber,
- teacher_id_ AS teacherId,
- create_time_ AS createTime,
- update_by_ AS updateBy,
- update_time_ AS updateTime
- </sql>
- <sql id="groupDetail">
- id_ AS id,
- video_lesson_group_id_ AS videoLessonGroupId,
- video_title_ AS videoTitle,
- video_content_ AS videoContent,
- video_url_ AS videoUrl,
- cover_url_ AS coverUrl,
- charge_flag_ AS chargeFlag,
- sort_number_ AS sortNumber,
- teacher_id_ AS teacherId,
- create_time_ AS createTime,
- update_by_ AS updateBy,
- update_time_ AS updateTime
- </sql>
- <sql id="userDetail">
- username_ AS username,
- avatar_ AS avatar,
- gender_ AS gender,
- create_time_ AS createTime
- </sql>
- <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.entity.VideoLessonGroupDetail">
- SELECT
- <include refid="baseColumns"/>
- FROM video_lesson_group_detail
- <where>
- <if test="param.videoLessonGroupId !=null">
- AND video_lesson_group_id_ = #{param.videoLessonGroupId}
- </if>
- </where>
- </select>
- <select id="selectPageStudent" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonPurchaseStudent">
- SELECT
- u.id_ AS userId,
- u.real_name_ AS realName,
- u.username_ AS username,
- u.avatar_ AS avatar,
- u.gender_ AS gender,
- o.pay_time_ AS createTime
- FROM video_lesson_purchase_record r
- LEFT JOIN sys_user u ON r.student_id_=u.id_
- LEFT JOIN user_order o ON r.order_no_=o.order_no_
- WHERE r.video_lesson_group_id_ = #{param.videoLessonGroupId}
- </select>
- <select id="selectPageAuth" resultType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupDetailVo">
- SELECT
- d.id_ AS id,
- d.video_lesson_group_id_ AS videoLessonGroupId,
- d.video_title_ AS videoTitle,
- d.video_content_ AS videoContent,
- d.video_url_ AS videoUrl,
- d.cover_url_ AS coverUrl,
- d.charge_flag_ AS chargeFlag,
- d.sort_number_ AS sortNumber,
- d.teacher_id_ AS teacherId,
- u.username_ AS teacherName,
- u.real_name_ AS realName,
- u.phone_ AS teacherPhone,
- d.create_time_ AS createTime,
- d.update_by_ AS updateBy,
- d.update_time_ AS updateTime
- FROM video_lesson_group_detail d
- LEFT JOIN sys_user u ON d.teacher_id_=u.id_
- <where>
- <if test="param.videoLessonGroupId !=null">
- AND video_lesson_group_id_ = #{param.videoLessonGroupId}
- </if>
- </where>
- </select>
- <insert id="insertVideoLesson" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.List">
- INSERT INTO video_lesson_group_detail (video_lesson_group_id_,video_title_,video_content_,video_url_,cover_url_,teacher_id_)
- VALUES
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.videoLessonGroupId}, #{item.videoTitle}, #{item.videoContent},
- #{item.videoUrl}, #{item.coverUrl}, #{item.teacherId})
- </foreach>
- </insert>
- <update id="updateDetail" parameterType="com.yonge.cooleshow.biz.dal.vo.VideoLessonGroupDetailUpVo">
- UPDATE video_lesson_group_detail
- <set>
- <if test="videoLessonGroupId !=null">video_lesson_group_id_ = #{videoLessonGroupId},</if>
- <if test="videoTitle !=null and videoTitle !=''">video_title_ = #{videoTitle},</if>
- <if test="videoContent !=null and videoContent !=''">video_content_ = #{videoContent},</if>
- <if test="videoUrl !=null and videoUrl !=''">video_url_ = #{videoUrl},</if>
- <if test="coverUrl !=null and coverUrl !=''">cover_url_ = #{coverUrl},</if>
- <if test="updateBy !=null">update_by_ = #{updateBy},</if>
- update_time_ = SYSDATE()
- </set>
- WHERE id_ = #{id}
- </update>
- <delete id="deleteByGroupId" parameterType="java.lang.Long">
- DELETE
- FROM video_lesson_group_detail
- WHERE video_lesson_group_id_ = #{groupId}
- </delete>
-
- <select id="queryByVideoLessonGroupId" resultMap="BaseResultMap">
- select * from video_lesson_group_detail WHERE video_lesson_group_id_ = #{videoLessonGroupId}
- </select>
- </mapper>
|