| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?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
- from fs_user_course_training_camp ctc
- left join fs_user_course_period ctp on ctc.training_camp_id = ctp.training_camp_id
- <if test="params.userId != null and params.userId != ''">
- left join fs_course_watch_log cu on cu.period_id = ctp.period_id
- </if>
- <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>
- <if test="params.userIds != null and params.userIds != ''">
- and ctc.user_id =#{params.userIds}
- </if>
- <if test="params.userId != null and params.userId != ''">
- and cu.user_id = #{params.userId}
- </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>
- <!-- APP端-查询训练营下拉列表 -->
- <select id="selectTrainingCampListForApp" resultType="com.fs.course.vo.FsUserCourseTrainingCampVO">
- SELECT DISTINCT
- ctc.training_camp_id AS trainingCampId,
- ctc.training_camp_name AS trainingCampName,
- ctc.order_number
- FROM fs_user_course_training_camp ctc
- INNER JOIN fs_user_course_period period
- ON ctc.training_camp_id = period.training_camp_id
- AND period.del_flag = '0'
- <where>
- ctc.del_flag = '0'
- <if test="params.companyId != null and params.companyId != ''">
- AND period.company_id LIKE CONCAT('%', #{params.companyId}, '%')
- </if>
- <if test="params.trainingCampName != null and params.trainingCampName != ''">
- AND ctc.training_camp_name LIKE CONCAT('%', #{params.trainingCampName}, '%')
- </if>
- </where>
- ORDER BY ctc.order_number DESC, ctc.training_camp_id DESC
- </select>
- </mapper>
|