# v2.4.0 升级至 v2.5.0

# 组件更改说明

该升级指南以v2.4.0版本为基准,更早的版本请先参考之前版本的升级文档。

diboot v2.5.x是基于spring boot 2.6的版本。

将diboot所有的组件版本号替换至2.5.0的最新版本,然后按照下述内容进行相关更改即可。

# diboot-core 内核

  • 优化 数据权限范围控制 实现:
    主要变化:
    • @DataAccessCheckpoint 注解不再需要参数了
    • DataAccessInterface 接口参数变化了:

      getAccessibleIds(Class<?> entityClass, String fieldName)

具体请参考文档:数据权限(范围)控制

  • 优化 数据保护 实现:
    主要变化:
    • @ProtectField 注解不再需要参数了
    • 移除了diboot.core.enable-data-protect配置项 和IEncryptStrategyIMaskStrategy 接口及默认实现类
    • 新增ProtectFieldHandler接口及默认实现DefaultProtectFieldHandler

具体请参考文档:数据保护(加密与脱敏)

# diboot-iam 权限体系

  • IAM用户体系相关表新增update_time字段,以便于数据同步场景。
alter table iam_user add column update_time  timestamp null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间';
alter table iam_role add column update_time  timestamp null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间';
alter table iam_org add column update_time  timestamp null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间';
alter table iam_position add column update_time  timestamp null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间';
alter table iam_account add column update_time  timestamp null DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间';
1
2
3
4
5
-- 系统配置表(以下为MySQL脚本,其他库请自行转换)
CREATE TABLE `system_config`
(
    `id`          bigint(20) UNSIGNED             NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `tenant_id`   bigint(20)                      NOT NULL DEFAULT 0 COMMENT '租户ID',
    `type`        varchar(50) CHARACTER SET utf8  NOT NULL COMMENT '类型',
    `prop`        varchar(50) CHARACTER SET utf8  NOT NULL COMMENT '属性',
    `value`       varchar(255) CHARACTER SET utf8 NULL     DEFAULT NULL COMMENT '属性值',
    `is_deleted`  tinyint(1)                      NOT NULL DEFAULT 0 COMMENT '删除标记',
    `create_time` timestamp                       NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` timestamp                       NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `idx_system_config_tenant_id` (`tenant_id`) USING BTREE,
    INDEX `idx_system_config` (`type`, `prop`) USING BTREE
) AUTO_INCREMENT = 10000 DEFAULT CHARSET = utf8 COMMENT = '系统配置';
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@RestController
@BindPermission(name = "系统配置")
@RequestMapping("/systemConfig")
public class SystemConfigController extends BaseCustomCrudRestController<SystemConfig> {

    @Autowired
    private SystemConfigService systemConfigService;

    /**
     * 获取系统配置类型列表
     *
     * @return
     */
    @Log(operation = OperationCons.LABEL_LIST)
    @BindPermission(name = OperationCons.LABEL_LIST, code = OperationCons.CODE_LIST)
    @GetMapping("/typeList")
    public JsonResult<List<LabelValue>> getTypeListMapping() {
        return JsonResult.OK(systemConfigService.getTypeList());
    }

    /**
     * 获取指定类型的系统配置信息
     *
     * @param type 类型
     * @return
     */
    @Log(operation = OperationCons.LABEL_DETAIL)
    @BindPermission(name = OperationCons.LABEL_DETAIL, code = OperationCons.CODE_DETAIL)
    @GetMapping("/{type}")
    public JsonResult<List<SystemConfigVO>> getConfigByTypeMapping(@PathVariable String type) {
        return JsonResult.OK(systemConfigService.getConfigByType(type));
    }

    /**
     * 更新系统配置
     *
     * @param systemConfig
     * @return
     */
    @Log(operation = OperationCons.LABEL_UPDATE)
    @BindPermission(name = OperationCons.LABEL_UPDATE, code = OperationCons.CODE_UPDATE)
    @PostMapping
    public JsonResult<?> updateConfigMapping(@RequestBody SystemConfig systemConfig) {
        return new JsonResult<>(systemConfigService.createOrUpdateEntity(systemConfig));
    }

    /**
     * 重置指定类型或属性的系统配置
     *
     * @param type 类型
     * @param prop 属性(为空重置整个类型)
     * @return
     */
    @Log(operation = "重置")
    @BindPermission(name = "重置", code = OperationCons.CODE_UPDATE)
    @DeleteMapping({"/{type}/{prop}", "/{type}"})
    public JsonResult<?> deleteTypeMapping(@PathVariable String type, @PathVariable(required = false) String prop) {
        systemConfigService.deleteByTypeAndProp(type, prop);
        return JsonResult.OK();
    }

    /**
     * 系统配置测试
     *
     * @param type 类型
     * @param data 数据
     * @return
     */
    @Log(operation = "测试")
    @BindPermission(name = "测试", code = OperationCons.CODE_UPDATE)
    @PostMapping("/{type}")
    public JsonResult<?> configTestMapping(@PathVariable String type, @RequestBody Map<String, Object> data) {
        systemConfigService.configTest(type, data);
        return JsonResult.OK();
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

# diboot-scheduler 定时任务组件

  • 如果依赖了定时任务组件,手动执行以下SQL更新数据结构(以下为MySQL脚本,其他库请自行转换):
ALTER TABLE schedule_job DROP COLUMN create_by_name;
ALTER TABLE schedule_job MODIFY COLUMN update_time  timestamp  null on update CURRENT_TIMESTAMP COMMENT '更新时间' AFTER create_by;
1
2

# 前端升级说明

  • diboot-antd-admin前端调整

升级前请下载diboot-antd-admin 2.5.0 (opens new window)源码包,以下升级流程将依赖此包。

  • diboot-element-admin前端调整

升级前请下载diboot-element-admin 2.5.0 (opens new window)源码包,以下升级流程将依赖此包。

  • 对比新旧版本的相关页面及代码,替换或合并至本地。