INSERT INTO `obpm2`.`meta_apps`(`id`, `app_id`, `created_time`, `is_online`, `last_updated_time`, `name`, `note`)
VALUES ('tenant-app-000-000-001', 'tenant-app', '2021-01-01 00:00:01', 1, '2021-01-01 00:00:01', '租户系统', '租户系统');
INSERT INTO `obpm2`.`meta_forms`(`id`, `created_time`, `form_id`, `form_type`, `is_online`, `last_updated_time`, `name`, `table_name`, `application_meta_id`)
VALUES ('form-tenant-app-000-000-001-employee', '2021-01-01 00:00:01', 'form-tenant-app-employee', 0, 0, '2021-01-01 00:00:01', '职员/保安员信息', 'sync_employee_view', 'tenant-app-000-000-001');
INSERT INTO `obpm2`.`meta_forms`(`id`, `created_time`, `form_id`, `form_type`, `is_online`, `last_updated_time`, `name`, `table_name`, `application_meta_id`)
VALUES ('form-tenant-app-000-000-001-department', '2021-01-01 00:00:01', 'form-tenant-app-department', 0, 0, '2021-01-01 00:00:01', '部门信息', 'sync_department_view', 'tenant-app-000-000-001');

/**
  以下根据不同环境做不同的配置
 */
INSERT INTO `obpm2`.`meta_datasources`(`id`, `config`, `created_time`, `data_source_id`, `db_type`, `is_selected`, `last_updated_time`, `name`, `note`,
                                       `use_type`, `application_meta_id`) VALUES
 ('ds-tenant-app-000-000-001', '{\"driverClass\":\"com.mysql.jdbc.Driver\",\"password\":\"TL5_enterprise#202109\",\"path\":\"/租户系统-非V5应用.application\",\"pathSuffix\":\"datasource\",\"poolSize\":\"200\",\"sqlParserBeanName\":\"MySql_SqlParser\",\"timeOut\":\"3600\",\"url\":\"jdbc:mysql://114.115.143.15:3300/obpm2?useUnicode=true&characterEncoding=utf8&useSSL=false\",\"urlPkgPrefixes\":\"\",\"username\":\"TL5_enterprise\"}',
  '2021-01-01 00:00:01', 'ds-tenant-app', 0, 1, '2021-01-01 00:00:01', '租户系统的数据源', '', 0, 'tenant-app-000-000-001');

INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES                                                                                                                                                                                                            (
  'instance-form-tenant-app-000-000-001-employee-02', '{\"mapKey\":\"tenant-app-employee\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步职员信息', 0,
  'form-tenant-app-000-000-001-employee', 'jianguan-waiwang-api', ' and superior_id is null ');
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES                                                                                                                                                                                                            (
 'instance-form-tenant-app-000-000-001-employee-01', '{\"mapKey\":\"tenant-app-employee\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步职员信息', 0,
 'form-tenant-app-000-000-001-employee', 'jianguan-waiwang-api', ' and superior_id is not null ');

INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES                                                                                                                                                                                                            (
 'instance-form-tenant-app-000-000-001-employee-03', '{\"mapKey\":\"tenant-app-securityman\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步保安员信息', 0,
 'form-tenant-app-000-000-001-employee', 'jianguan-waiwang-api', ' and is_certified =''已核验'' ');


/**
  根据部门级别进行设置
 */
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES (
 'instance-form-tenant-app-000-000-001-department-01', '{\"mapKey\":\"tenant-app-department\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步部门信息', 0,
 'form-tenant-app-000-000-001-department', 'jianguan-waiwang-api', ' and level=0 ');
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES (
  'instance-form-tenant-app-000-000-001-department-02', '{\"mapKey\":\"tenant-app-department\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步部门信息', 0,
  'form-tenant-app-000-000-001-department', 'jianguan-waiwang-api', ' and level=1 ');
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES (
  'instance-form-tenant-app-000-000-001-department-03', '{\"mapKey\":\"tenant-app-department\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步部门信息', 0,
  'form-tenant-app-000-000-001-department', 'jianguan-waiwang-api', ' and level=2 ');
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES (
'instance-form-tenant-app-000-000-001-department-04', '{\"mapKey\":\"tenant-app-department\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步部门信息', 0,
'form-tenant-app-000-000-001-department', 'jianguan-waiwang-api', ' and level=3 ');
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES (
 'instance-form-tenant-app-000-000-001-department-05', '{\"mapKey\":\"tenant-app-department\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步部门信息', 0,
 'form-tenant-app-000-000-001-department', 'jianguan-waiwang-api', ' and level=4 ');
INSERT INTO `obpm2`.`sync_meta_forms`(`id`, `config`, `created_time`, `is_online`, `last_synced_time`, `last_updated_time`, `note`, `synced_record_count`, `form_meta_id`, `target_meta_id`, `filter`) VALUES (
'instance-form-tenant-app-000-000-001-department-06', '{\"mapKey\":\"tenant-app-department\"}', '2021-01-01 00:00:01', 0, '2021-10-01 00:00:00', '2021-01-01 00:00:01', '同步部门信息', 0,
'form-tenant-app-000-000-001-department', 'jianguan-waiwang-api', ' and level not in (0,1,2,3,4) ');

update `obpm2`.`sync_meta_forms` set is_online=1 where id like 'instance-%';









