Merge branch '生产及设备基础资料'
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
-- MES 胶料快检数据点:建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_data_point:*
|
||||
-- 依赖:mes_xsl_rubber_quick_test_type;修改租户改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_data_point` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`point_name` varchar(128) NOT NULL COMMENT '数据点名称(同租户未删除唯一)',
|
||||
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
|
||||
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型(手填)',
|
||||
`point_desc` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||
`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_mrqtdp_tenant_type` (`tenant_id`, `quick_test_type_id`),
|
||||
UNIQUE KEY `uk_mrqtdp_tenant_name_del` (`tenant_id`, `point_name`, `del_flag`)
|
||||
) 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 ('1860000000000000170', @mes_quality_pid, '胶料快检数据点', '/xslmes/mesXslRubberQuickTestDataPoint', 'xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList', 'MesXslRubberQuickTestDataPointList', 1, NULL, '1', 2, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:dot-chart-outlined' WHERE `id` = '1860000000000000170' 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
|
||||
('1860000000000000171', '1860000000000000170', '新增', 2, 'mes:mes_xsl_rubber_quick_test_data_point:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000172', '1860000000000000170', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_data_point:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000173', '1860000000000000170', '删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000174', '1860000000000000170', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000175', '1860000000000000170', '导出', 2, 'mes:mes_xsl_rubber_quick_test_data_point:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000176', '1860000000000000170', '导入', 2, 'mes:mes_xsl_rubber_quick_test_data_point: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 (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173', '1860000000000000174',
|
||||
'1860000000000000175', '1860000000000000176'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
27
jeecg-boot/db/mes-xsl-rubber-quick-test-method-drop.sql
Normal file
27
jeecg-boot/db/mes-xsl-rubber-quick-test-method-drop.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- 撤销「胶料快检实验方法」:删除菜单权限、字典、业务表(可整文件一次执行)
|
||||
-- 说明:若仅未执行过 V3.9.2_99 / mes-xsl-rubber-quick-test-method-menu-permission.sql,执行本脚本即可;
|
||||
-- 已 Flyway 执行过 V3.9.2_99 的环境,请同时执行 flyway V3.9.2_100 或本脚本(内容一致)。
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DELETE FROM `sys_role_permission`
|
||||
WHERE `permission_id` IN (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173',
|
||||
'1860000000000000174', '1860000000000000175', '1860000000000000176'
|
||||
);
|
||||
|
||||
DELETE FROM `sys_permission`
|
||||
WHERE `id` IN (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173',
|
||||
'1860000000000000174', '1860000000000000175', '1860000000000000176'
|
||||
);
|
||||
|
||||
DELETE di FROM `sys_dict_item` di
|
||||
INNER JOIN `sys_dict` d ON di.`dict_id` = d.`id`
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND d.`del_flag` = 0;
|
||||
|
||||
DELETE FROM `sys_dict`
|
||||
WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type';
|
||||
|
||||
DROP TABLE IF EXISTS `mes_xsl_rubber_quick_test_method`;
|
||||
@@ -0,0 +1,294 @@
|
||||
-- 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_method:*
|
||||
|
||||
-- 菜单 ID 段 1860000000000000177(与数据点 170 段区分)
|
||||
|
||||
-- 可与 Flyway V3.9.2_102 重复执行(ON DUPLICATE / IF NOT EXISTS)
|
||||
|
||||
-- SET @mes_tenant_id:多租户 admin 授权目标租户
|
||||
|
||||
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_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_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, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||
|
||||
|
||||
|
||||
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_quick_test_torque_unit', 'Ib.in、dNm、kg.cm、Nm、mdm', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
|
||||
FROM `sys_dict` d
|
||||
|
||||
CROSS JOIN (
|
||||
|
||||
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
|
||||
|
||||
SELECT 'dNm', 'dNm', 2 UNION ALL
|
||||
|
||||
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
|
||||
|
||||
SELECT 'Nm', 'Nm', 4 UNION ALL
|
||||
|
||||
SELECT 'mdm', 'mdm', 5
|
||||
|
||||
) v
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
|
||||
|
||||
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_quick_test_time_unit', 'sec、min、m:s', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
|
||||
FROM `sys_dict` d
|
||||
|
||||
CROSS JOIN (
|
||||
|
||||
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
|
||||
|
||||
SELECT 'min', 'min', 2 UNION ALL
|
||||
|
||||
SELECT 'm:s', 'm:s', 3
|
||||
|
||||
) v
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
|
||||
|
||||
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_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' 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, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU');
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_code` varchar(16) NOT NULL COMMENT '方法编号(租户内从001递增自动生成)',
|
||||
|
||||
`method_name` varchar(128) NOT NULL COMMENT '实验方法名称(同租户未删除唯一)',
|
||||
|
||||
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
|
||||
|
||||
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
|
||||
|
||||
`preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min',
|
||||
|
||||
`test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min',
|
||||
|
||||
`test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg',
|
||||
|
||||
`test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
|
||||
|
||||
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型(字典xslmes_rubber_quick_test_rotor_type:1大转子2小转子)',
|
||||
|
||||
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
|
||||
|
||||
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
|
||||
|
||||
`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_mrqtm_tenant_code` (`tenant_id`, `method_code`),
|
||||
|
||||
KEY `idx_mrqtm_type` (`quick_test_type_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id',
|
||||
|
||||
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||
|
||||
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余(只读带出)',
|
||||
|
||||
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余(只读带出)',
|
||||
|
||||
`torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型(字典xslmes_rubber_quick_test_torque_unit)',
|
||||
|
||||
`time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型(字典xslmes_rubber_quick_test_time_unit)',
|
||||
|
||||
`mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型(字典xslmes_rubber_quick_test_mooney_unit)',
|
||||
|
||||
`sort_no` int 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 '更新时间',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
KEY `idx_mrqtml_method` (`method_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`)
|
||||
|
||||
) 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 ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' 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
|
||||
|
||||
('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method: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 (
|
||||
|
||||
'1860000000000000177',
|
||||
|
||||
'1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181',
|
||||
|
||||
'1860000000000000182', '1860000000000000183'
|
||||
|
||||
)
|
||||
|
||||
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,87 @@
|
||||
-- MES 胶料快检实验类型:建表 + 质量管理目录 + 子菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀与 Controller、前端 v-auth 一致:mes:mes_xsl_rubber_quick_test_type:*
|
||||
-- 修改租户:改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`type_code` varchar(16) NOT NULL COMMENT '实验类型编号(租户内从001递增自动生成)',
|
||||
`type_name` varchar(128) NOT NULL COMMENT '实验类型名称',
|
||||
`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_mrqtt_tenant_code` (`tenant_id`, `type_code`),
|
||||
KEY `idx_mrqtt_tenant_name` (`tenant_id`, `type_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_root_parent = (
|
||||
SELECT `parent_id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_root_parent = IFNULL(@mes_root_parent, (
|
||||
SELECT `parent_id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
LIMIT 1
|
||||
));
|
||||
SET @mes_root_parent = IFNULL(@mes_root_parent, '1860000000000000001');
|
||||
|
||||
SET @mes_quality_sort = IFNULL((
|
||||
SELECT `sort_no` + 1 FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料', '设备管理')
|
||||
ORDER BY `sort_no` DESC
|
||||
LIMIT 1
|
||||
), 52);
|
||||
|
||||
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 ('1860000000000000162', @mes_root_parent, '质量管理', '/xslmes/quality', 'layouts/RouteView', 'MesQualityLayout', 0, NULL, '1', @mes_quality_sort, 1, 0, 0, '1', 0, 0, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:safety-certificate-outlined' WHERE `id` = '1860000000000000162' AND `del_flag` = 0;
|
||||
|
||||
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 ('1860000000000000163', '1860000000000000162', '胶料快检实验类型', '/xslmes/mesXslRubberQuickTestType', 'xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList', 'MesXslRubberQuickTestTypeList', 1, NULL, '1', 1, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:experiment-outlined' WHERE `id` = '1860000000000000163' 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
|
||||
('1860000000000000164', '1860000000000000163', '新增', 2, 'mes:mes_xsl_rubber_quick_test_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000165', '1860000000000000163', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000166', '1860000000000000163', '删除', 2, 'mes:mes_xsl_rubber_quick_test_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000167', '1860000000000000163', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000168', '1860000000000000163', '导出', 2, 'mes:mes_xsl_rubber_quick_test_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000169', '1860000000000000163', '导入', 2, 'mes:mes_xsl_rubber_quick_test_type: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 (
|
||||
'1860000000000000162',
|
||||
'1860000000000000163',
|
||||
'1860000000000000164', '1860000000000000165', '1860000000000000166', '1860000000000000167',
|
||||
'1860000000000000168', '1860000000000000169'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -103,3 +103,79 @@ jeecgboot-vue3/src/views/xslmes/mesXslFormulaSpec/components/MesXslFormulaSpecMo
|
||||
|
||||
-- author:cursor---date:20260521--for: 【配合示方】编辑打开时基本资料闪清修复 ---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslFormulaSpec/components/MesXslFormulaSpecModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型:质量管理目录、001自动编号、CRUD与菜单权限 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_97__mes_xsl_rubber_quick_test_type.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-type-menu-permission.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestType.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestTypeMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestTypeService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/components/MesXslRubberQuickTestTypeModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法:质量管理菜单、001编号、名称唯一、关联实验类型 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_99__mes_xsl_rubber_quick_test_method.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-method-menu-permission.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethod.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestMethodService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestMethodServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】撤销胶料快检实验方法功能(删代码+库清理脚本)---
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-method-drop.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_100__drop_mes_xsl_rubber_quick_test_method.sql
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检数据点:质量管理菜单、名称唯一、关联实验类型、单位手填 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_101__mes_xsl_rubber_quick_test_data_point.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-data-point-menu-permission.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestDataPoint.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestDataPointMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestDataPointService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestDataPointServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestDataPointController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/components/MesXslRubberQuickTestDataPointModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型名称同租户不可重复(Service兜底+唯一索引)---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_98__mes_xsl_rubber_quick_test_type_name_unique.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法主子表:质量管理菜单177段、001编号、名称唯一、选择数据点明细 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_102__mes_xsl_rubber_quick_test_method.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-method-menu-permission.sql
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethod.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethodLine.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestMethodPage.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodLineMapper.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestMethodService.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestMethodServiceImpl.java
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestDataPointSelectModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法明细字典单位必选、不可清空 ---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法明细单位字典默认取首项(非空选)---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
|
||||
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
|
||||
jeecgboot-vue3/src/components/jeecg/JVxeTable/src/components/cells/JVxeSelectCell.vue
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 胶料快检数据点
|
||||
*/
|
||||
@Tag(name = "MES胶料快检数据点")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRubberQuickTestDataPoint")
|
||||
@Slf4j
|
||||
public class MesXslRubberQuickTestDataPointController
|
||||
extends JeecgController<MesXslRubberQuickTestDataPoint, IMesXslRubberQuickTestDataPointService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestDataPointService mesXslRubberQuickTestDataPointService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
|
||||
|
||||
@Operation(summary = "MES胶料快检数据点-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberQuickTestDataPoint>> queryPageList(
|
||||
MesXslRubberQuickTestDataPoint model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberQuickTestDataPoint> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslRubberQuickTestDataPoint> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberQuickTestDataPoint> pageList = mesXslRubberQuickTestDataPointService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检数据点-添加")
|
||||
@Operation(summary = "MES胶料快检数据点-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberQuickTestDataPoint model) {
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点保存校验、实验类型回填-----------
|
||||
String err = validateForSave(model, null);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
try {
|
||||
mesXslRubberQuickTestDataPointService.save(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点保存校验、实验类型回填-----------
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检数据点-编辑")
|
||||
@Operation(summary = "MES胶料快检数据点-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberQuickTestDataPoint model) {
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点编辑校验-----------
|
||||
if (oConvertUtils.isEmpty(model.getId())) {
|
||||
return Result.error("缺少主键");
|
||||
}
|
||||
MesXslRubberQuickTestDataPoint old = mesXslRubberQuickTestDataPointService.getById(model.getId());
|
||||
if (old == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
String err = validateForSave(model, model.getId());
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
old.setPointName(model.getPointName());
|
||||
old.setQuickTestTypeId(model.getQuickTestTypeId());
|
||||
old.setQuickTestTypeName(model.getQuickTestTypeName());
|
||||
old.setUnitType(model.getUnitType());
|
||||
old.setPointDesc(model.getPointDesc());
|
||||
try {
|
||||
mesXslRubberQuickTestDataPointService.updateById(old);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点编辑校验-----------
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检数据点-删除")
|
||||
@Operation(summary = "MES胶料快检数据点-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberQuickTestDataPointService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检数据点-批量删除")
|
||||
@Operation(summary = "MES胶料快检数据点-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberQuickTestDataPointService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检数据点-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberQuickTestDataPoint> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberQuickTestDataPoint entity = mesXslRubberQuickTestDataPointService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "校验数据点名称是否重复")
|
||||
@GetMapping(value = "/checkPointName")
|
||||
public Result<String> checkPointName(
|
||||
@RequestParam(name = "pointName", required = true) String pointName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(pointName) || pointName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslRubberQuickTestDataPoint ctx = new MesXslRubberQuickTestDataPoint();
|
||||
if (mesXslRubberQuickTestDataPointService.isPointNameDuplicated(pointName.trim(), dataId, ctx)) {
|
||||
return Result.error("该数据点名称已存在");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestDataPoint model) {
|
||||
return super.exportXls(request, model, MesXslRubberQuickTestDataPoint.class, "MES胶料快检数据点");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点导入校验-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslRubberQuickTestDataPoint> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslRubberQuickTestDataPoint.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslRubberQuickTestDataPoint row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
String err = validateImportRow(row, rowNo, namesInFile);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
}
|
||||
for (MesXslRubberQuickTestDataPoint row : list) {
|
||||
try {
|
||||
mesXslRubberQuickTestDataPointService.save(row);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
log.info("胶料快检数据点Excel导入完成,行数={}", list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点导入校验-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
|
||||
private String validateForSave(MesXslRubberQuickTestDataPoint model, String excludeId) {
|
||||
if (oConvertUtils.isEmpty(model.getPointName()) || model.getPointName().trim().isEmpty()) {
|
||||
return "数据点名称不能为空";
|
||||
}
|
||||
model.setPointName(model.getPointName().trim());
|
||||
if (mesXslRubberQuickTestDataPointService.isPointNameDuplicated(model.getPointName(), excludeId, model)) {
|
||||
return "数据点名称已存在";
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(model.getUnitType())) {
|
||||
model.setUnitType(model.getUnitType().trim());
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(model.getPointDesc())) {
|
||||
model.setPointDesc(model.getPointDesc().trim());
|
||||
}
|
||||
return resolveAndFillQuickTestType(model);
|
||||
}
|
||||
|
||||
private String validateImportRow(MesXslRubberQuickTestDataPoint row, int rowNo, Set<String> namesInFile) {
|
||||
if (oConvertUtils.isEmpty(row.getPointName()) || row.getPointName().trim().isEmpty()) {
|
||||
return "文件导入失败:第 " + rowNo + " 条数据点名称不能为空";
|
||||
}
|
||||
row.setPointName(row.getPointName().trim());
|
||||
if (!namesInFile.add(row.getPointName())) {
|
||||
return "文件导入失败:数据点名称【" + row.getPointName() + "】在导入文件中重复";
|
||||
}
|
||||
if (mesXslRubberQuickTestDataPointService.isPointNameDuplicated(row.getPointName(), null, row)) {
|
||||
return "文件导入失败:第 " + rowNo + " 条数据点名称【" + row.getPointName() + "】已存在";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getQuickTestTypeId()) && oConvertUtils.isNotEmpty(row.getImportQuickTestTypeName())) {
|
||||
row.setQuickTestTypeName(row.getImportQuickTestTypeName().trim());
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getQuickTestTypeId()) && oConvertUtils.isNotEmpty(row.getQuickTestTypeName())) {
|
||||
MesXslRubberQuickTestType type = findQuickTestTypeByName(row.getQuickTestTypeName(), row);
|
||||
if (type == null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条实验类型【" + row.getQuickTestTypeName() + "】不存在";
|
||||
}
|
||||
row.setQuickTestTypeId(type.getId());
|
||||
}
|
||||
String typeErr = resolveAndFillQuickTestType(row);
|
||||
if (typeErr != null) {
|
||||
return "文件导入失败:第 " + rowNo + " 条" + typeErr;
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(row.getUnitType())) {
|
||||
row.setUnitType(row.getUnitType().trim());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String resolveAndFillQuickTestType(MesXslRubberQuickTestDataPoint model) {
|
||||
if (oConvertUtils.isEmpty(model.getQuickTestTypeId())) {
|
||||
return "请选择实验类型";
|
||||
}
|
||||
MesXslRubberQuickTestType type = mesXslRubberQuickTestTypeService.getById(model.getQuickTestTypeId());
|
||||
if (type == null) {
|
||||
return "实验类型不存在或已删除";
|
||||
}
|
||||
model.setQuickTestTypeName(type.getTypeName());
|
||||
return null;
|
||||
}
|
||||
|
||||
private MesXslRubberQuickTestType findQuickTestTypeByName(String typeName, MesXslRubberQuickTestDataPoint context) {
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberQuickTestType::getTypeName, typeName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslRubberQuickTestType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslRubberQuickTestType::getDelFlag));
|
||||
Integer tenantId = context != null ? context.getTenantId() : null;
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslRubberQuickTestType::getTenantId, tenantId);
|
||||
}
|
||||
w.last("LIMIT 1");
|
||||
return mesXslRubberQuickTestTypeService.getOne(w, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,508 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
|
||||
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
|
||||
|
||||
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestMethodPage;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法(主子表)
|
||||
|
||||
*/
|
||||
|
||||
@Tag(name = "MES胶料快检实验方法")
|
||||
|
||||
@RestController
|
||||
|
||||
@RequestMapping("/xslmes/mesXslRubberQuickTestMethod")
|
||||
|
||||
@Slf4j
|
||||
|
||||
public class MesXslRubberQuickTestMethodController
|
||||
|
||||
extends JeecgController<MesXslRubberQuickTestMethod, IMesXslRubberQuickTestMethodService> {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
private IMesXslRubberQuickTestMethodService mesXslRubberQuickTestMethodService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
private IMesXslRubberQuickTestDataPointService mesXslRubberQuickTestDataPointService;
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-分页列表查询")
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
|
||||
public Result<IPage<MesXslRubberQuickTestMethod>> queryPageList(
|
||||
|
||||
MesXslRubberQuickTestMethod model,
|
||||
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
|
||||
HttpServletRequest req) {
|
||||
|
||||
QueryWrapper<MesXslRubberQuickTestMethod> queryWrapper =
|
||||
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
Page<MesXslRubberQuickTestMethod> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
IPage<MesXslRubberQuickTestMethod> pageList = mesXslRubberQuickTestMethodService.page(page, queryWrapper);
|
||||
|
||||
return Result.OK(pageList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验方法-添加")
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-添加")
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:add")
|
||||
|
||||
@PostMapping(value = "/add")
|
||||
|
||||
public Result<String> add(@RequestBody MesXslRubberQuickTestMethodPage page) {
|
||||
|
||||
MesXslRubberQuickTestMethod main = new MesXslRubberQuickTestMethod();
|
||||
|
||||
BeanUtils.copyProperties(page, main);
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
|
||||
|
||||
String err = validateForSave(main, page.getLineList(), null);
|
||||
|
||||
if (err != null) {
|
||||
|
||||
return Result.error(err);
|
||||
|
||||
}
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
|
||||
|
||||
try {
|
||||
|
||||
mesXslRubberQuickTestMethodService.saveMain(main, page.getLineList());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
return Result.error(e.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验方法-编辑")
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-编辑")
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:edit")
|
||||
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
|
||||
public Result<String> edit(@RequestBody MesXslRubberQuickTestMethodPage page) {
|
||||
|
||||
MesXslRubberQuickTestMethod main = new MesXslRubberQuickTestMethod();
|
||||
|
||||
BeanUtils.copyProperties(page, main);
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
|
||||
|
||||
String err = validateForSave(main, page.getLineList(), main.getId());
|
||||
|
||||
if (err != null) {
|
||||
|
||||
return Result.error(err);
|
||||
|
||||
}
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
|
||||
|
||||
try {
|
||||
|
||||
mesXslRubberQuickTestMethodService.updateMain(main, page.getLineList());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
return Result.error(e.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return Result.OK("编辑成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验方法-删除")
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-通过id删除")
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:delete")
|
||||
|
||||
@DeleteMapping(value = "/delete")
|
||||
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
|
||||
mesXslRubberQuickTestMethodService.delMain(id);
|
||||
|
||||
return Result.OK("删除成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验方法-批量删除")
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-批量删除")
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:deleteBatch")
|
||||
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
|
||||
mesXslRubberQuickTestMethodService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
|
||||
return Result.OK("批量删除成功!");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-通过id查询")
|
||||
|
||||
@GetMapping(value = "/queryById")
|
||||
|
||||
public Result<MesXslRubberQuickTestMethod> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
|
||||
MesXslRubberQuickTestMethod entity = mesXslRubberQuickTestMethodService.getById(id);
|
||||
|
||||
if (entity == null) {
|
||||
|
||||
return Result.error("未找到对应数据");
|
||||
|
||||
}
|
||||
|
||||
return Result.OK(entity);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-查询明细")
|
||||
|
||||
@GetMapping(value = "/queryLineListByMethodId")
|
||||
|
||||
public Result<List<MesXslRubberQuickTestMethodLine>> queryLineListByMethodId(
|
||||
|
||||
@RequestParam(name = "id", required = true) String id) {
|
||||
|
||||
return Result.OK(mesXslRubberQuickTestMethodService.selectLinesByMethodId(id));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-下一编号")
|
||||
|
||||
@GetMapping(value = "/nextMethodCode")
|
||||
|
||||
public Result<String> nextMethodCode() {
|
||||
|
||||
MesXslRubberQuickTestMethod ctx = new MesXslRubberQuickTestMethod();
|
||||
|
||||
return Result.OK(mesXslRubberQuickTestMethodService.generateNextMethodCode(ctx));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "MES胶料快检实验方法-校验名称唯一")
|
||||
|
||||
@GetMapping(value = "/checkMethodName")
|
||||
|
||||
public Result<?> checkMethodName(
|
||||
|
||||
@RequestParam(name = "methodName") String methodName,
|
||||
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
|
||||
if (oConvertUtils.isEmpty(methodName) || methodName.trim().isEmpty()) {
|
||||
|
||||
return Result.OK();
|
||||
|
||||
}
|
||||
|
||||
MesXslRubberQuickTestMethod ctx = new MesXslRubberQuickTestMethod();
|
||||
|
||||
if (mesXslRubberQuickTestMethodService.isMethodNameDuplicated(methodName.trim(), dataId, ctx)) {
|
||||
|
||||
return Result.error("实验方法名称已存在");
|
||||
|
||||
}
|
||||
|
||||
return Result.OK();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:exportXls")
|
||||
|
||||
@RequestMapping(value = "/exportXls")
|
||||
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestMethod model) {
|
||||
|
||||
return super.exportXls(request, model, MesXslRubberQuickTestMethod.class, "MES胶料快检实验方法");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:importExcel")
|
||||
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
return super.importExcel(request, response, MesXslRubberQuickTestMethod.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
|
||||
|
||||
private String validateForSave(
|
||||
|
||||
MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList, String excludeId) {
|
||||
|
||||
if (main == null) {
|
||||
|
||||
return "参数不能为空";
|
||||
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getMethodName())) {
|
||||
|
||||
return "实验方法名称不能为空";
|
||||
|
||||
}
|
||||
|
||||
main.setMethodName(main.getMethodName().trim());
|
||||
|
||||
if (mesXslRubberQuickTestMethodService.isMethodNameDuplicated(main.getMethodName(), excludeId, main)) {
|
||||
|
||||
return "实验方法名称已存在";
|
||||
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getQuickTestTypeId())) {
|
||||
|
||||
return "请选择实验类型";
|
||||
|
||||
}
|
||||
|
||||
MesXslRubberQuickTestType type = mesXslRubberQuickTestTypeService.getById(main.getQuickTestTypeId());
|
||||
|
||||
if (type == null || isDeleted(type.getDelFlag())) {
|
||||
|
||||
return "实验类型不存在或已删除";
|
||||
|
||||
}
|
||||
|
||||
main.setQuickTestTypeName(type.getTypeName());
|
||||
|
||||
|
||||
|
||||
if (lineList == null || lineList.isEmpty()) {
|
||||
|
||||
return "请通过「选择数据点」至少添加一条明细";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Set<String> pointIds = new HashSet<>();
|
||||
|
||||
int sort = 0;
|
||||
|
||||
for (int i = 0; i < lineList.size(); i++) {
|
||||
|
||||
MesXslRubberQuickTestMethodLine line = lineList.get(i);
|
||||
|
||||
if (line == null) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
int rowNo = i + 1;
|
||||
|
||||
if (oConvertUtils.isEmpty(line.getDataPointId())) {
|
||||
|
||||
return "第 " + rowNo + " 行未选择数据点";
|
||||
|
||||
}
|
||||
|
||||
String pointId = line.getDataPointId().trim();
|
||||
|
||||
if (!pointIds.add(pointId)) {
|
||||
|
||||
return "第 " + rowNo + " 行数据点与前面行重复,同一方法中数据点不能重复";
|
||||
|
||||
}
|
||||
|
||||
MesXslRubberQuickTestDataPoint point = mesXslRubberQuickTestDataPointService.getById(pointId);
|
||||
|
||||
if (point == null || isDeleted(point.getDelFlag())) {
|
||||
|
||||
return "第 " + rowNo + " 行数据点不存在或已删除";
|
||||
|
||||
}
|
||||
|
||||
if (!main.getQuickTestTypeId().equals(point.getQuickTestTypeId())) {
|
||||
|
||||
return "第 " + rowNo + " 行数据点的实验类型与主表实验类型不一致";
|
||||
|
||||
}
|
||||
|
||||
line.setDataPointId(pointId);
|
||||
|
||||
line.setPointName(point.getPointName());
|
||||
|
||||
line.setUnitType(point.getUnitType());
|
||||
|
||||
if (oConvertUtils.isEmpty(line.getTorqueUnitType())) {
|
||||
|
||||
return "第 " + rowNo + " 行请选择扭矩单位类型";
|
||||
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(line.getTimeUnitType())) {
|
||||
|
||||
return "第 " + rowNo + " 行请选择时间单位类型";
|
||||
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(line.getMooneyUnitType())) {
|
||||
|
||||
return "第 " + rowNo + " 行请选择门尼单位类型";
|
||||
|
||||
}
|
||||
|
||||
line.setSortNo(sort++);
|
||||
|
||||
}
|
||||
|
||||
if (pointIds.isEmpty()) {
|
||||
|
||||
return "请通过「选择数据点」至少添加一条明细";
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static boolean isDeleted(Integer delFlag) {
|
||||
|
||||
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
|
||||
|
||||
}
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验类型
|
||||
*/
|
||||
@Tag(name = "MES胶料快检实验类型")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRubberQuickTestType")
|
||||
@Slf4j
|
||||
public class MesXslRubberQuickTestTypeController
|
||||
extends JeecgController<MesXslRubberQuickTestType, IMesXslRubberQuickTestTypeService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
|
||||
|
||||
@Operation(summary = "MES胶料快检实验类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberQuickTestType>> queryPageList(
|
||||
MesXslRubberQuickTestType model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberQuickTestType> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslRubberQuickTestType> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberQuickTestType> pageList = mesXslRubberQuickTestTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验类型-添加")
|
||||
@Operation(summary = "MES胶料快检实验类型-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberQuickTestType model) {
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型新增校验与自动编号-----------
|
||||
if (oConvertUtils.isEmpty(model.getTypeName()) || model.getTypeName().trim().isEmpty()) {
|
||||
return Result.error("实验类型名称不能为空");
|
||||
}
|
||||
model.setTypeName(model.getTypeName().trim());
|
||||
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(model.getTypeName(), null, model)) {
|
||||
return Result.error("实验类型名称已存在");
|
||||
}
|
||||
model.setTypeCode(null);
|
||||
try {
|
||||
mesXslRubberQuickTestTypeService.save(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型新增校验与自动编号-----------
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验类型-编辑")
|
||||
@Operation(summary = "MES胶料快检实验类型-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberQuickTestType model) {
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型编辑仅改名称、编号只读-----------
|
||||
if (oConvertUtils.isEmpty(model.getId())) {
|
||||
return Result.error("缺少主键");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getTypeName()) || model.getTypeName().trim().isEmpty()) {
|
||||
return Result.error("实验类型名称不能为空");
|
||||
}
|
||||
model.setTypeName(model.getTypeName().trim());
|
||||
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(model.getTypeName(), model.getId(), model)) {
|
||||
return Result.error("实验类型名称已存在");
|
||||
}
|
||||
MesXslRubberQuickTestType old = mesXslRubberQuickTestTypeService.getById(model.getId());
|
||||
if (old == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
old.setTypeName(model.getTypeName());
|
||||
try {
|
||||
mesXslRubberQuickTestTypeService.updateById(old);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型编辑仅改名称、编号只读-----------
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验类型-删除")
|
||||
@Operation(summary = "MES胶料快检实验类型-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberQuickTestTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料快检实验类型-批量删除")
|
||||
@Operation(summary = "MES胶料快检实验类型-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberQuickTestTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料快检实验类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberQuickTestType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberQuickTestType entity = mesXslRubberQuickTestTypeService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "预览下一实验类型编号(001起)")
|
||||
@GetMapping(value = "/nextTypeCode")
|
||||
public Result<String> nextTypeCode() {
|
||||
MesXslRubberQuickTestType ctx = new MesXslRubberQuickTestType();
|
||||
return Result.OK(mesXslRubberQuickTestTypeService.generateNextTypeCode(ctx));
|
||||
}
|
||||
|
||||
@Operation(summary = "校验实验类型名称是否重复")
|
||||
@GetMapping(value = "/checkTypeName")
|
||||
public Result<String> checkTypeName(
|
||||
@RequestParam(name = "typeName", required = true) String typeName,
|
||||
@RequestParam(name = "dataId", required = false) String dataId) {
|
||||
if (oConvertUtils.isEmpty(typeName) || typeName.trim().isEmpty()) {
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
MesXslRubberQuickTestType ctx = new MesXslRubberQuickTestType();
|
||||
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(typeName.trim(), dataId, ctx)) {
|
||||
return Result.error("该实验类型名称已存在");
|
||||
}
|
||||
return Result.OK("该值可用!");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestType model) {
|
||||
return super.exportXls(request, model, MesXslRubberQuickTestType.class, "MES胶料快检实验类型");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型导入:名称必填且不重复,编号可空则自动生成-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslRubberQuickTestType> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslRubberQuickTestType.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
Set<String> namesInFile = new HashSet<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslRubberQuickTestType row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getTypeName()) || row.getTypeName().trim().isEmpty()) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条实验类型名称不能为空");
|
||||
}
|
||||
row.setTypeName(row.getTypeName().trim());
|
||||
if (!namesInFile.add(row.getTypeName())) {
|
||||
return Result.error("文件导入失败:实验类型名称【" + row.getTypeName() + "】在导入文件中重复");
|
||||
}
|
||||
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(row.getTypeName(), null, row)) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条实验类型名称【" + row.getTypeName() + "】已存在");
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(row.getTypeCode())) {
|
||||
row.setTypeCode(row.getTypeCode().trim());
|
||||
} else {
|
||||
row.setTypeCode(null);
|
||||
}
|
||||
}
|
||||
for (MesXslRubberQuickTestType row : list) {
|
||||
try {
|
||||
mesXslRubberQuickTestTypeService.save(row);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
log.info("胶料快检实验类型Excel导入完成,行数={}", list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型导入:名称必填且不重复,编号可空则自动生成-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 胶料快检数据点
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_quick_test_data_point")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料快检数据点")
|
||||
public class MesXslRubberQuickTestDataPoint implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "数据点名称", width = 24)
|
||||
@Schema(description = "数据点名称(同租户未删除唯一)")
|
||||
private String pointName;
|
||||
|
||||
@Excel(name = "实验类型", width = 20, dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
@Dict(dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
@Schema(description = "实验类型ID")
|
||||
private String quickTestTypeId;
|
||||
|
||||
@Excel(name = "实验类型名称", width = 20)
|
||||
@Schema(description = "实验类型名称冗余")
|
||||
private String quickTestTypeName;
|
||||
|
||||
@Excel(name = "单位类型", width = 16)
|
||||
@Schema(description = "单位类型(手填)")
|
||||
private String unitType;
|
||||
|
||||
@Excel(name = "描述", width = 40)
|
||||
@Schema(description = "描述")
|
||||
private String pointDesc;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Excel(name = "实验类型名称导入", width = 20)
|
||||
@Schema(description = "导入用实验类型名称")
|
||||
private String importQuickTestTypeName;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableLogic
|
||||
@Schema(description = "删除状态(0正常 1已删除)")
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法主表
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@TableName("mes_xsl_rubber_quick_test_method")
|
||||
|
||||
@Accessors(chain = true)
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
@Schema(description = "MES胶料快检实验方法")
|
||||
|
||||
public class MesXslRubberQuickTestMethod implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "方法编号", width = 14)
|
||||
|
||||
@Schema(description = "方法编号(租户内从001递增自动生成,只读)")
|
||||
|
||||
private String methodCode;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验方法名称", width = 24)
|
||||
|
||||
@Schema(description = "实验方法名称(同租户未删除唯一)")
|
||||
|
||||
private String methodName;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验类型", width = 20, dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
|
||||
@Dict(dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
|
||||
|
||||
@Schema(description = "实验类型ID")
|
||||
|
||||
private String quickTestTypeId;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验类型名称", width = 20)
|
||||
|
||||
@Schema(description = "实验类型名称冗余")
|
||||
|
||||
private String quickTestTypeName;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验温度°C", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验温度°C")
|
||||
|
||||
private BigDecimal testTempC;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "预热时间min", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "预热时间min")
|
||||
|
||||
private BigDecimal preheatTimeMin;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验时间min", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验时间min")
|
||||
|
||||
private BigDecimal testTimeMin;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验角度Deg", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验角度Deg")
|
||||
|
||||
private BigDecimal testAngleDeg;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "实验频率Hz", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "实验频率Hz")
|
||||
|
||||
private BigDecimal testFreqHz;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "转子类型", width = 12, dicCode = "xslmes_rubber_quick_test_rotor_type")
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_rotor_type")
|
||||
|
||||
@Schema(description = "转子类型(字典xslmes_rubber_quick_test_rotor_type)")
|
||||
|
||||
private String rotorType;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "转子速度rpm", width = 14, type = 10)
|
||||
|
||||
@Schema(description = "转子速度rpm")
|
||||
|
||||
private BigDecimal rotorSpeedRpm;
|
||||
|
||||
|
||||
|
||||
@Excel(name = "方法描述", width = 40)
|
||||
|
||||
@Schema(description = "方法描述")
|
||||
|
||||
private String methodDesc;
|
||||
|
||||
|
||||
|
||||
private Integer tenantId;
|
||||
|
||||
private String sysOrgCode;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
||||
@TableLogic
|
||||
|
||||
@Schema(description = "删除状态(0正常 1已删除)")
|
||||
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@Schema(description = "数据点明细")
|
||||
|
||||
private List<MesXslRubberQuickTestMethodLine> lineList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* MES 胶料快检实验方法明细
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@TableName("mes_xsl_rubber_quick_test_method_line")
|
||||
|
||||
@Accessors(chain = true)
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
@Schema(description = "MES胶料快检实验方法明细")
|
||||
|
||||
public class MesXslRubberQuickTestMethodLine implements Serializable {
|
||||
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_method.id")
|
||||
|
||||
private String methodId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "数据点主键 mes_xsl_rubber_quick_test_data_point.id")
|
||||
|
||||
private String dataPointId;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "数据点名称冗余(只读带出)")
|
||||
|
||||
private String pointName;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "单位类型冗余(只读带出)")
|
||||
|
||||
private String unitType;
|
||||
|
||||
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_torque_unit")
|
||||
|
||||
@Schema(description = "扭矩单位类型")
|
||||
|
||||
private String torqueUnitType;
|
||||
|
||||
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_time_unit")
|
||||
|
||||
@Schema(description = "时间单位类型")
|
||||
|
||||
private String timeUnitType;
|
||||
|
||||
|
||||
|
||||
@Dict(dicCode = "xslmes_rubber_quick_test_mooney_unit")
|
||||
|
||||
@Schema(description = "门尼单位类型")
|
||||
|
||||
private String mooneyUnitType;
|
||||
|
||||
|
||||
|
||||
private Integer sortNo;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验类型
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_quick_test_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料快检实验类型")
|
||||
public class MesXslRubberQuickTestType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "实验类型编号", width = 16)
|
||||
@Schema(description = "实验类型编号(租户内从001递增自动生成,只读)")
|
||||
private String typeCode;
|
||||
|
||||
@Excel(name = "实验类型名称", width = 24)
|
||||
@Schema(description = "实验类型名称")
|
||||
private String typeName;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableLogic
|
||||
@Schema(description = "删除状态(0正常 1已删除)")
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
|
||||
|
||||
/**
|
||||
* MES 胶料快检数据点 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslRubberQuickTestDataPointMapper extends BaseMapper<MesXslRubberQuickTestDataPoint> {}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
|
||||
|
||||
@Mapper
|
||||
|
||||
public interface MesXslRubberQuickTestMethodLineMapper extends BaseMapper<MesXslRubberQuickTestMethodLine> {}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
|
||||
|
||||
@Mapper
|
||||
|
||||
public interface MesXslRubberQuickTestMethodMapper extends BaseMapper<MesXslRubberQuickTestMethod> {
|
||||
|
||||
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法租户内最大三位数字编号-----------
|
||||
|
||||
@Select(
|
||||
|
||||
"SELECT IFNULL(MAX(CAST(method_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_quick_test_method "
|
||||
|
||||
+ "WHERE del_flag = 0 AND method_code REGEXP '^[0-9]+$' "
|
||||
|
||||
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
|
||||
|
||||
Integer selectMaxNumericMethodCode(@Param("tenantId") Integer tenantId);
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法租户内最大三位数字编号-----------
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
|
||||
/**
|
||||
* MES 胶料快检实验类型 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslRubberQuickTestTypeMapper extends BaseMapper<MesXslRubberQuickTestType> {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型租户内最大三位数字编号-----------
|
||||
@Select(
|
||||
"SELECT IFNULL(MAX(CAST(type_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_quick_test_type "
|
||||
+ "WHERE del_flag = 0 AND type_code REGEXP '^[0-9]+$' "
|
||||
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
|
||||
Integer selectMaxNumericTypeCode(@Param("tenantId") Integer tenantId);
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型租户内最大三位数字编号-----------
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
|
||||
|
||||
public interface IMesXslRubberQuickTestDataPointService extends IService<MesXslRubberQuickTestDataPoint> {
|
||||
|
||||
boolean isPointNameDuplicated(String pointName, String excludeId, MesXslRubberQuickTestDataPoint context);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
|
||||
|
||||
public interface IMesXslRubberQuickTestMethodService extends IService<MesXslRubberQuickTestMethod> {
|
||||
|
||||
|
||||
|
||||
String generateNextMethodCode(MesXslRubberQuickTestMethod context);
|
||||
|
||||
|
||||
|
||||
boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context);
|
||||
|
||||
|
||||
|
||||
void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList);
|
||||
|
||||
|
||||
|
||||
void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList);
|
||||
|
||||
|
||||
|
||||
void delMain(String id);
|
||||
|
||||
|
||||
|
||||
void delBatchMain(Collection<? extends Serializable> idList);
|
||||
|
||||
|
||||
|
||||
List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
|
||||
public interface IMesXslRubberQuickTestTypeService extends IService<MesXslRubberQuickTestType> {
|
||||
|
||||
/**
|
||||
* 生成下一实验类型编号(001 起,三位数字,租户维度)
|
||||
*/
|
||||
String generateNextTypeCode(MesXslRubberQuickTestType context);
|
||||
|
||||
/**
|
||||
* 实验类型名称是否重复(仅未删除数据,同租户)
|
||||
*/
|
||||
boolean isTypeNameDuplicated(String typeName, String excludeId, MesXslRubberQuickTestType context);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestDataPointMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberQuickTestDataPointServiceImpl
|
||||
extends ServiceImpl<MesXslRubberQuickTestDataPointMapper, MesXslRubberQuickTestDataPoint>
|
||||
implements IMesXslRubberQuickTestDataPointService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点名称同租户唯一-----------
|
||||
@Override
|
||||
public boolean isPointNameDuplicated(String pointName, String excludeId, MesXslRubberQuickTestDataPoint context) {
|
||||
if (oConvertUtils.isEmpty(pointName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestDataPoint> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberQuickTestDataPoint::getPointName, pointName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslRubberQuickTestDataPoint::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslRubberQuickTestDataPoint::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslRubberQuickTestDataPoint::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslRubberQuickTestDataPoint::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean save(MesXslRubberQuickTestDataPoint entity) {
|
||||
assertPointNameUniqueForSave(entity, null);
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateById(MesXslRubberQuickTestDataPoint entity) {
|
||||
if (oConvertUtils.isEmpty(entity.getId())) {
|
||||
throw new JeecgBootException("缺少主键");
|
||||
}
|
||||
assertPointNameUniqueForSave(entity, entity.getId());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
private void assertPointNameUniqueForSave(MesXslRubberQuickTestDataPoint entity, String excludeId) {
|
||||
if (entity == null || oConvertUtils.isEmpty(entity.getPointName())) {
|
||||
throw new JeecgBootException("数据点名称不能为空");
|
||||
}
|
||||
String name = entity.getPointName().trim();
|
||||
entity.setPointName(name);
|
||||
if (isPointNameDuplicated(name, excludeId, entity)) {
|
||||
throw new JeecgBootException("数据点名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslRubberQuickTestDataPoint context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检数据点名称同租户唯一-----------
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
|
||||
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper;
|
||||
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
|
||||
@Service
|
||||
|
||||
public class MesXslRubberQuickTestMethodServiceImpl
|
||||
|
||||
extends ServiceImpl<MesXslRubberQuickTestMethodMapper, MesXslRubberQuickTestMethod>
|
||||
|
||||
implements IMesXslRubberQuickTestMethodService {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
|
||||
private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper;
|
||||
|
||||
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
|
||||
|
||||
@Override
|
||||
|
||||
public String generateNextMethodCode(MesXslRubberQuickTestMethod context) {
|
||||
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
Integer max = baseMapper.selectMaxNumericMethodCode(tenantId);
|
||||
|
||||
int next = (max == null ? 0 : max) + 1;
|
||||
|
||||
if (next > 999) {
|
||||
|
||||
throw new IllegalStateException("实验方法编号已超过999,请联系管理员");
|
||||
|
||||
}
|
||||
|
||||
return String.format("%03d", next);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) {
|
||||
|
||||
if (oConvertUtils.isEmpty(methodName)) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestMethod> w = new LambdaQueryWrapper<>();
|
||||
|
||||
w.eq(MesXslRubberQuickTestMethod::getMethodName, methodName.trim());
|
||||
|
||||
w.and(
|
||||
|
||||
q ->
|
||||
|
||||
q.eq(MesXslRubberQuickTestMethod::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
|
||||
.or()
|
||||
|
||||
.isNull(MesXslRubberQuickTestMethod::getDelFlag));
|
||||
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
|
||||
w.ne(MesXslRubberQuickTestMethod::getId, excludeId);
|
||||
|
||||
}
|
||||
|
||||
if (tenantId != null) {
|
||||
|
||||
w.eq(MesXslRubberQuickTestMethod::getTenantId, tenantId);
|
||||
|
||||
}
|
||||
|
||||
return this.count(w) > 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
assertMethodNameUniqueForSave(main, null);
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getMethodCode())) {
|
||||
|
||||
main.setMethodCode(generateNextMethodCode(main));
|
||||
|
||||
}
|
||||
|
||||
this.save(main);
|
||||
|
||||
insertLines(main.getId(), lineList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
if (oConvertUtils.isEmpty(main.getId())) {
|
||||
|
||||
throw new JeecgBootException("缺少主键");
|
||||
|
||||
}
|
||||
|
||||
MesXslRubberQuickTestMethod old = this.getById(main.getId());
|
||||
|
||||
if (old == null) {
|
||||
|
||||
throw new JeecgBootException("实验方法不存在");
|
||||
|
||||
}
|
||||
|
||||
main.setMethodCode(old.getMethodCode());
|
||||
|
||||
assertMethodNameUniqueForSave(main, main.getId());
|
||||
|
||||
this.updateById(main);
|
||||
|
||||
mesXslRubberQuickTestMethodLineMapper.delete(
|
||||
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
|
||||
|
||||
.eq(MesXslRubberQuickTestMethodLine::getMethodId, main.getId()));
|
||||
|
||||
insertLines(main.getId(), lineList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void insertLines(String methodId, List<MesXslRubberQuickTestMethodLine> lineList) {
|
||||
|
||||
if (CollectionUtils.isEmpty(lineList)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int sort = 0;
|
||||
|
||||
for (MesXslRubberQuickTestMethodLine line : lineList) {
|
||||
|
||||
line.setId(null);
|
||||
|
||||
line.setMethodId(methodId);
|
||||
|
||||
line.setSortNo(sort++);
|
||||
|
||||
mesXslRubberQuickTestMethodLineMapper.insert(line);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void delMain(String id) {
|
||||
|
||||
mesXslRubberQuickTestMethodLineMapper.delete(
|
||||
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
|
||||
|
||||
.eq(MesXslRubberQuickTestMethodLine::getMethodId, id));
|
||||
|
||||
this.removeById(id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
|
||||
for (Serializable id : idList) {
|
||||
|
||||
delMain(id.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId) {
|
||||
|
||||
return mesXslRubberQuickTestMethodLineMapper.selectList(
|
||||
|
||||
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
|
||||
|
||||
.eq(MesXslRubberQuickTestMethodLine::getMethodId, methodId)
|
||||
|
||||
.orderByAsc(MesXslRubberQuickTestMethodLine::getSortNo));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void assertMethodNameUniqueForSave(MesXslRubberQuickTestMethod entity, String excludeId) {
|
||||
|
||||
if (entity == null || oConvertUtils.isEmpty(entity.getMethodName())) {
|
||||
|
||||
throw new JeecgBootException("实验方法名称不能为空");
|
||||
|
||||
}
|
||||
|
||||
String name = entity.getMethodName().trim();
|
||||
|
||||
entity.setMethodName(name);
|
||||
|
||||
if (isMethodNameDuplicated(name, excludeId, entity)) {
|
||||
|
||||
throw new JeecgBootException("实验方法名称已存在");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Integer resolveTenantId(MesXslRubberQuickTestMethod context) {
|
||||
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
|
||||
return context.getTenantId();
|
||||
|
||||
}
|
||||
|
||||
String ts = TenantContext.getTenant();
|
||||
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
|
||||
try {
|
||||
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
return Integer.parseInt(ts.trim());
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import org.jeecg.common.util.TokenUtils;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestTypeMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberQuickTestTypeServiceImpl
|
||||
extends ServiceImpl<MesXslRubberQuickTestTypeMapper, MesXslRubberQuickTestType>
|
||||
implements IMesXslRubberQuickTestTypeService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型编号001递增、名称同租户唯一-----------
|
||||
@Override
|
||||
public String generateNextTypeCode(MesXslRubberQuickTestType context) {
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
Integer max = baseMapper.selectMaxNumericTypeCode(tenantId);
|
||||
int next = (max == null ? 0 : max) + 1;
|
||||
if (next > 999) {
|
||||
throw new IllegalStateException("实验类型编号已超过999,请联系管理员");
|
||||
}
|
||||
return String.format("%03d", next);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTypeNameDuplicated(String typeName, String excludeId, MesXslRubberQuickTestType context) {
|
||||
if (oConvertUtils.isEmpty(typeName)) {
|
||||
return false;
|
||||
}
|
||||
Integer tenantId = resolveTenantId(context);
|
||||
LambdaQueryWrapper<MesXslRubberQuickTestType> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberQuickTestType::getTypeName, typeName.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslRubberQuickTestType::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslRubberQuickTestType::getDelFlag));
|
||||
if (oConvertUtils.isNotEmpty(excludeId)) {
|
||||
w.ne(MesXslRubberQuickTestType::getId, excludeId);
|
||||
}
|
||||
if (tenantId != null) {
|
||||
w.eq(MesXslRubberQuickTestType::getTenantId, tenantId);
|
||||
}
|
||||
return this.count(w) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean save(MesXslRubberQuickTestType entity) {
|
||||
assertTypeNameUniqueForSave(entity, null);
|
||||
if (oConvertUtils.isEmpty(entity.getTypeCode())) {
|
||||
entity.setTypeCode(generateNextTypeCode(entity));
|
||||
}
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateById(MesXslRubberQuickTestType entity) {
|
||||
if (oConvertUtils.isEmpty(entity.getId())) {
|
||||
throw new JeecgBootException("缺少主键");
|
||||
}
|
||||
assertTypeNameUniqueForSave(entity, entity.getId());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
private void assertTypeNameUniqueForSave(MesXslRubberQuickTestType entity, String excludeId) {
|
||||
if (entity == null || oConvertUtils.isEmpty(entity.getTypeName())) {
|
||||
throw new JeecgBootException("实验类型名称不能为空");
|
||||
}
|
||||
String name = entity.getTypeName().trim();
|
||||
entity.setTypeName(name);
|
||||
if (isTypeNameDuplicated(name, excludeId, entity)) {
|
||||
throw new JeecgBootException("实验类型名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer resolveTenantId(MesXslRubberQuickTestType context) {
|
||||
if (context != null && context.getTenantId() != null) {
|
||||
return context.getTenantId();
|
||||
}
|
||||
String ts = TenantContext.getTenant();
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
try {
|
||||
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
if (oConvertUtils.isEmpty(ts)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(ts.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20260522 for:【MES】胶料快检实验类型编号001递增、名称同租户唯一-----------
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* 胶料快检实验方法主子保存页 VO
|
||||
|
||||
*/
|
||||
|
||||
@Data
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
public class MesXslRubberQuickTestMethodPage extends MesXslRubberQuickTestMethod {}
|
||||
|
||||
@@ -418,3 +418,53 @@ jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecor
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordHandleModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型:质量管理目录、001自动编号、CRUD与菜单权限 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_97__mes_xsl_rubber_quick_test_type.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-type-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestType.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestTypeMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestTypeService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/components/MesXslRubberQuickTestTypeModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法:质量管理菜单、001编号、名称唯一、关联实验类型 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_99__mes_xsl_rubber_quick_test_method.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-method-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethod.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestMethodService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestMethodServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】撤销胶料快检实验方法功能(删代码+库清理脚本)---
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-method-drop.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_100__drop_mes_xsl_rubber_quick_test_method.sql
|
||||
(已删除 MesXslRubberQuickTestMethod 后端与前端、mes-xsl-rubber-quick-test-method-menu-permission.sql)
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检数据点:质量管理菜单、名称唯一、关联实验类型、单位手填 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_101__mes_xsl_rubber_quick_test_data_point.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-quick-test-data-point-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestDataPoint.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestDataPointMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestDataPointService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestDataPointServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestDataPointController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/components/MesXslRubberQuickTestDataPointModal.vue
|
||||
|
||||
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型名称同租户不可重复(Service兜底+唯一索引)---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_98__mes_xsl_rubber_quick_test_type_name_unique.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
-- 撤销胶料快检实验方法(与 db/mes-xsl-rubber-quick-test-method-drop.sql 一致)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
DELETE FROM `sys_role_permission`
|
||||
WHERE `permission_id` IN (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173',
|
||||
'1860000000000000174', '1860000000000000175', '1860000000000000176'
|
||||
);
|
||||
|
||||
DELETE FROM `sys_permission`
|
||||
WHERE `id` IN (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173',
|
||||
'1860000000000000174', '1860000000000000175', '1860000000000000176'
|
||||
);
|
||||
|
||||
DELETE di FROM `sys_dict_item` di
|
||||
INNER JOIN `sys_dict` d ON di.`dict_id` = d.`id`
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND d.`del_flag` = 0;
|
||||
|
||||
DELETE FROM `sys_dict`
|
||||
WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type';
|
||||
|
||||
DROP TABLE IF EXISTS `mes_xsl_rubber_quick_test_method`;
|
||||
@@ -0,0 +1,66 @@
|
||||
-- MES 胶料快检数据点:建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_data_point:*
|
||||
-- 依赖:mes_xsl_rubber_quick_test_type、质量管理目录 id 1860000000000000162
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_data_point` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`point_name` varchar(128) NOT NULL COMMENT '数据点名称(同租户未删除唯一)',
|
||||
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
|
||||
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型(手填)',
|
||||
`point_desc` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||
`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_mrqtdp_tenant_type` (`tenant_id`, `quick_test_type_id`),
|
||||
UNIQUE KEY `uk_mrqtdp_tenant_name_del` (`tenant_id`, `point_name`, `del_flag`)
|
||||
) 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 ('1860000000000000170', @mes_quality_pid, '胶料快检数据点', '/xslmes/mesXslRubberQuickTestDataPoint', 'xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList', 'MesXslRubberQuickTestDataPointList', 1, NULL, '1', 2, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:dot-chart-outlined' WHERE `id` = '1860000000000000170' 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
|
||||
('1860000000000000171', '1860000000000000170', '新增', 2, 'mes:mes_xsl_rubber_quick_test_data_point:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000172', '1860000000000000170', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_data_point:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000173', '1860000000000000170', '删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000174', '1860000000000000170', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000175', '1860000000000000170', '导出', 2, 'mes:mes_xsl_rubber_quick_test_data_point:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000176', '1860000000000000170', '导入', 2, 'mes:mes_xsl_rubber_quick_test_data_point: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 (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173', '1860000000000000174',
|
||||
'1860000000000000175', '1860000000000000176'
|
||||
)
|
||||
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,292 @@
|
||||
-- MES 胶料快检实验方法(主子表):字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_method:*
|
||||
|
||||
-- 菜单 ID 段 1860000000000000177(避免与数据点 170 段冲突)
|
||||
|
||||
-- 依赖:mes_xsl_rubber_quick_test_type、mes_xsl_rubber_quick_test_data_point、质量管理目录
|
||||
|
||||
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_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_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, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||
|
||||
|
||||
|
||||
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_quick_test_torque_unit', 'Ib.in、dNm、kg.cm、Nm、mdm', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
|
||||
FROM `sys_dict` d
|
||||
|
||||
CROSS JOIN (
|
||||
|
||||
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
|
||||
|
||||
SELECT 'dNm', 'dNm', 2 UNION ALL
|
||||
|
||||
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
|
||||
|
||||
SELECT 'Nm', 'Nm', 4 UNION ALL
|
||||
|
||||
SELECT 'mdm', 'mdm', 5
|
||||
|
||||
) v
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
|
||||
|
||||
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_quick_test_time_unit', 'sec、min、m:s', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' 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, v.txt, v.val, v.ord, 1, 'admin', NOW()
|
||||
|
||||
FROM `sys_dict` d
|
||||
|
||||
CROSS JOIN (
|
||||
|
||||
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
|
||||
|
||||
SELECT 'min', 'min', 2 UNION ALL
|
||||
|
||||
SELECT 'm:s', 'm:s', 3
|
||||
|
||||
) v
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
|
||||
|
||||
|
||||
|
||||
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_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0
|
||||
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' 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, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit'
|
||||
|
||||
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU');
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_code` varchar(16) NOT NULL COMMENT '方法编号(租户内从001递增自动生成)',
|
||||
|
||||
`method_name` varchar(128) NOT NULL COMMENT '实验方法名称(同租户未删除唯一)',
|
||||
|
||||
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
|
||||
|
||||
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
|
||||
|
||||
`preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min',
|
||||
|
||||
`test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min',
|
||||
|
||||
`test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg',
|
||||
|
||||
`test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
|
||||
|
||||
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型(字典xslmes_rubber_quick_test_rotor_type:1大转子2小转子)',
|
||||
|
||||
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
|
||||
|
||||
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
|
||||
|
||||
`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_mrqtm_tenant_code` (`tenant_id`, `method_code`),
|
||||
|
||||
KEY `idx_mrqtm_type` (`quick_test_type_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` (
|
||||
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
|
||||
`method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id',
|
||||
|
||||
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
|
||||
|
||||
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余(只读带出)',
|
||||
|
||||
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余(只读带出)',
|
||||
|
||||
`torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型(字典xslmes_rubber_quick_test_torque_unit)',
|
||||
|
||||
`time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型(字典xslmes_rubber_quick_test_time_unit)',
|
||||
|
||||
`mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型(字典xslmes_rubber_quick_test_mooney_unit)',
|
||||
|
||||
`sort_no` int 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 '更新时间',
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
|
||||
KEY `idx_mrqtml_method` (`method_id`),
|
||||
|
||||
UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`)
|
||||
|
||||
) 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 ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' 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
|
||||
|
||||
('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
|
||||
('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method: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 (
|
||||
|
||||
'1860000000000000177',
|
||||
|
||||
'1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181',
|
||||
|
||||
'1860000000000000182', '1860000000000000183'
|
||||
|
||||
)
|
||||
|
||||
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_quick_test_type:*
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_type` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`type_code` varchar(16) NOT NULL COMMENT '实验类型编号(租户内从001递增自动生成)',
|
||||
`type_name` varchar(128) NOT NULL COMMENT '实验类型名称',
|
||||
`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_mrqtt_tenant_code` (`tenant_id`, `type_code`),
|
||||
KEY `idx_mrqtt_tenant_name` (`tenant_id`, `type_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验类型';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_root_parent = (
|
||||
SELECT `parent_id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_root_parent = IFNULL(@mes_root_parent, (
|
||||
SELECT `parent_id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
|
||||
LIMIT 1
|
||||
));
|
||||
SET @mes_root_parent = IFNULL(@mes_root_parent, '1860000000000000001');
|
||||
|
||||
SET @mes_quality_sort = IFNULL((
|
||||
SELECT `sort_no` + 1 FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料', '设备管理')
|
||||
ORDER BY `sort_no` DESC
|
||||
LIMIT 1
|
||||
), 52);
|
||||
|
||||
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 ('1860000000000000162', @mes_root_parent, '质量管理', '/xslmes/quality', 'layouts/RouteView', 'MesQualityLayout', 0, NULL, '1', @mes_quality_sort, 1, 0, 0, '1', 0, 0, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
|
||||
`menu_type` = VALUES(`menu_type`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:safety-certificate-outlined' WHERE `id` = '1860000000000000162' AND `del_flag` = 0;
|
||||
|
||||
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 ('1860000000000000163', '1860000000000000162', '胶料快检实验类型', '/xslmes/mesXslRubberQuickTestType', 'xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList', 'MesXslRubberQuickTestTypeList', 1, NULL, '1', 1, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:experiment-outlined' WHERE `id` = '1860000000000000163' 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
|
||||
('1860000000000000164', '1860000000000000163', '新增', 2, 'mes:mes_xsl_rubber_quick_test_type:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000165', '1860000000000000163', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_type:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000166', '1860000000000000163', '删除', 2, 'mes:mes_xsl_rubber_quick_test_type:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000167', '1860000000000000163', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000168', '1860000000000000163', '导出', 2, 'mes:mes_xsl_rubber_quick_test_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000169', '1860000000000000163', '导入', 2, 'mes:mes_xsl_rubber_quick_test_type: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 (
|
||||
'1860000000000000162',
|
||||
'1860000000000000163',
|
||||
'1860000000000000164', '1860000000000000165', '1860000000000000166', '1860000000000000167',
|
||||
'1860000000000000168', '1860000000000000169'
|
||||
)
|
||||
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,20 @@
|
||||
-- 胶料快检实验类型:同租户未删除数据实验类型名称唯一(del_flag 参与唯一键,逻辑删除后可复用名称)
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @idx_exists = (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = DATABASE()
|
||||
AND table_name = 'mes_xsl_rubber_quick_test_type'
|
||||
AND index_name = 'uk_mrqtt_tenant_name_del'
|
||||
);
|
||||
|
||||
SET @ddl = IF(
|
||||
@idx_exists = 0,
|
||||
'ALTER TABLE `mes_xsl_rubber_quick_test_type` ADD UNIQUE KEY `uk_mrqtt_tenant_name_del` (`tenant_id`, `type_name`, `del_flag`)',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @ddl;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,85 @@
|
||||
-- MES 胶料快检实验方法:字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_rubber_quick_test_method:*
|
||||
-- 依赖:mes_xsl_rubber_quick_test_type、质量管理目录 id 1860000000000000162
|
||||
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_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_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, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`method_code` varchar(16) NOT NULL COMMENT '方法编号(租户内从001递增自动生成)',
|
||||
`method_name` varchar(128) NOT NULL COMMENT '实验方法名称(同租户未删除唯一)',
|
||||
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
|
||||
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
|
||||
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
|
||||
`preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min',
|
||||
`test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min',
|
||||
`test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg',
|
||||
`test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
|
||||
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型(字典xslmes_rubber_quick_test_rotor_type:1大转子2小转子)',
|
||||
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
|
||||
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
|
||||
`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_mrqtm_tenant_code` (`tenant_id`, `method_code`),
|
||||
KEY `idx_mrqtm_type` (`quick_test_type_id`),
|
||||
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
|
||||
) 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 ('1860000000000000170', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 2, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000170' 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
|
||||
('1860000000000000171', '1860000000000000170', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000172', '1860000000000000170', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000173', '1860000000000000170', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000174', '1860000000000000170', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000175', '1860000000000000170', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000176', '1860000000000000170', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method: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 (
|
||||
'1860000000000000170',
|
||||
'1860000000000000171', '1860000000000000172', '1860000000000000173', '1860000000000000174',
|
||||
'1860000000000000175', '1860000000000000176'
|
||||
)
|
||||
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