正在显示
1 个修改的文件
包含
68 行增加
和
0 行删除
| @@ -5,3 +5,71 @@ COMMENT ON COLUMN public."permission".opt_confirm_perf IS '是否需要员工确 | @@ -5,3 +5,71 @@ COMMENT ON COLUMN public."permission".opt_confirm_perf IS '是否需要员工确 | ||
| 5 | ALTER TABLE public."permission" ADD cycle_deadline jsonb NULL; | 5 | ALTER TABLE public."permission" ADD cycle_deadline jsonb NULL; |
| 6 | COMMENT ON COLUMN public."permission".cycle_deadline IS '周期评估各业务截止时间'; | 6 | COMMENT ON COLUMN public."permission".cycle_deadline IS '周期评估各业务截止时间'; |
| 7 | 7 | ||
| 8 | + | ||
| 9 | +-- 公司添加超级管理员(不存在时插入新数据)(注.公司ID->416) | ||
| 10 | +insert | ||
| 11 | +into | ||
| 12 | + public."role" | ||
| 13 | +( "name", | ||
| 14 | + "type", | ||
| 15 | + description, | ||
| 16 | + company_id, | ||
| 17 | + created_at, | ||
| 18 | + updated_at, | ||
| 19 | + deleted_at) | ||
| 20 | +select | ||
| 21 | + '超级管理员', | ||
| 22 | + 2, | ||
| 23 | + '隐藏角色,拥有部分权限', | ||
| 24 | + 416, | ||
| 25 | + now(), | ||
| 26 | + now(), | ||
| 27 | + null | ||
| 28 | + where | ||
| 29 | + not exists ( | ||
| 30 | + select | ||
| 31 | + 1 | ||
| 32 | + from | ||
| 33 | + public."role" | ||
| 34 | + where | ||
| 35 | + "role".company_id = 416 | ||
| 36 | + and "role"."type" = 2); | ||
| 37 | + | ||
| 38 | +-- 超级管理员添加关联用户(不存在时插入新数据)(注.公司ID->416 用户ID->3337322891762688) | ||
| 39 | +with temp_role as ( | ||
| 40 | + select | ||
| 41 | + id | ||
| 42 | + from | ||
| 43 | + public."role" | ||
| 44 | + where | ||
| 45 | + "role".company_id = 416 | ||
| 46 | + and "role"."type" = 2 | ||
| 47 | +) | ||
| 48 | +insert | ||
| 49 | +into | ||
| 50 | + public."role_user" | ||
| 51 | +( role_id, | ||
| 52 | + user_id, | ||
| 53 | + company_id, | ||
| 54 | + created_at, | ||
| 55 | + updated_at, | ||
| 56 | + deleted_at) | ||
| 57 | +select | ||
| 58 | + temp_role."id", | ||
| 59 | + 3337322891762688, | ||
| 60 | + 416, | ||
| 61 | + now(), | ||
| 62 | + now(), | ||
| 63 | + null | ||
| 64 | +from | ||
| 65 | + temp_role | ||
| 66 | +where | ||
| 67 | + not exists ( | ||
| 68 | + select | ||
| 69 | + 1 | ||
| 70 | + from | ||
| 71 | + public."role_user" | ||
| 72 | + where | ||
| 73 | + "role_user".company_id = 416 | ||
| 74 | + and "role_user".user_id = 3337322891762688 | ||
| 75 | + and "role_user".role_id = temp_role."id"); |
-
请 注册 或 登录 后发表评论