From 8f21e9e2fde6f1e5acc5355f3a9a4c8dbfbeba47 Mon Sep 17 00:00:00 2001
From: AprilWind <2100166581@qq.com>
Date: 星期三, 15 一月 2025 20:46:11 +0800
Subject: [PATCH] update 优化代码以及注释

---
 script/sql/update/postgres/update_5.0-5.1.sql |  147 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/script/sql/update/postgres/update_5.0-5.1.sql b/script/sql/update/postgres/update_5.0-5.1.sql
index f802788..14d7eb6 100644
--- a/script/sql/update/postgres/update_5.0-5.1.sql
+++ b/script/sql/update/postgres/update_5.0-5.1.sql
@@ -1,3 +1,150 @@
 ALTER TABLE gen_table ADD data_name varchar(200) default ''::varchar;
 
 COMMENT ON COLUMN gen_table.data_name IS '鏁版嵁婧愬悕绉�';
+
+UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob鎺у埗鍙拌彍鍗�' WHERE menu_id = 120;
+
+-- ----------------------------
+-- 绗笁鏂瑰钩鍙版巿鏉冭〃
+-- ----------------------------
+create table sys_social
+(
+    id                 int8             not null,
+    user_id            int8             not null,
+    tenant_id          varchar(20)      default null::varchar,
+    auth_id            varchar(255)     not null,
+    source             varchar(255)     not null,
+    open_id            varchar(255)     default null::varchar,
+    user_name          varchar(30)      not null,
+    nick_name          varchar(30)      default ''::varchar,
+    email              varchar(255)     default ''::varchar,
+    avatar             varchar(500)     default ''::varchar,
+    access_token       varchar(255)     not null,
+    expire_in          int8             default null,
+    refresh_token      varchar(255)     default null::varchar,
+    access_code        varchar(255)     default null::varchar,
+    union_id           varchar(255)     default null::varchar,
+    scope              varchar(255)     default null::varchar,
+    token_type         varchar(255)     default null::varchar,
+    id_token           varchar(255)     default null::varchar,
+    mac_algorithm      varchar(255)     default null::varchar,
+    mac_key            varchar(255)     default null::varchar,
+    code               varchar(255)     default null::varchar,
+    oauth_token        varchar(255)     default null::varchar,
+    oauth_token_secret varchar(255)     default null::varchar,
+    create_dept        int8,
+    create_by          int8,
+    create_time        timestamp,
+    update_by          int8,
+    update_time        timestamp,
+    del_flag           char             default '0'::bpchar,
+    constraint "pk_sys_social" primary key (id)
+);
+
+comment on table   sys_social                   is '绀句細鍖栧叧绯昏〃';
+comment on column  sys_social.id                is '涓婚敭';
+comment on column  sys_social.user_id           is '鐢ㄦ埛ID';
+comment on column  sys_social.tenant_id         is '绉熸埛id';
+comment on column  sys_social.auth_id           is '骞冲彴+骞冲彴鍞竴id';
+comment on column  sys_social.source            is '鐢ㄦ埛鏉ユ簮';
+comment on column  sys_social.open_id           is '骞冲彴缂栧彿鍞竴id';
+comment on column  sys_social.user_name         is '鐧诲綍璐﹀彿';
+comment on column  sys_social.nick_name         is '鐢ㄦ埛鏄电О';
+comment on column  sys_social.email             is '鐢ㄦ埛閭';
+comment on column  sys_social.avatar            is '澶村儚鍦板潃';
+comment on column  sys_social.access_token      is '鐢ㄦ埛鐨勬巿鏉冧护鐗�';
+comment on column  sys_social.expire_in         is '鐢ㄦ埛鐨勬巿鏉冧护鐗岀殑鏈夋晥鏈燂紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.refresh_token     is '鍒锋柊浠ょ墝锛岄儴鍒嗗钩鍙板彲鑳芥病鏈�';
+comment on column  sys_social.access_code       is '骞冲彴鐨勬巿鏉冧俊鎭紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.union_id          is '鐢ㄦ埛鐨� unionid';
+comment on column  sys_social.scope             is '鎺堜簣鐨勬潈闄愶紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.token_type        is '涓埆骞冲彴鐨勬巿鏉冧俊鎭紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.id_token          is 'id token锛岄儴鍒嗗钩鍙板彲鑳芥病鏈�';
+comment on column  sys_social.mac_algorithm     is '灏忕背骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.mac_key           is '灏忕背骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.code              is '鐢ㄦ埛鐨勬巿鏉僣ode锛岄儴鍒嗗钩鍙板彲鑳芥病鏈�';
+comment on column  sys_social.oauth_token       is 'Twitter骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.oauth_token_secret is 'Twitter骞冲彴鐢ㄦ埛鐨勯檮甯﹀睘鎬э紝閮ㄥ垎骞冲彴鍙兘娌℃湁';
+comment on column  sys_social.create_dept       is '鍒涘缓閮ㄩ棬';
+comment on column  sys_social.create_by         is '鍒涘缓鑰�';
+comment on column  sys_social.create_time       is '鍒涘缓鏃堕棿';
+comment on column  sys_social.update_by         is '鏇存柊鑰�';
+comment on column  sys_social.update_time       is '鏇存柊鏃堕棿';
+comment on column  sys_social.del_flag          is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 1浠h〃鍒犻櫎锛�';
+
+
+-- ----------------------------
+-- 绯荤粺鎺堟潈琛�
+-- ----------------------------
+drop table if exists sys_client;
+create table sys_client (
+    id                  int8,
+    client_id           varchar(64)   default ''::varchar,
+    client_key          varchar(32)   default ''::varchar,
+    client_secret       varchar(255)  default ''::varchar,
+    grant_type          varchar(255)  default ''::varchar,
+    device_type         varchar(32)   default ''::varchar,
+    active_timeout      int4          default 1800,
+    timeout             int4          default 604800,
+    status              char(1)       default '0'::bpchar,
+    del_flag            char(1)       default '0'::bpchar,
+    create_dept         int8,
+    create_by           int8,
+    create_time         timestamp,
+    update_by           int8,
+    update_time         timestamp,
+    constraint sys_client_pk primary key (id)
+);
+
+comment on table sys_client                         is '绯荤粺鎺堟潈琛�';
+comment on column sys_client.id                     is '涓婚敭';
+comment on column sys_client.client_id              is '瀹㈡埛绔痠d';
+comment on column sys_client.client_key             is '瀹㈡埛绔痥ey';
+comment on column sys_client.client_secret          is '瀹㈡埛绔閽�';
+comment on column sys_client.grant_type             is '鎺堟潈绫诲瀷';
+comment on column sys_client.device_type            is '璁惧绫诲瀷';
+comment on column sys_client.active_timeout         is 'token娲昏穬瓒呮椂鏃堕棿';
+comment on column sys_client.timeout                is 'token鍥哄畾瓒呮椂';
+comment on column sys_client.status                 is '鐘舵�侊紙0姝e父 1鍋滅敤锛�';
+comment on column sys_client.del_flag               is '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 1浠h〃鍒犻櫎锛�';
+comment on column sys_client.create_dept            is '鍒涘缓閮ㄩ棬';
+comment on column sys_client.create_by              is '鍒涘缓鑰�';
+comment on column sys_client.create_time            is '鍒涘缓鏃堕棿';
+comment on column sys_client.update_by              is '鏇存柊鑰�';
+comment on column sys_client.update_time            is '鏇存柊鏃堕棿';
+
+insert into sys_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password,social', 'pc', 1800, 604800, 0, 0, 103, 1, now(), 1, now());
+insert into sys_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms,social', 'android', 1800, 604800, 0, 0, 103, 1, now(), 1, now());
+
+insert into sys_dict_type values(11, '000000', '鎺堟潈绫诲瀷', 'sys_grant_type',     '0', 103, 1, now(), null, null, '璁よ瘉鎺堟潈绫诲瀷');
+insert into sys_dict_type values(12, '000000', '璁惧绫诲瀷', 'sys_device_type',    '0', 103, 1, now(), null, null, '瀹㈡埛绔澶囩被鍨�');
+
+insert into sys_dict_data values(30, '000000', 0,  '瀵嗙爜璁よ瘉', 'password',   'sys_grant_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '瀵嗙爜璁よ瘉');
+insert into sys_dict_data values(31, '000000', 0,  '鐭俊璁よ瘉', 'sms',        'sys_grant_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '鐭俊璁よ瘉');
+insert into sys_dict_data values(32, '000000', 0,  '閭欢璁よ瘉', 'email',      'sys_grant_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '閭欢璁よ瘉');
+insert into sys_dict_data values(33, '000000', 0,  '灏忕▼搴忚璇�', 'xcx',      'sys_grant_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '灏忕▼搴忚璇�');
+insert into sys_dict_data values(34, '000000', 0,  '涓夋柟鐧诲綍璁よ瘉', 'social', 'sys_grant_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '涓夋柟鐧诲綍璁よ瘉');
+insert into sys_dict_data values(35, '000000', 0,  'PC', 'pc',              'sys_device_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, 'PC');
+insert into sys_dict_data values(36, '000000', 0,  '瀹夊崜', 'android',       'sys_device_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '瀹夊崜');
+insert into sys_dict_data values(37, '000000', 0,  'iOS', 'ios',            'sys_device_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, 'iOS');
+insert into sys_dict_data values(38, '000000', 0,  '灏忕▼搴�', 'xcx',         'sys_device_type',   '',   'default', 'N', '0', 103, 1, now(), null, null, '灏忕▼搴�');
+
+-- 浜岀骇鑿滃崟
+insert into sys_menu values('123',  '瀹㈡埛绔鐞�',   '1',   '11', 'client',           'system/client/index',          '', '1', '0', 'C', '0', '0', 'system:client:list',          'international', 103, 1, now(), null, null, '瀹㈡埛绔鐞嗚彍鍗�');
+-- 瀹㈡埛绔鐞嗘寜閽�
+insert into sys_menu values('1061', '瀹㈡埛绔鐞嗘煡璇�', '123', '1',  '#', '', '', '1', '0', 'F', '0', '0', 'system:client:query',        '#', 103, 1, now(), null, null, '');
+insert into sys_menu values('1062', '瀹㈡埛绔鐞嗘柊澧�', '123', '2',  '#', '', '', '1', '0', 'F', '0', '0', 'system:client:add',          '#', 103, 1, now(), null, null, '');
+insert into sys_menu values('1063', '瀹㈡埛绔鐞嗕慨鏀�', '123', '3',  '#', '', '', '1', '0', 'F', '0', '0', 'system:client:edit',         '#', 103, 1, now(), null, null, '');
+insert into sys_menu values('1064', '瀹㈡埛绔鐞嗗垹闄�', '123', '4',  '#', '', '', '1', '0', 'F', '0', '0', 'system:client:remove',       '#', 103, 1, now(), null, null, '');
+insert into sys_menu values('1065', '瀹㈡埛绔鐞嗗鍑�', '123', '5',  '#', '', '', '1', '0', 'F', '0', '0', 'system:client:export',       '#', 103, 1, now(), null, null, '');
+
+-- 瑙掕壊鑿滃崟鏉冮檺
+insert into sys_role_menu values ('2', '1061');
+insert into sys_role_menu values ('2', '1062');
+insert into sys_role_menu values ('2', '1063');
+insert into sys_role_menu values ('2', '1064');
+insert into sys_role_menu values ('2', '1065');
+
+
+update sys_dept set leader = null;
+ALTER TABLE sys_dept ALTER COLUMN leader TYPE int8;

--
Gitblit v1.9.3