FsUserCourseTrainingCampMapper.xml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.course.mapper.FsUserCourseTrainingCampMapper">
  6. <!-- 查询训练营列表 -->
  7. <select id="selectFsUserCourseTrainingCampVOListByMap" resultType="com.fs.course.vo.FsUserCourseTrainingCampVO">
  8. select
  9. ctc.training_camp_id,
  10. ctc.training_camp_name,
  11. ctc.order_number,
  12. min(if(ctp.period_starting_time >= CURDATE(), ctp.period_starting_time, null)) as recent_date,
  13. count(distinct ctp.period_id) as period_count
  14. from fs_user_course_training_camp ctc
  15. left join fs_user_course_period ctp on ctc.training_camp_id = ctp.training_camp_id
  16. <if test="params.userId != null and params.userId != ''">
  17. left join fs_course_watch_log cu on cu.period_id = ctp.period_id
  18. </if>
  19. <where>
  20. ctc.del_flag ='0'
  21. <if test="params.trainingCampName != null and params.trainingCampName != ''">
  22. and ctc.training_camp_name like concat('%',#{params.trainingCampName},'%')
  23. </if>
  24. <if test="params.companyId != null and params.companyId != ''">
  25. and ctp.company_id like concat('%',#{params.companyId},'%')
  26. </if>
  27. <if test="params.userIds != null and params.userIds != ''">
  28. and ctc.user_id =#{params.userIds}
  29. </if>
  30. <if test="params.userId != null and params.userId != ''">
  31. and cu.user_id = #{params.userId}
  32. </if>
  33. </where>
  34. group by ctc.training_camp_id, ctc.training_camp_name, ctc.order_number
  35. order by
  36. <choose>
  37. <when test="params.scs != null and params.scs.size() > 0">
  38. <foreach collection="params.scs" item="sc" separator=",">
  39. ${sc.column} ${sc.order}
  40. </foreach>
  41. </when>
  42. <otherwise>
  43. ctc.order_number desc, ctc.training_camp_id desc
  44. </otherwise>
  45. </choose>
  46. </select>
  47. <select id="selectCampListByMap" resultType="com.fs.his.vo.OptionsVO">
  48. select
  49. ctc.training_camp_id dictValue,
  50. ctc.training_camp_name dictLabel
  51. from fs_user_course_training_camp ctc
  52. <where>
  53. ctc.del_flag ='0'
  54. <if test="params.name != null and params.name != ''">
  55. and ctc.training_camp_name like concat('%', #{params.name}, '%')
  56. </if>
  57. </where>
  58. </select>
  59. </mapper>