123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?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.FsUserCourseTrainingCampMapper">
- <!-- 查询训练营列表 -->
- <select id="selectFsUserCourseTrainingCampVOListByMap" resultType="com.fs.course.vo.FsUserCourseTrainingCampVO">
- select
- ctc.training_camp_id,
- ctc.training_camp_name,
- ctc.order_number,
- min(if(ctp.period_starting_time >= CURDATE(), ctp.period_starting_time, null)) as recent_date,
- count(distinct ctp.period_id) as period_count,
- count(distinct cu.user_id) as vip_count
- from fs_user_course_training_camp ctc
- left join fs_user_course_period ctp on ctc.training_camp_id = ctp.training_camp_id
- left join fs_course_watch_log cu on cu.period_id = ctp.period_id
- <where>
- ctc.del_flag ='0'
- <if test="params.trainingCampName != null and params.trainingCampName != ''">
- and ctc.training_camp_name like concat('%',#{params.trainingCampName},'%')
- </if>
- <if test="params.companyId != null and params.companyId != ''">
- and ctp.company_id like concat('%',#{params.companyId},'%')
- </if>
- </where>
- group by ctc.training_camp_id, ctc.training_camp_name, ctc.order_number
- order by
- <choose>
- <when test="params.scs != null and params.scs.size() > 0">
- <foreach collection="params.scs" item="sc" separator=",">
- ${sc.column} ${sc.order}
- </foreach>
- </when>
- <otherwise>
- ctc.order_number desc, ctc.training_camp_id desc
- </otherwise>
- </choose>
- </select>
- <select id="selectCampListByMap" resultType="com.fs.his.vo.OptionsVO">
- select
- ctc.training_camp_id dictValue,
- ctc.training_camp_name dictLabel
- from fs_user_course_training_camp ctc
- <where>
- ctc.del_flag ='0'
- <if test="params.name != null and params.name != ''">
- and ctc.training_camp_name like concat('%', #{params.name}, '%')
- </if>
- </where>
- </select>
- </mapper>
|