FsUserCourseTrainingCampMapper.xml 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. <select id="selectFsUserCourseTrainingCampVOListByMap_COUNT" parameterType="Map" resultType="Long">
  7. select count(distinct ctc.training_camp_id)
  8. from fs_user_course_training_camp ctc
  9. left join fs_user_course_period ctp on ctc.training_camp_id = ctp.training_camp_id
  10. <if test="params.userId != null and params.userId != ''">
  11. left join fs_course_watch_log cu on cu.period_id = ctp.period_id
  12. </if>
  13. <where>
  14. ctc.del_flag ='0'
  15. <if test="params.trainingCampName != null and params.trainingCampName != ''">
  16. and ctc.training_camp_name like concat('%',#{params.trainingCampName},'%')
  17. </if>
  18. <if test="params.companyId != null and params.companyId != ''">
  19. and ctp.company_id like concat('%',#{params.companyId},'%')
  20. </if>
  21. <if test="params.userIds != null and params.userIds != ''">
  22. and ctc.user_id =#{params.userIds}
  23. </if>
  24. <if test="params.userId != null and params.userId != ''">
  25. and cu.user_id = #{params.userId}
  26. </if>
  27. </where>
  28. </select>
  29. <!-- 查询训练营列表 -->
  30. <select id="selectFsUserCourseTrainingCampVOListByMap" resultType="com.fs.course.vo.FsUserCourseTrainingCampVO">
  31. select
  32. ctc.training_camp_id,
  33. ctc.training_camp_name,
  34. ctc.order_number,
  35. min(if(ctp.period_starting_time >= CURDATE(), ctp.period_starting_time, null)) as recent_date,
  36. count(distinct ctp.period_id) as period_count
  37. from fs_user_course_training_camp ctc
  38. left join fs_user_course_period ctp on ctc.training_camp_id = ctp.training_camp_id
  39. <if test="params.userId != null and params.userId != ''">
  40. left join fs_course_watch_log cu on cu.period_id = ctp.period_id
  41. </if>
  42. <where>
  43. ctc.del_flag ='0'
  44. <if test="params.trainingCampName != null and params.trainingCampName != ''">
  45. and ctc.training_camp_name like concat('%',#{params.trainingCampName},'%')
  46. </if>
  47. <if test="params.companyId != null and params.companyId != ''">
  48. and ctp.company_id like concat('%',#{params.companyId},'%')
  49. </if>
  50. <if test="params.userIds != null and params.userIds != ''">
  51. and ctc.user_id =#{params.userIds}
  52. </if>
  53. <if test="params.userId != null and params.userId != ''">
  54. and cu.user_id = #{params.userId}
  55. </if>
  56. </where>
  57. group by ctc.training_camp_id, ctc.training_camp_name, ctc.order_number
  58. order by
  59. <choose>
  60. <when test="params.scs != null and params.scs.size() > 0">
  61. <foreach collection="params.scs" item="sc" separator=",">
  62. ${sc.column} ${sc.order}
  63. </foreach>
  64. </when>
  65. <otherwise>
  66. ctc.order_number desc, ctc.training_camp_id desc
  67. </otherwise>
  68. </choose>
  69. </select>
  70. <select id="selectCampListByMap" resultType="com.fs.his.vo.OptionsVO">
  71. select
  72. ctc.training_camp_id dictValue,
  73. ctc.training_camp_name dictLabel
  74. from fs_user_course_training_camp ctc
  75. <where>
  76. ctc.del_flag ='0'
  77. <if test="params.name != null and params.name != ''">
  78. and ctc.training_camp_name like concat('%', #{params.name}, '%')
  79. </if>
  80. </where>
  81. </select>
  82. </mapper>