NewsRelationMapper.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.oa.mapper.NewsRelationMapper">
  6. <insert id="insertAllTeaStaff" parameterType="java.lang.Long">
  7. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  8. (select
  9. UUID(),
  10. #{newsId},
  11. t.id,
  12. NOW(),
  13. 0
  14. from xjr_user t
  15. left join xjr_user_role_relation t3 on t3.user_id = t.id
  16. LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
  17. where t.delete_mark = 0 and t4.id = 2)
  18. </insert>
  19. <insert id="insertAllStudentStaff" parameterType="java.lang.Long">
  20. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  21. (SELECT
  22. UUID(),
  23. #{newsId},
  24. t.id,
  25. NOW(),
  26. 0
  27. FROM xjr_user t
  28. LEFT JOIN xjr_user_role_relation t3 ON t3.user_id = t.id
  29. LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
  30. LEFT JOIN base_student_school_roll t5 ON t.id = t5.user_id
  31. WHERE t.delete_mark = 0 AND t4.id = 3
  32. AND t5.archives_status = 'FB2901')
  33. </insert>
  34. <insert id="insertAllParentsStaff" parameterType="java.lang.Long">
  35. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  36. (select
  37. UUID(),
  38. #{newsId},
  39. t.id,
  40. NOW(),
  41. 0
  42. from xjr_user t
  43. left join xjr_user_role_relation t3 on t3.user_id = t.id
  44. LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
  45. where t.delete_mark = 0 and t4.id = 4)
  46. </insert>
  47. <insert id="insertDeptUser">
  48. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  49. (select
  50. UUID(),
  51. #{newsId},
  52. t.id,
  53. NOW(),
  54. 0
  55. from xjr_user t
  56. left join xjr_user_dept_relation t1 on t1.user_id = t.id
  57. LEFT JOIN xjr_department t2 ON t2.id = t1.dept_id
  58. left join xjr_user_role_relation t3 on t3.user_id = t.id
  59. LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
  60. where t.delete_mark = 0 and t4.id = 2
  61. <if test="deptIdList != null and deptIdList.size() > 0">
  62. and t2.id in
  63. <foreach item="deptId" index="index" collection="deptIdList" open="(" close=")"
  64. separator=",">
  65. #{deptId}
  66. </foreach>
  67. </if>)
  68. </insert>
  69. <insert id="insertClassUser">
  70. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  71. (select
  72. UUID(),
  73. #{newsId},
  74. t.id,
  75. NOW(),
  76. 0
  77. from xjr_user t
  78. inner join base_student t3 on t.id = t3.user_id
  79. left join base_student_school_roll t1 on t1.user_id = t.id
  80. LEFT JOIN base_class t2 ON t2.id = t1.class_id
  81. where t.delete_mark = 0
  82. <if test="classIdList != null and classIdList.size() > 0">
  83. and t2.id in
  84. <foreach item="classId" index="index" collection="classIdList" open="(" close=")"
  85. separator=",">
  86. #{classId}
  87. </foreach>
  88. </if>)
  89. </insert>
  90. <insert id="insertPersonl">
  91. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  92. (select
  93. UUID(),
  94. #{newsId},
  95. t.id,
  96. NOW(),
  97. 0
  98. from xjr_user t
  99. where t.delete_mark = 0
  100. <if test="userIdList != null and userIdList.size() > 0">
  101. and t.id in
  102. <foreach item="userId" index="index" collection="userIdList" open="(" close=")"
  103. separator=",">
  104. #{userId}
  105. </foreach>
  106. </if>)
  107. </insert>
  108. </mapper>