NewsRelationMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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="insertDeptUser">
  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_dept_relation t1 on t1.user_id = t.id
  29. LEFT JOIN xjr_department t2 ON t2.id = t1.dept_id
  30. left join xjr_user_role_relation t3 on t3.user_id = t.id
  31. LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
  32. where t.delete_mark = 0 and t4.id = 2
  33. <if test="deptIdList != null and deptIdList.size() > 0">
  34. and t2.id in
  35. <foreach item="deptId" index="index" collection="deptIdList" open="(" close=")"
  36. separator=",">
  37. #{deptId}
  38. </foreach>
  39. </if>)
  40. </insert>
  41. <insert id="insertClassUser">
  42. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  43. (select
  44. UUID(),
  45. #{newsId},
  46. t.id,
  47. NOW(),
  48. 0
  49. from xjr_user t
  50. inner join base_student t3 on t.id = t3.user_id
  51. left join base_student_school_roll t1 on t1.user_id = t.id
  52. LEFT JOIN base_class t2 ON t2.id = t1.class_id
  53. where t.delete_mark = 0
  54. <if test="classIdList != null and classIdList.size() > 0">
  55. and t2.id in
  56. <foreach item="classId" index="index" collection="classIdList" open="(" close=")"
  57. separator=",">
  58. #{classId}
  59. </foreach>
  60. </if>)
  61. </insert>
  62. <insert id="insertPersonl">
  63. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  64. (select
  65. UUID(),
  66. #{newsId},
  67. t.id,
  68. NOW(),
  69. 0
  70. from xjr_user t
  71. where t.delete_mark = 0
  72. <if test="userIdList != null and userIdList.size() > 0">
  73. and t.id in
  74. <foreach item="userId" index="index" collection="userIdList" open="(" close=")"
  75. separator=",">
  76. #{userId}
  77. </foreach>
  78. </if>)
  79. </insert>
  80. <insert id="insertAlluser">
  81. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  82. (select
  83. UUID(),
  84. #{newsId},
  85. t.id,
  86. NOW(),
  87. 0
  88. from xjr_user t
  89. where t.delete_mark = 0)
  90. </insert>
  91. </mapper>