Merge branch 'main' of http://27.223.88.102:33000/chenx/qhmes
This commit is contained in:
82
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
Normal file
82
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
Normal file
@@ -0,0 +1,82 @@
|
||||
-- MES 停机记录:建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_downtime_record:*
|
||||
-- 依赖:mes_xsl_equipment_ledger、mes_xsl_downtime_type;父菜单 设备管理
|
||||
-- Flyway:V3.9.2_117__mes_xsl_downtime_record.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
|
||||
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余',
|
||||
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
|
||||
`downtime_type_id` varchar(32) NOT NULL COMMENT '停机类型主键 mes_xsl_downtime_type.id',
|
||||
`downtime_type_name` varchar(500) DEFAULT NULL COMMENT '停机类型名称冗余',
|
||||
`start_time` datetime NOT NULL COMMENT '开始时间',
|
||||
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
|
||||
`equipment_part_id` varchar(32) DEFAULT NULL COMMENT '设备部位主键 mes_xsl_equipment_part.id',
|
||||
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余',
|
||||
`inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id',
|
||||
`inspect_maintain_item_name` varchar(500) DEFAULT NULL COMMENT '点检项目名称冗余',
|
||||
`maintenance_result` varchar(500) DEFAULT NULL COMMENT '维修结果',
|
||||
`maintainer_user_id` varchar(32) DEFAULT NULL COMMENT '维修人用户ID',
|
||||
`maintainer_username` varchar(500) DEFAULT NULL COMMENT '维修人账号',
|
||||
`maintainer_realname` varchar(500) DEFAULT NULL COMMENT '维修人姓名',
|
||||
`maintenance_filled_flag` varchar(1) DEFAULT '0' COMMENT '是否已录入维修结果(字典yn:1是0否)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdr_equipment` (`equipment_ledger_id`),
|
||||
KEY `idx_mdr_downtime_type` (`downtime_type_id`),
|
||||
KEY `idx_mdr_start_time` (`start_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机记录';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_equip_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000201', @mes_equip_pid, '停机记录', '/xslmes/mesXslDowntimeRecord', 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', 'MesXslDowntimeRecordList', 1, NULL, '1', 12, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:history-outlined';
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:history-outlined' WHERE `id` = '1860000000000000201' AND `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000202', '1860000000000000201', '新增', 2, 'mes:mes_xsl_downtime_record:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000203', '1860000000000000201', '编辑', 2, 'mes:mes_xsl_downtime_record:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000204', '1860000000000000201', '删除', 2, 'mes:mes_xsl_downtime_record:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000205', '1860000000000000201', '批量删除', 2, 'mes:mes_xsl_downtime_record:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000206', '1860000000000000201', '导出', 2, 'mes:mes_xsl_downtime_record:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000207', '1860000000000000201', '导入', 2, 'mes:mes_xsl_downtime_record:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000201',
|
||||
'1860000000000000202', '1860000000000000203', '1860000000000000204', '1860000000000000205',
|
||||
'1860000000000000206', '1860000000000000207'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -0,0 +1,86 @@
|
||||
-- MES 胶料小料锁定原因:字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_reason:*
|
||||
-- 菜单 ID 段:1860000000000000208(按钮 209-214)
|
||||
-- 修改租户:改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定类型', 'xslmes_rubber_small_lock_type', '锁定/解锁', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_type' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '锁定', 'lock', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'lock');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '解锁', 'unlock', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'unlock');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定条码类型', 'xslmes_rubber_small_lock_barcode_type', '小料/胶料', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小料', 'small', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'small');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '胶料', 'rubber', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'rubber');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_reason` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`reason_code` varchar(16) NOT NULL COMMENT '编号(租户内从001递增自动生成,只读)',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '类型(字典xslmes_rubber_small_lock_type:lock锁定unlock解锁)',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type:small小料rubber胶料)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrslr_tenant_code` (`tenant_id`, `reason_code`),
|
||||
KEY `idx_mrslr_tenant_lock` (`tenant_id`, `lock_type`, `barcode_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定原因';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
'1860000000000000162'
|
||||
);
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000208', @mes_quality_pid, '胶料小料锁定原因', '/xslmes/mesXslRubberSmallLockReason', 'xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList', 'MesXslRubberSmallLockReasonList', 1, NULL, '1', 6, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `sort_no` = VALUES(`sort_no`), `is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:lock-outlined' WHERE `id` = '1860000000000000208' AND `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000209', '1860000000000000208', '新增', 2, 'mes:mes_xsl_rubber_small_lock_reason:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000210', '1860000000000000208', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_reason:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000211', '1860000000000000208', '删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000212', '1860000000000000208', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000213', '1860000000000000208', '导出', 2, 'mes:mes_xsl_rubber_small_lock_reason:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000214', '1860000000000000208', '导入', 2, 'mes:mes_xsl_rubber_small_lock_reason:importExcel', '1', 1, '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000208',
|
||||
'1860000000000000209', '1860000000000000210', '1860000000000000211', '1860000000000000212',
|
||||
'1860000000000000213', '1860000000000000214'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
Reference in New Issue
Block a user