ActivityInfoMapper.xml 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.xjrsoft.module.activity.mapper.ActivityInfoMapper">
  6. <select id="getPage" parameterType="com.xjrsoft.module.activity.dto.ActivityInfoPageDto" resultType="com.xjrsoft.module.activity.vo.ActivityInfoPageVo">
  7. SELECT t1.id,t2.name AS type_cn,t3.company_name AS enterprise_name,t1.name,t1.place,t1.start_date,t1.end_date,
  8. t1.type, t4.name AS org_name, t1.enroll_end_time, t1.duty_person,t1.duty_person_mobile, t1.cover_file_id,
  9. t1.enroll_range, t1.status,t1.content,t1.category,t4.name as org_cn,t1.org_id,
  10. (SELECT COUNT(*) FROM activity_enroll WHERE delete_mark = 0 AND activity_info_id = t1.id) as enroll_count FROM activity_info t1
  11. LEFT JOIN xjr_dictionary_detail t2 ON t1.type = t2.code
  12. LEFT JOIN company_coop t3 ON t1.enterprise_id = t3.id
  13. LEFT JOIN xjr_department t4 ON t1.org_id = t4.id
  14. WHERE t1.delete_mark = 0
  15. <if test="dto.category != null">
  16. and t1.category = #{dto.category}
  17. </if>
  18. <if test="dto.isEffective != null and dto.isEffective == 1">
  19. and (t1.status = 1 or t1.status = 2) and enroll_end_time >= NOW()
  20. </if>
  21. <if test="dto.name != null and dto.name != ''">
  22. and t1.name like concat('%', #{dto.name},'%')
  23. </if>
  24. <if test="dto.type != null and dto.type != ''">
  25. and t1.type = #{dto.type}
  26. </if>
  27. <if test="dto.orgId != null">
  28. and t1.org_id = #{dto.orgId}
  29. </if>
  30. <if test="dto.status != null ">
  31. and t1.status = #{dto.status}
  32. </if>
  33. <if test="dto.activityInfoIds != null and dto.activityInfoIds.size() > 0">
  34. and t1.id in
  35. <foreach item="id" index="index" collection="dto.activityInfoIds" open="(" close=")" separator=",">
  36. #{id}
  37. </foreach>
  38. </if>
  39. </select>
  40. <select id="getMyPage" parameterType="com.xjrsoft.module.activity.dto.ActivityInfoPageDto" resultType="com.xjrsoft.module.activity.vo.ActivityInfoPageVo">
  41. SELECT t1.id,t1.name,t1.place,t1.start_date,t1.end_date,
  42. t1.type, t4.name AS org_name, t1.enroll_end_time, t1.cover_file_id,
  43. t1.status,t1.content,t1.category,t5.status AS enroll_status,t2.name as type_cn FROM activity_info t1
  44. LEFT JOIN xjr_dictionary_detail t2 ON t1.type = t2.code
  45. LEFT JOIN company_coop t3 ON t1.enterprise_id = t3.id
  46. LEFT JOIN xjr_department t4 ON t1.org_id = t4.id
  47. LEFT JOIN activity_enroll t5 ON t1.id = t5.activity_info_id
  48. WHERE t1.delete_mark = 0 AND t5.user_id = #{dto.loginUserId}
  49. <if test="dto.category != null">
  50. and t1.category = #{dto.category}
  51. </if>
  52. <if test="dto.isEffective != null and dto.isEffective == 1">
  53. and (t1.status = 1 or t1.status = 2) and NOW() between t1.start_date and t1.end_date
  54. </if>
  55. UNION
  56. SELECT a1.id, a1.club_activities_name AS NAME, 1 AS enroll_status,
  57. a1.club_activities_content AS content,
  58. a1.activity_location AS place,a1.start_time AS start_date
  59. ,a1.end_time AS end_date, NULL AS cover_file_id,3 AS category,NULL AS org_name
  60. ,NULL AS enroll_end_time, 1 AS STATUS,NULL AS TYPE,a1.activity_type as type_cn
  61. FROM club_activities a1 WHERE a1.delete_mark = 0 AND a1.student_id = #{dto.loginUserId}
  62. UNION
  63. SELECT a2.id, a2.moral_event_name AS NAME, 1 AS enroll_status,
  64. a2.event_content AS content,
  65. a2.event_address AS place,a2.event_start_time AS start_date
  66. ,a2.event_end_time AS end_date, NULL AS cover_file_id,4 AS category,NULL AS org_name
  67. ,NULL AS enroll_end_time, 1 AS STATUS,NULL AS TYPE,a2.event_type as type_cn
  68. FROM moral_event a2 WHERE a2.delete_mark = 0 AND
  69. (a2.attend_teacher = #{dto.loginUserId} OR a2.attend_class IN (
  70. SELECT class_id FROM base_student_school_roll WHERE user_id = #{dto.loginUserId}
  71. ))
  72. </select>
  73. </mapper>