weaver-hrm-salary/resource/sqlupgrade/Mysql/sql202304270203.sql

244 lines
9.8 KiB
SQL

create table hrsa_sub_table
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
sub_table_name varchar(100) not null comment '表名' ,
dimension varchar(20) not null comment '统计维度' ,
start_month varchar(10) comment '开始月' ,
end_month varchar(10) comment '终止月' ,
pay_org_string varchar(500) comment '个税扣缴义务人高级搜索' ,
pay_agency_string varchar(500) comment '缴纳组织高级搜索' ,
sub_company_string varchar(500) comment '分部高级搜索' ,
depart_string varchar(500) comment '部门高级搜索' ,
grade_string varchar(500) comment '职级高级搜索' ,
position_string varchar(500) comment '岗位高级搜索' ,
status_string varchar(500) comment '人员状态高级搜索' ,
employee_type varchar(500) comment '人员类型高级搜索' ,
employee_string varchar(500) comment '人员高级搜索' ,
payment_type_string varchar(100) comment '缴纳类型'
)
;
create table hrsa_sub_table_item
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
table_id bigint not null comment '数据表id' ,
item_name varchar(50) not null comment '统计项名称' ,
item_value varchar(500) not null comment '统计项集合' ,
index_value int not null comment '顺序' ,
total_rule varchar(500) comment '合计规则' ,
count_rule varchar(500) comment '计数规则' ,
unit_type int default 2 comment '统计单位'
)
;
alter table hrsa_sub_table add table_type int
;
alter table hrsa_sub_table modify column table_type int default 0
;
create table hrsa_salary_stats_dim
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
dim_name varchar(100) comment '统计维度名称' ,
dim_type varchar(20) comment '统计维度类型' ,
remark varchar(500) comment '描述' ,
setting varchar(2000) comment '设置内容',
is_default int comment '是否默认' ,
dim_code varchar(50) comment '统计维度编码'
)
;
create table hrsa_salary_stats_report
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
report_name varchar(100) comment '报表名称' ,
dimension varchar(1000) comment '统计维度(多个的话以逗号分隔)' ,
tax_agent_setting varchar(1000) comment '个税扣缴义务人配置' ,
income_category_setting varchar(20) comment '收入所得项目配置' ,
sub_company_setting varchar(1000) comment '分部配置' ,
depart_setting varchar(1000) comment '部门配置' ,
grade_setting varchar(1000) comment '职级配置' ,
position_setting varchar(1000) comment '岗位配置' ,
status_setting varchar(1000) comment '状态配置' ,
employee_setting varchar(1000) comment '人员配置' ,
hiredate_setting varchar(1000) comment '入职日期配置' ,
leavedate_setting varchar(1000) comment '离职日期配置' ,
salary_start_month datetime comment '薪资所属月份-起始' ,
salary_end_month datetime comment '薪资所属月份-截止'
)
;
create table hrsa_salary_statistics_item
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
item_name varchar(50) comment '统计项名称' ,
item_value varchar(1000) comment '统计项集合' ,
count_rule varchar(500) comment '计数规则' ,
sum_rule varchar(500) comment '求和规则' ,
avg_rule varchar(500) comment '平均值规则' ,
max_rule varchar(500) comment '最大值规则' ,
min_rule varchar(500) comment '最小值规则' ,
median_rule varchar(500) comment '中位数规则' ,
index_value int comment '顺序' ,
unit_type int comment '统计单位',
stat_report_id bigint comment '统计报表id'
)
;
create table hrsa_charts_setting
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
table_id bigint not null comment '报表id' ,
charts_type int not null comment '报表类型' ,
item_values varchar(500) comment '统计项目' ,
item_col_value varchar(50) not null comment '统计列' ,
dimension_range int not null comment '维度统计范围' ,
item_sort_value varchar(500) comment '排序统计项目' ,
item_col_sort_value varchar(50) comment '排序列' ,
sort_type int comment '排序类型' ,
sort_num int comment '排序取数值'
)
;
create table hrsa_salary_echarts_setting
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
report_id bigint not null comment '报表id' ,
charts_type int not null comment '报表类型' ,
item_values varchar(500) comment '统计项目' ,
item_col_value varchar(50) not null comment '统计列' ,
dimension_range int not null comment '维度统计范围' ,
item_sort_value varchar(500) comment '排序统计项目' ,
item_col_sort_value varchar(50) comment '排序列' ,
sort_type int comment '排序类型' ,
sort_num int comment '排序取数值'
)
;
alter table hrsa_salary_stats_dim modify column dim_type varchar(30)
;
alter table hrsa_salary_stats_report modify column income_category_setting varchar(1000)
;
create table hrsa_statreportlogs_detail
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
uuid varchar(36) not null comment '日志UUID' ,
mainid varchar(36) not null comment '主表id' ,
dataid varchar(50) not null comment '数据id' ,
belongdataid varchar(50) not null comment '主表数据id' ,
tablename varchar(200) not null comment '表名' ,
tablenamelabelid varchar(50) default '-1' not null comment '表名labelid' ,
tablenamedesc varchar(50) not null comment '对应数据库的表' ,
fieldname varchar(200) not null comment '字段名' ,
fieldnamelabelid varchar(50) default '-1' not null comment '字段名labelid' ,
newvalue text not null comment '更新后的值' ,
oldvalue text not null comment '更新前的值' ,
newrealvalue text not null comment '更新后的显示值' ,
oldrealvalue text not null comment '更新前的显示值' ,
fielddesc varchar(200) not null comment '字段名' ,
showorder int(11) not null comment '字段名' ,
isdetail int(11) default 0 not null comment '是否明细字段'
)
;
create table hrsa_statreportlogs
(
id bigint primary key comment 'ID' ,
create_time datetime comment '创建时间' ,
update_time datetime comment '修改时间' ,
creator bigint comment '创建人id' ,
delete_type int default 0 comment '是否删除' ,
tenant_key varchar(10) comment '租户KEY' ,
uuid varchar(36) not null comment '日志UUID' ,
log_date datetime not null comment '记录时间' ,
device varchar(500) not null comment '终端信息' ,
log_operator bigint not null comment '操作者' ,
operatorname varchar(100) comment '操作人姓名' ,
targetid bigint default '-1' not null comment '操作目标id' ,
targetname text not null comment '操作目标名称' ,
modulename varchar(100) not null comment '模块' ,
functionname varchar(100) not null comment '服务(方法)' ,
interfacename varchar(100) not null comment '访问接口名' ,
requesturl varchar(200) not null comment '请求全路径' ,
requesturi varchar(200) not null comment '请求地址' ,
operatetype varchar(50) not null comment '操作类型' ,
operatetypename varchar(100) not null comment '操作类型名称' ,
operatedesc varchar(3000) not null comment '操作详细说明' ,
params text not null comment '涉及的相关参数' ,
belongmainid varchar(36) not null comment '所属主表uuid' ,
clientip varchar(50) not null comment '操作IP' ,
groupid varchar(50) not null comment '分组' ,
groupnamelabel varchar(1000) not null comment '分组标题' ,
redoservice varchar(200) not null comment '重做业务接口' ,
redocontext text not null comment '重做参数' ,
cancelservice varchar(200) not null comment '撤销业务接口' ,
cancelcontext text not null comment '撤销参数' ,
totalruntime bigint default '0' not null comment '总运行时长' ,
mainruntime bigint default '0' not null comment '主方法运行时长' ,
log_result varchar(100) not null comment '日志结果' ,
fromterminal varchar(100) not null comment '来自pc web' ,
resultdesc text not null comment '运行结果描述' ,
old_content varchar(3000) not null comment '原先内容' ,
link_type varchar(20) not null comment '链接类型' ,
link_id bigint default '0' not null comment '链接id' ,
old_link_id bigint default '0' not null comment '原先链接id'
)
;
alter table hrsa_salary_stats_report add remark varchar(100)
;
alter table hrsa_salary_stats_report add second_dimension varchar(100)
;
alter table hrsa_salary_stats_report add sort_index varchar(100)
;
alter table hrsa_salary_stats_report add sort_type varchar(100)
;
alter table hrsa_salary_stats_dim add label_id int
;