日志表sql文件修改

This commit is contained in:
jiangs 2025-08-20 11:41:30 +08:00
parent dfa976ce6a
commit f06c9ec563

View File

@ -798,7 +798,7 @@ if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_
-- ---------------------------- -- ----------------------------
-- 初始化-部门表数据 -- 初始化-部门表数据
-- ---------------------------- -- ----------------------------
SET IDENTITY_INSERT dbo.sys_dept ON;
if not exists(select 1 from dbo.sys_dept where dept_id = '100' and parent_id = '0') if not exists(select 1 from dbo.sys_dept where dept_id = '100' and parent_id = '0')
begin begin
INSERT INTO dbo.sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) INSERT INTO dbo.sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time)
@ -817,7 +817,7 @@ if not exists(select 1 from dbo.sys_dept where dept_id = '103' and parent_id = '
VALUES (103, 101, '0,100,101', '临检组', 1, 'lis', '15888888888', null, '0', '0', 'admin', '2025-05-05 11:09:44.197', '', NULL) VALUES (103, 101, '0,100,101', '临检组', 1, 'lis', '15888888888', null, '0', '0', 'admin', '2025-05-05 11:09:44.197', '', NULL)
end end
SET IDENTITY_INSERT dbo.sys_dept OFF;
-- ---------------------------- -- ----------------------------
-- 2、用户信息表 -- 2、用户信息表
-- ---------------------------- -- ----------------------------
@ -850,7 +850,7 @@ if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_
-- ---------------------------- -- ----------------------------
-- 初始化-用户信息表数据 -- 初始化-用户信息表数据
-- ---------------------------- -- ----------------------------
SET IDENTITY_INSERT dbo.sys_user ON;
if not exists(select 1 from dbo.sys_user where user_id = '1') if not exists(select 1 from dbo.sys_user where user_id = '1')
begin begin
INSERT INTO dbo.sys_user (user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) INSERT INTO dbo.sys_user (user_id, dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark)
@ -864,7 +864,7 @@ if not exists(select 1 from dbo.sys_user where user_id = '2')
VALUES (2, 103, 'ry', '管理员1', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', '2025-05-05 11:37:08.193', 'admin', '2025-05-05 11:37:08.193', '', NULL, '测试员') VALUES (2, 103, 'ry', '管理员1', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', '2025-05-05 11:37:08.193', 'admin', '2025-05-05 11:37:08.193', '', NULL, '测试员')
end end
SET IDENTITY_INSERT dbo.sys_user OFF;
-- ---------------------------- -- ----------------------------
-- 3、岗位信息表 -- 3、岗位信息表
-- ---------------------------- -- ----------------------------
@ -889,7 +889,7 @@ if not exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_
-- ---------------------------- -- ----------------------------
-- 初始化-岗位信息表数据 -- 初始化-岗位信息表数据
-- ---------------------------- -- ----------------------------
SET IDENTITY_INSERT dbo.sys_post ON;
if not exists(select 1 from dbo.sys_post where post_id = '1') if not exists(select 1 from dbo.sys_post where post_id = '1')
begin begin
INSERT INTO dbo.sys_post (post_id, post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark) INSERT INTO dbo.sys_post (post_id, post_code, post_name, post_sort, status, create_by, create_time, update_by, update_time, remark)
@ -917,7 +917,7 @@ if not exists(select 1 from dbo.sys_post where post_id = '4')
VALUES (4, 'user', '普通员工', 4, '0', 'admin', '2025-05-05 11:38:34.44', '', NULL, '') VALUES (4, 'user', '普通员工', 4, '0', 'admin', '2025-05-05 11:38:34.44', '', NULL, '')
end end
SET IDENTITY_INSERT dbo.sys_post OFF;
-- ---------------------------- -- ----------------------------
-- 8、角色和部门关联表 角色1-N部门 -- 8、角色和部门关联表 角色1-N部门
-- ---------------------------- -- ----------------------------
@ -1592,3 +1592,60 @@ if not exists(select 1 from dbo.sys_job where invoke_target = 'lisTask.getXmFee'
VALUES ('获取his收费项目', 'DEFAULT', 'lisTask.getXmFee', '0 0 23 * * ?', '3', '1', '1', 'admin', '2025-08-15 11:58:04.853', '', NULL, '') VALUES ('获取his收费项目', 'DEFAULT', 'lisTask.getXmFee', '0 0 23 * * ?', '3', '1', '1', 'admin', '2025-08-15 11:58:04.853', '', NULL, '')
end end
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE name LIKE '%DF__sys_oper___json%' AND type = 'D' AND parent_obj = OBJECT_ID(N'[dbo].[sys_oper_log]'))
begin
DECLARE @constraintName NVARCHAR(128)
SELECT @constraintName = name
FROM dbo.sysobjects
WHERE
name LIKE '%DF__sys_oper___json%'
AND type = 'D'
AND parent_obj = OBJECT_ID(N'[dbo].[sys_oper_log]')
-- 动态执行删除约束(因约束名称是变量,需用动态SQL)
EXEC('ALTER TABLE [dbo].[sys_oper_log] DROP CONSTRAINT [' + @constraintName + ']')
end
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE name LIKE '%DF__sys_oper___oper%' AND type = 'D' AND parent_obj = OBJECT_ID(N'[dbo].[sys_oper_log]'))
begin
SELECT @constraintName = name
FROM dbo.sysobjects
WHERE
name LIKE '%DF__sys_oper___oper%'
AND type = 'D'
AND parent_obj = OBJECT_ID(N'[dbo].[sys_oper_log]')
-- 动态执行删除约束(因约束名称是变量,需用动态SQL)
EXEC('ALTER TABLE [dbo].[sys_oper_log] DROP CONSTRAINT [' + @constraintName + ']')
end
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE name LIKE '%DF__sys_oper___error%' AND type = 'D' AND parent_obj = OBJECT_ID(N'[dbo].[sys_oper_log]'))
begin
SELECT @constraintName = name
FROM dbo.sysobjects
WHERE
name LIKE '%DF__sys_oper___error%'
AND type = 'D'
AND parent_obj = OBJECT_ID(N'[dbo].[sys_oper_log]')
-- 动态执行删除约束(因约束名称是变量,需用动态SQL)
EXEC('ALTER TABLE [dbo].[sys_oper_log] DROP CONSTRAINT [' + @constraintName + ']')
end
if exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_oper_log' AND COLUMN_NAME = 'oper_param')
begin
alter table sys_oper_log ALTER COLUMN oper_param nvarchar(max)
end
if exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_oper_log' AND COLUMN_NAME = 'json_result')
begin
alter table sys_oper_log ALTER COLUMN json_result nvarchar(max)
end
if exists(SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'sys_oper_log' AND COLUMN_NAME = 'error_msg')
begin
alter table sys_oper_log ALTER COLUMN error_msg nvarchar(max)
end