20260922172938
This commit is contained in:
1 parent
583984c24f
commit
c8dad8d4a6
46 files changed
+3366
-1246
No files matched your search
@@ -83,12 +83,14 @@ create table dbo.s_module (
|
||||
b_view_table varchar(128) null, -- 默认查询表或视图
|
||||
b_save_table varchar(128) null, -- 默认保存目标表
|
||||
b_key_field varchar(50) null, -- 主键字段
|
||||
b_scope_field varchar(50) null, -- 数据范围字段(记录归属人字段,如 b_inputuser_id)
|
||||
b_order_sql varchar(500) null, -- 默认排序 SQL
|
||||
b_query_sql nvarchar(max) null, -- 可选查询 SQL 或 SQL 模板
|
||||
b_config_json nvarchar(max) null, -- 低频模块扩展配置
|
||||
b_canuse tinyint not null default 1, -- 是否启用(0/1)
|
||||
b_xh int not null default 0, -- 同级显示顺序
|
||||
b_bz nvarchar(2000) null -- 备注
|
||||
b_bz nvarchar(2000) null, -- 备注
|
||||
b_updated_at datetime2 null -- 最后保存时间(本模块任意配置保存时刷新,含字段 / 界面配置等子表)
|
||||
);
|
||||
GO
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/* ============================================================================
|
||||
s_module 增加 b_scope_field(数据范围字段)
|
||||
----------------------------------------------------------------------------
|
||||
数据范围按"记录归属人"判:这个字段就是区分数据是谁创建的(如 b_inputuser_id、
|
||||
b_applyuser_id)。权限引擎据此拼条件:
|
||||
self → 字段 = 当前用户编码
|
||||
dept → 由当前用户反查部门,字段 ∈ 该部门的用户集合
|
||||
dept_tree → 同上,"本部门及下级"取部门子树
|
||||
字段配在模块上而不是配在用户授权行(s_user_data_power.b_scope_field)上:
|
||||
同一个模块的所有用户必须用同一字段判范围,否则同一份数据对不同用户含义不同,
|
||||
也没法解释"为什么这个用户看得到、那个看不到"。授权行上的同名列不再参与判定
|
||||
(权限引擎只读本列),用户授权界面写入时统一清空它。
|
||||
历史行保持 NULL:NULL = 该模块不按字段判范围,权限引擎遇到 self / dept /
|
||||
dept_tree 规则时会明确报"未配置判断字段",不静默放行。
|
||||
============================================================================ */
|
||||
|
||||
if not exists (
|
||||
select 1
|
||||
from sys.columns
|
||||
where object_id = object_id('dbo.s_module')
|
||||
and name = 'b_scope_field'
|
||||
)
|
||||
alter table dbo.s_module add b_scope_field varchar(50) null;
|
||||
GO
|
||||
@@ -0,0 +1,19 @@
|
||||
/* ============================================================================
|
||||
s_module 增加 b_updated_at(最后保存时间)
|
||||
----------------------------------------------------------------------------
|
||||
模块管理右侧卡头需要展示「模块的更新时间」,原 s_module 没有任何时间列。
|
||||
语义:本模块任意配置(主表行 / 字段 / 界面配置 / 自动编码 / 权限点 / 关联 /
|
||||
删除规则 / 多语言)保存成功时刷新,即「这个模块最后一次被保存的时间」,
|
||||
而不只是主表行被改动的时间。写入由前端保存链路负责(见
|
||||
ModuleManagement buildSaveData),与 s_user_module_pref.b_updated_at 同一手法。
|
||||
历史行保持 NULL:不臆造时间,前端对空值不渲染该项,模块下次保存时自然填上。
|
||||
============================================================================ */
|
||||
|
||||
if not exists (
|
||||
select 1
|
||||
from sys.columns
|
||||
where object_id = object_id('dbo.s_module')
|
||||
and name = 'b_updated_at'
|
||||
)
|
||||
alter table dbo.s_module add b_updated_at datetime2 null;
|
||||
GO
|
||||
Reference in new issue
Block a user