USE DCP;
INSERT INTO auth_privilege ( APPLICATION_ID, PRIVILEGE_KEY, PRIVILEGE_NAME, PRIVILEGE_TYPE_DICT, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME,PRIVILEGE_DISPLAY_ORDER,PRIVILEGE_PARENT_ID,PRIVILEGE_ICON,PRIVILEGE_URL,PRIVILEGE_STATUS ) (SELECT 2,'AUTH.CLIENTS','oauth_client','1','1',now(),'1',now(),100,(SELECT max(PRIVILEGE_ID) FROM auth_privilege WHERE PRIVILEGE_KEY='ITIM.SYSTEM.SETTINGS'),'fa-credit-card','OauthClientDetailsList','0' FROM DUAL);

INSERT INTO `sys_dict_type`(`DICT_TYPE_NAME`, `DICT_TYPE_CODE`, `DICT_TYPE_DISP_ORDER`, `DICT_TYPE_STATUS`, `DICT_TYPE_DESCRIPTION`, `CREATE_USER_ID`, `CREATE_TIME`, `UPDATE_USER_ID`, `UPDATE_TIME`) VALUES ('AUTHORIZED_GRANT_TYPES', 'AUTHORIZED_GRANT_TYPES', NULL, 'Y', '', 1, '2020-12-02 17:00:37', 1, '2020-12-02 17:00:37');
INSERT INTO `sys_dict_type`(`DICT_TYPE_NAME`, `DICT_TYPE_CODE`, `DICT_TYPE_DISP_ORDER`, `DICT_TYPE_STATUS`, `DICT_TYPE_DESCRIPTION`, `CREATE_USER_ID`, `CREATE_TIME`, `UPDATE_USER_ID`, `UPDATE_TIME`) VALUES ('RESOURCE_IDS', 'RESOURCE_IDS', NULL, 'Y', '', 1, '2020-12-02 16:59:53', 1, '2020-12-02 16:59:53');
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='AUTHORIZED_GRANT_TYPES'),'authorization_code','authorization_code','10','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='AUTHORIZED_GRANT_TYPES'),'password','password','20','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='AUTHORIZED_GRANT_TYPES'),'refresh_token','refresh_token','30','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='AUTHORIZED_GRANT_TYPES'),'implicit','implicit','40','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='AUTHORIZED_GRANT_TYPES'),'client_credentials','client_credentials','50','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'api-gateway','api-gateway','10','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'auth-service','auth-service','20','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'sys-service','sys-service','30','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'file-service','file-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-usercenter-service','itim-usercenter-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'ums-service','ums-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-meeting-service','itim-meeting-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-project-service','itim-project-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-personnel-service','itim-personnel-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-operation-service','itim-operation-service','1','Y','','1',now(),'1',now() FROM DUAL);

INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-work-service','itim-work-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-approve-service','itim-approve-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-systodo-service','itim-systodo-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-outsource-service','itim-outsource-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'log-service','log-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'cms-service','cms-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-customer-service','itim-customer-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'search-service','search-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-resourceshare-service','itim-resourceshare-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'itim-fileextend-service','itim-fileextend-service','1','Y','','1',now(),'1',now() FROM DUAL);
INSERT INTO sys_dict ( DICT_TYPE_ID, DICT_NAME, DICT_VALUE, DICT_DISP_ORDER, DICT_STATUS, DICT_DESCRIPTION, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME) (SELECT (SELECT max(dict_type_id) FROM sys_dict_type WHERE dict_type_code='RESOURCE_IDS'),'msg-service','msg-service','1','Y','','1',now(),'1',now() FROM DUAL);


DROP TABLE IF EXISTS `oauth_client_details`;
CREATE TABLE `oauth_client_details`  (
  `client_id` varchar(48) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `resource_ids` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `client_secret` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `scope` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `authorized_grant_types` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `web_server_redirect_uri` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `authorities` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `access_token_validity` int(11) DEFAULT NULL,
  `refresh_token_validity` int(11) DEFAULT NULL,
  `additional_information` varchar(4096) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  `autoapprove` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  PRIMARY KEY (`client_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

INSERT INTO `oauth_client_details` VALUES ('client_1', 'file-service,api-gateway,auth-service,sys-service,ums-service,itim-usercenter-service,itim-meeting-service,itim-project-service,itim-personnel-service,itim-operation-service,itim-work-service,itim-approve-service,itim-systodo-service,itim-outsource-service,log-service,cms-service,itim-customer-service,search-service,itim-resourceshare-service,itim-fileextend-service,msg-service', '1xapp', 'server', 'password,refresh_token', NULL, 'oauth2', 86400, 86401, NULL, NULL);
INSERT INTO `oauth_client_details` VALUES ('client_2', 'file-service,api-gateway,auth-service,sys-service,ums-service,itim-usercenter-service,itim-meeting-service,itim-project-service,itim-personnel-service,itim-operation-service,itim-work-service,itim-approve-service,itim-systodo-service,itim-outsource-service,log-service,cms-service,itim-customer-service,search-service,itim-resourceshare-service,itim-fileextend-service,msg-service', '1xapp', 'server', 'password,refresh_token', NULL, 'oauth2', 86400, 86401, NULL, NULL);
INSERT INTO `oauth_client_details` VALUES ('client_app', 'file-service,api-gateway,auth-service,sys-service,ums-service,itim-usercenter-service,itim-meeting-service,itim-project-service,itim-personnel-service,itim-operation-service,itim-work-service,itim-approve-service,itim-systodo-service,itim-outsource-service,log-service,cms-service,itim-customer-service,search-service,itim-resourceshare-service,itim-fileextend-service,msg-service', '1xapp', 'server', 'password,refresh_token', NULL, 'oauth2', 86400, 610000, NULL, NULL);

SET FOREIGN_KEY_CHECKS = 1;

/*
已执行161,159
 */
