forked from Gitlink/microservices
56 lines
1.9 KiB
SQL
56 lines
1.9 KiB
SQL
-- 对没有资源领域的专区初始化数据
|
|
INSERT INTO `zone_resource_domain` (`name`, `sort`, `dept_id`, `del_flag`, `create_by`, `create_time`, `update_by`,
|
|
`update_time`, `zone_id`)
|
|
SELECT '资源领域一',
|
|
1,
|
|
dept_id,
|
|
'0',
|
|
'admin',
|
|
NOW(),
|
|
NULL,
|
|
NULL,
|
|
id
|
|
from zone_detail
|
|
where id not in (select zone_id from zone_resource_domain where name not in ('资源领域二', '资源领域三', '资源领域四'));
|
|
|
|
INSERT INTO `zone_resource_domain` (`name`, `sort`, `dept_id`, `del_flag`, `create_by`, `create_time`, `update_by`,
|
|
`update_time`, `zone_id`)
|
|
SELECT '资源领域二',
|
|
2,
|
|
dept_id,
|
|
'0',
|
|
'admin',
|
|
NOW(),
|
|
NULL,
|
|
NULL,
|
|
id
|
|
from zone_detail
|
|
where id not in (select zone_id from zone_resource_domain where name not in ('资源领域一', '资源领域三', '资源领域四'));
|
|
|
|
INSERT INTO `zone_resource_domain` (`name`, `sort`, `dept_id`, `del_flag`, `create_by`, `create_time`, `update_by`,
|
|
`update_time`, `zone_id`)
|
|
SELECT '资源领域三',
|
|
3,
|
|
dept_id,
|
|
'0',
|
|
'admin',
|
|
NOW(),
|
|
NULL,
|
|
NULL,
|
|
id
|
|
from zone_detail
|
|
where id not in (select zone_id from zone_resource_domain where name not in ('资源领域一', '资源领域二', '资源领域四'));
|
|
|
|
INSERT INTO `zone_resource_domain` (`name`, `sort`, `dept_id`, `del_flag`, `create_by`, `create_time`, `update_by`,
|
|
`update_time`, `zone_id`)
|
|
SELECT '资源领域四',
|
|
4,
|
|
dept_id,
|
|
'0',
|
|
'admin',
|
|
NOW(),
|
|
NULL,
|
|
NULL,
|
|
id
|
|
from zone_detail
|
|
where id not in (select zone_id from zone_resource_domain where name not in ('资源领域一', '资源领域二', '资源领域三')); |