NewsRelationMapper.xml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. left join base_student_school_roll t1 on t1.user_id = t.id
  51. LEFT JOIN base_class t2 ON t2.id = t1.class_id
  52. where t.delete_mark = 0
  53. <if test="classIdList != null and classIdList.size() > 0">
  54. and t2.id in
  55. <foreach item="classId" index="index" collection="classIdList" open="(" close=")"
  56. separator=",">
  57. #{classId}
  58. </foreach>
  59. </if>)
  60. </insert>
  61. <insert id="insertPersonl">
  62. insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
  63. (select
  64. UUID(),
  65. #{newsId},
  66. t.id,
  67. NOW(),
  68. 0
  69. from xjr_user t
  70. where t.delete_mark = 0
  71. <if test="userIdList != null and userIdList.size() > 0">
  72. and t.id in
  73. <foreach item="userId" index="index" collection="userIdList" open="(" close=")"
  74. separator=",">
  75. #{userId}
  76. </foreach>
  77. </if>)
  78. </insert>
  79. </mapper>