insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
(select
UUID(),
#{newsId},
t.id,
NOW(),
0
from xjr_user t
left join xjr_user_role_relation t3 on t3.user_id = t.id
LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
where t.delete_mark = 0 and t4.id = 2)
insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
(select
UUID(),
#{newsId},
t.id,
NOW(),
0
from xjr_user t
left join xjr_user_dept_relation t1 on t1.user_id = t.id
LEFT JOIN xjr_department t2 ON t2.id = t1.dept_id
left join xjr_user_role_relation t3 on t3.user_id = t.id
LEFT JOIN xjr_role t4 ON t4.id = t3.role_id
where t.delete_mark = 0 and t4.id = 2
and t2.id in
#{deptId}
)
insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
(select
UUID(),
#{newsId},
t.id,
NOW(),
0
from xjr_user t
left join base_student_school_roll t1 on t1.user_id = t.id
LEFT JOIN base_class t2 ON t2.id = t1.class_id
where t.delete_mark = 0
and t2.id in
#{classId}
)
insert into xjr_oa_news_relation (id, news_id, user_id, create_date, read_mark)
(select
UUID(),
#{newsId},
t.id,
NOW(),
0
from xjr_user t
where t.delete_mark = 0
and t.id in
#{userId}
)