123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <?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.fs.course.mapper.FsUserCourseMapper">
- <resultMap type="FsUserCourse" id="FsUserCourseResult">
- <result property="courseId" column="course_id" />
- <result property="cateId" column="cate_id" />
- <result property="subCateId" column="sub_cate_id" />
- <result property="courseName" column="course_name" />
- <result property="title" column="title" />
- <result property="imgUrl" column="img_url" />
- <result property="sort" column="sort" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="status" column="status" />
- <result property="isVip" column="is_vip" />
- <result property="isHot" column="is_hot" />
- <result property="isShow" column="is_show" />
- <result property="views" column="views" />
- <result property="duration" column="duration" />
- <result property="description" column="description" />
- <result property="hotRanking" column="hot_ranking" />
- <result property="integral" column="integral" />
- <result property="price" column="price" />
- <result property="sellPrice" column="sell_price" />
- <result property="project" column="project" />
- <result property="tags" column="tags" />
- <result property="likes" column="likes" />
- <result property="favoriteNum" column="favorite_num" />
- <result property="shares" column="shares" />
- <result property="isAutoPlay" column="is_auto_play" />
- <result property="isFast" column="is_fast" />
- <result property="isBest" column="is_best" />
- <result property="isTui" column="is_tui" />
- <result property="hotNum" column="hot_num" />
- <result property="isIntegral" column="is_integral" />
- <result property="courseType" column="course_type" />
- <result property="talentId" column="talent_id" />
- <result property="isDel" column="is_del" />
- <result property="isNext" column="is_next" />
- <result property="isPrivate" column="is_private" />
- <result property="secondImg" column="second_img" />
- <result property="companyIds" column="company_ids" />
- </resultMap>
- <sql id="selectFsUserCourseVo">
- select course_id,is_private,company_ids,is_next,talent_id,second_img,is_del, cate_id,sub_cate_id, course_name, title, img_url, sort, create_time, update_time, status, is_vip, is_hot, is_show, views, duration, description, hot_ranking, integral, price, sell_price, project, tags, likes, favorite_num, shares, is_auto_play, is_fast, is_best, is_tui, hot_num, is_integral, course_type from fs_user_course
- </sql>
- <select id="selectFsUserCourseList" parameterType="FsUserCourse" resultMap="FsUserCourseResult">
- <include refid="selectFsUserCourseVo"/>
- <where>
- <if test="cateId != null "> and cate_id = #{cateId}</if>
- <if test="subCateId != null "> and sub_cate_id = #{subCateId}</if>
- <if test="courseName != null and courseName != ''"> and course_name like concat('%', #{courseName}, '%')</if>
- <if test="title != null and title != ''"> and title = #{title}</if>
- <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
- <if test="sort != null "> and sort = #{sort}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="isVip != null "> and is_vip = #{isVip}</if>
- <if test="isHot != null "> and is_hot = #{isHot}</if>
- <if test="isShow != null "> and is_show = #{isShow}</if>
- <if test="views != null "> and views = #{views}</if>
- <if test="duration != null "> and duration = #{duration}</if>
- <if test="description != null and description != ''"> and description = #{description}</if>
- <if test="hotRanking != null "> and hot_ranking = #{hotRanking}</if>
- <if test="integral != null "> and integral = #{integral}</if>
- <if test="price != null "> and price = #{price}</if>
- <if test="sellPrice != null "> and sell_price = #{sellPrice}</if>
- <if test="project != null "> and project = #{project}</if>
- <if test="tags != null and tags != ''"> and tags = #{tags}</if>
- <if test="likes != null "> and likes = #{likes}</if>
- <if test="favoriteNum != null "> and favorite_num = #{favoriteNum}</if>
- <if test="shares != null "> and shares = #{shares}</if>
- <if test="isAutoPlay != null "> and is_auto_play = #{isAutoPlay}</if>
- <if test="isFast != null "> and is_fast = #{isFast}</if>
- <if test="isBest != null "> and is_best = #{isBest}</if>
- <if test="isTui != null "> and is_tui = #{isTui}</if>
- <if test="hotNum != null "> and hot_num = #{hotNum}</if>
- <if test="isIntegral != null "> and is_integral = #{isIntegral}</if>
- <if test="courseType != null "> and course_type = #{courseType}</if>
- <if test="talentId != null "> and talent_id = #{talentId}</if>
- <if test="isNext != null "> and is_next = #{isNext}</if>
- <if test="isPrivate != null "> and is_private = #{isPrivate}</if>
- </where>
- </select>
- <select id="selectFsUserCourseByCourseId" parameterType="Long" resultMap="FsUserCourseResult">
- <include refid="selectFsUserCourseVo"/>
- where course_id = #{courseId}
- </select>
- <select id="getParticipationRecordByMap" resultType="com.fs.course.vo.FsUserCourseParticipationRecordVO">
- select
- fu.user_id,
- fucv.video_id,
- fu.nick_name as nickName,
- fu.username as userName,
- fu.avatar,
- fu.phone as phoneNumber,
- fu.create_time,
- max(fcwl.create_time) as watchDate
- from fs_user_course_video fucv
- inner join fs_course_watch_log fcwl on fcwl.video_id = fucv.video_id
- inner join fs_user fu on fu.user_id = fcwl.user_id
- where fucv.video_id = #{params.videoId}
- <if test="params.keyword != null and params.keyword != ''">
- and (
- fu.user_id = #{params.keyword}
- or fu.nick_name like concat('%', #{params.keyword}, '%')
- or fu.username like concat('%', #{params.keyword}, '%')
- or fu.phone = #{params.keyword}
- )
- </if>
- <if test="params.companyUserId != null">
- and fcwl.company_user_id = #{params.companyUserId}
- </if>
- <if test="params.companyId != null">
- and fcwl.company_id = #{params.companyId}
- </if>
- <choose>
- <when test="params.type == 0">
- and (
- select count(log.log_id) as count
- from fs_course_answer_logs log
- where log.user_id = fu.user_id and log.video_id = fucv.video_id and log.is_right = 1
- ) > 0
- and (
- select count(log.log_id) as count
- from fs_course_red_packet_log log
- where log.user_id = fu.user_id and log.video_id = fucv.video_id and log.status = 1
- ) > 0
- </when>
- <when test="params.type == 1">
- and fcwl.log_type = 2
- </when>
- <when test="params.type == 2">
- and fcwl.log_type = 4
- </when>
- </choose>
- group by fu.user_id, fucv.video_id, fu.nick_name, fu.username, fu.avatar, fu.phone, fu.create_time
- </select>
- <insert id="insertFsUserCourse" parameterType="FsUserCourse" useGeneratedKeys="true" keyProperty="courseId">
- insert into fs_user_course
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="cateId != null">cate_id,</if>
- <if test="subCateId != null">sub_cate_id,</if>
- <if test="courseName != null">course_name,</if>
- <if test="title != null">title,</if>
- <if test="imgUrl != null">img_url,</if>
- <if test="sort != null">sort,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="status != null">status,</if>
- <if test="isVip != null">is_vip,</if>
- <if test="isHot != null">is_hot,</if>
- <if test="isShow != null">is_show,</if>
- <if test="views != null">views,</if>
- <if test="duration != null">duration,</if>
- <if test="description != null">description,</if>
- <if test="hotRanking != null">hot_ranking,</if>
- <if test="integral != null">integral,</if>
- <if test="price != null">price,</if>
- <if test="sellPrice != null">sell_price,</if>
- <if test="project != null">project,</if>
- <if test="tags != null">tags,</if>
- <if test="likes != null">likes,</if>
- <if test="favoriteNum != null">favorite_num,</if>
- <if test="shares != null">shares,</if>
- <if test="isAutoPlay != null">is_auto_play,</if>
- <if test="isFast != null">is_fast,</if>
- <if test="isBest != null">is_best,</if>
- <if test="isTui != null">is_tui,</if>
- <if test="hotNum != null">hot_num,</if>
- <if test="isIntegral != null">is_integral,</if>
- <if test="courseType != null">course_type,</if>
- <if test="talentId != null">talent_id,</if>
- <if test="isDel != null">is_del,</if>
- <if test="isNext != null">is_next,</if>
- <if test="isPrivate != null">is_private,</if>
- <if test="secondImg != null">second_img,</if>
- <if test="companyIds != null">company_ids,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="cateId != null">#{cateId},</if>
- <if test="subCateId != null">#{subCateId},</if>
- <if test="courseName != null">#{courseName},</if>
- <if test="title != null">#{title},</if>
- <if test="imgUrl != null">#{imgUrl},</if>
- <if test="sort != null">#{sort},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="status != null">#{status},</if>
- <if test="isVip != null">#{isVip},</if>
- <if test="isHot != null">#{isHot},</if>
- <if test="isShow != null">#{isShow},</if>
- <if test="views != null">#{views},</if>
- <if test="duration != null">#{duration},</if>
- <if test="description != null">#{description},</if>
- <if test="hotRanking != null">#{hotRanking},</if>
- <if test="integral != null">#{integral},</if>
- <if test="price != null">#{price},</if>
- <if test="sellPrice != null">#{sellPrice},</if>
- <if test="project != null">#{project},</if>
- <if test="tags != null">#{tags},</if>
- <if test="likes != null">#{likes},</if>
- <if test="favoriteNum != null">#{favoriteNum},</if>
- <if test="shares != null">#{shares},</if>
- <if test="isAutoPlay != null">#{isAutoPlay},</if>
- <if test="isFast != null">#{isFast},</if>
- <if test="isBest != null">#{isBest},</if>
- <if test="isTui != null">#{isTui},</if>
- <if test="hotNum != null">#{hotNum},</if>
- <if test="isIntegral != null">#{isIntegral},</if>
- <if test="courseType != null">#{courseType},</if>
- <if test="talentId != null">#{talentId},</if>
- <if test="isDel != null">#{isDel},</if>
- <if test="isNext != null">#{isNext},</if>
- <if test="isPrivate != null">#{isPrivate},</if>
- <if test="secondImg != null">#{secondImg},</if>
- <if test="companyIds != null">#{companyIds},</if>
- </trim>
- </insert>
- <update id="updateFsUserCourse" parameterType="FsUserCourse">
- update fs_user_course
- <trim prefix="SET" suffixOverrides=",">
- <if test="cateId != null">cate_id = #{cateId},</if>
- <if test="subCateId != null">sub_cate_id = #{subCateId},</if>
- <if test="courseName != null">course_name = #{courseName},</if>
- <if test="title != null">title = #{title},</if>
- <if test="imgUrl != null">img_url = #{imgUrl},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="status != null">status = #{status},</if>
- <if test="isVip != null">is_vip = #{isVip},</if>
- <if test="isHot != null">is_hot = #{isHot},</if>
- <if test="isShow != null">is_show = #{isShow},</if>
- <if test="views != null">views = #{views},</if>
- <if test="duration != null">duration = #{duration},</if>
- <if test="description != null">description = #{description},</if>
- <if test="hotRanking != null">hot_ranking = #{hotRanking},</if>
- <if test="integral != null">integral = #{integral},</if>
- <if test="price != null">price = #{price},</if>
- <if test="sellPrice != null">sell_price = #{sellPrice},</if>
- <if test="project != null">project = #{project},</if>
- <if test="tags != null">tags = #{tags},</if>
- <if test="likes != null">likes = #{likes},</if>
- <if test="favoriteNum != null">favorite_num = #{favoriteNum},</if>
- <if test="shares != null">shares = #{shares},</if>
- <if test="isAutoPlay != null">is_auto_play = #{isAutoPlay},</if>
- <if test="isFast != null">is_fast = #{isFast},</if>
- <if test="isBest != null">is_best = #{isBest},</if>
- <if test="isTui != null">is_tui = #{isTui},</if>
- <if test="hotNum != null">hot_num = #{hotNum},</if>
- <if test="isIntegral != null">is_integral = #{isIntegral},</if>
- <if test="courseType != null">course_type = #{courseType},</if>
- <if test="talentId != null">talent_id = #{talentId},</if>
- <if test="isDel != null">is_del = #{isDel},</if>
- <if test="isNext != null">is_next = #{isNext},</if>
- <if test="isPrivate != null">is_private = #{isPrivate},</if>
- <if test="secondImg != null">second_img = #{secondImg},</if>
- <if test="companyIds != null">company_ids = #{companyIds},</if>
- </trim>
- where course_id = #{courseId}
- </update>
- <update id="deleteFsUserCourseByCourseId" parameterType="Long">
- update fs_user_course set is_del = 1 where course_id = #{courseId}
- </update>
- <update id="deleteFsUserCourseByCourseIds" parameterType="String">
- update fs_user_course set is_del = 1 where course_id in
- <foreach item="courseId" collection="array" open="(" separator="," close=")">
- #{courseId}
- </foreach>
- </update>
- <!-- <select id="getFsUserCourseList" resultType="com.fs.course.vo.newfs.FsUserCourseListVO">-->
- <!-- SELECT-->
- <!-- c.*,-->
- <!-- cc.cate_name,-->
- <!-- ucc.cate_name AS sub_cate_name-->
- <!-- FROM-->
- <!-- fs_user_course c-->
- <!-- LEFT JOIN fs_user_course_category cc ON c.cate_id = cc.cate_id-->
- <!-- LEFT JOIN fs_user_course_category ucc ON ucc.cate_id = c.sub_cate_id-->
- <!-- WHERE-->
- <!-- c.is_del = 0-->
- <!-- AND FIND_IN_SET(#{companyId}, c.company_ids)-->
- <!-- <if test="keyword != null and keyword !='' ">-->
- <!-- AND c.course_name LIKE concat('%',#{keyword},'%'-->
- <!-- )-->
- <!-- </if>-->
- <!-- ORDER BY-->
- <!-- c.course_id-->
- <!-- </select>-->
- </mapper>
|