4.1.1 模块之yml文件结构详解

本节是对demo的boot工程的application-*.yml文件关于oinone相关配置的扩充讲解,大家可以先通读留个影响,以备不时之需

在基础入门的模块一章中大家构建,并通过启动前后应用,直观地感受到我们自己建的demo模块。在上述过程中想必大家都了解到我们oinone的boot工程是专门用来做应用启动管理,它完全没有任何业务逻辑,它只决定启动哪些模块、启动方式、以及相关配置。它跟Spring Boot的一个普通工程没有什么差异。所有我们只要看application-*.yml文件,oinone提供了哪些特殊配置就能窥探一二。

这里主要介绍pamirs路径下的核心以及常用的配置项

一、pamirs.boot

  1. pamirs.boot.init

    1. 描述:启动加载程序,是否启动元数据、业务数据和基础设施的加载与更新程序,在应用启动时同时对模块进行生命周期管理

    2. true ##标准版,只支持true

  2. pamirs.boot.sync

    1. 描述:同步执行加载程序,启动时对模块进行生命周期管理采用同步方式

    2. true ##标准版,只支持true

  3. pamirs.boot.modules

    a. 描述:启动模块列表。这里只有base模块是必须的。为了匹配我们的前端模版,在demo的例子中加入了其他几个通用业务模块。当然这些通用业务模块也是可以大大降低大家的开发难度以及提升业务系统的设计质量

    b. - base #oinone的基础模块

    c. - common #oinone的一些基础辅助功能

    d. - sequence #序列的能力

    e. - resource #基础资源如

    f. - user #基础用户

    g. - auth #权限

    h. - message #消息

    i. - international #国际化

    j. - business #商业关系

    k. - file #文件,demo里没有默认加入,如果要开发导入导出相关功能,可以对应引入改模块

    l. - …… 还有很多通用业务模块以及这些模块的详细介绍,我们在介绍第六章【oinone的通用能力】的章节去展开

  4. pamirs.boot.mode

    ⅰ. dev:不走缓存,可以直接修改元数据。特别是我们在说页面设计的时候,可以修改base_view表直接生效不需要重启系统

配置举例

pamirs:
    boot:
    init: true
    sync: true
    modules:
      - base
      - common
      - sequence
      - resource
      - user
      - auth
      - message
      - international
      - business
      - demo_core

图4-1-1-1 pamirs.boot.mode配置举例

二、pamirs.boot.profile与pamirs.boot.options

pamirs.boot.option, 在pamirs.boot.options中可以自定义可选项,也可以根据pamirs.boot.profile属性来指定这些可选项,pamirs.boot.profile属性的默认值为CUSTOMIZE。只有pamirs.boot.profile=CUSTOMIZE时,才能在pamirs.boot.options中自定义可选项。

可选项 说明 默认值 AUTO READONLY PACKAGE DDL
reloadModule 是否加载存储在数据库中的模块信息 false true true true true
checkModule 校验依赖模块是否安装 false true true true true
loadMeta 是否扫描包读取模块元数据 true true false true true
reloadMeta 是否加载存储在数据库中元数据 false true true true true
computeMeta 是否重算元数据 true true false true true
editMeta 编辑元数据,是否支持编程式编辑元数据 true true false true true
diffMeta 差量减计算元数据 false true false true false
refreshSessionMeta 刷新元数据缓存 true true true true true
rebuildHttpApi 刷新重建前后端协议 true true true false false
diffTable 差量追踪表结构变更 false true false true false
rebuildTable 更新重建表结构 true true false true false
printDDL 打印重建表结构DDL false false false false true
publishService 发布服务,是否发布远程服务 true true true false false
updateModule 分布式模块管理 false true false true false
updateMeta 初始化与更新元数据,是否将元数据的变更写入数据库 false true false true false
updateData 初始化与更新内置业务数据,是否将内置业务数据的变更写入数据库 true true false true false
params 扩展参数 可自定义 可自定义 可自定义 可自定义 可自定义

表4-1-1-1 pamirs.boot.options列表

可以在启动日志中可查看当前服务启动可选项。

image.png

图4-1-1-2 在启动日志中查看当前服务启动可选项

三、pamirs.meta

  1. pamirs.meta.metaPackages

    1. 描述:自定义元模型的所在包路径。标准版只能是pro.shushi.pamirs.trigger.model
  2. 配置举例

pamirs: 
    meta:
    metaPackages:
      - pro.shushi.pamirs.trigger.model

图4-1-1-3 pamirs.meta配置举例

四、pamirs.framework

  1. pamirs.framework.gateway #graphql的可选项配置

apamirs.framework.gateway.show-doc #是否对外提供gql的scheme文档查询能力,在3.2.1【构建第一个Module】一文中“DemoMoudel的启动”的部分之所以可以用Insomnia开查看后端的文档,就是这里要配置为true

bpamirs.framework.gateway.statistics #用于收集DataLoader执行过程中的状态,比如缓存命中多少次,已经load了多少个对象,有多少次error等

  1. pamirs.framework.hook

    1. pamirs.framework.hook.ignoreAll #默认为false,为true忽略掉所有hook函数

    2. pamirs.framework.hook.excludes #排除掉部分hook函数

  2. pamirs.framework.data #这个经常会使用到,大家一定要了解

    1. pamirs.framework.data.default-ds-key #模块的默认数据库key,对应pamirs.datasource配置

    2. pamirs.framework.data.ds-map #为模块指定数据库key,对应pamirs.datasource配置。在demo中我们如果要为demo_core这个模块配置独立数据库就可以在这里配置如 demo_core: demo,并在pamirs.datasource配置key为demo的数据源

  3. pamirs.framework.system

    1. pamirs.framework.system.system-ds-key #元数据系统对应的数据源,对应pamirs.datasource配置

    2. pamirs.framework.system.system-models #视为元数据模型,一起放到system-ds-key库

  4. 配置举例

pamirs:
  framework:
    system:
      system-ds-key: base
      system-models:
        - base.WorkerNode
    data:
      default-ds-key: pamirs
      ds-map:
        base: base
    gateway:
      statistics: true
      show-doc: true
    #hook 如下配置
    #hook:
      #excludes:
        #- pro.shushi.pamirs.core.common.hook.QueryPageHook4TreeAfter
        #- pro.shushi.pamirs.user.api.hook.UserQueryPageHookAfter
        #- pro.shushi.pamirs.user.api.hook.UserQueryOneHookAfter

图4-1-1-4 pamirs.framework 配置举例

五、pamirs.dialect.ds

  1. 描述:pamirs.datasource中数据源的方言信息,以key为对应。

  2. 子参数有:type(默认:MySQL),version(默认:8.0),majorVersion(默认:8)

  3. 配置举例

pamirs: 
    dialect: #MySQL8.0可不配置
    ds: 
        base: # pamirs.datasource中数据源的方言信息,以key为对应
        type: MySQL
        version: 8.0
        majorVersion: 8
      pamirs: # pamirs.datasource中数据源的方言信息,以key为对应
        type: MySQL
        version: 8.0
        majorVersion: 8

图4-1-1-5 pamirs.dialect.ds配置举例

六、pamirs.datasource

  1. 描述:安装模块所需要的数据源配置

  2. 配置举例

pamirs: 
  datasource:
    pamirs:
      driverClassName: com.mysql.cj.jdbc.Driver
      type: com.alibaba.druid.pool.DruidDataSource
      url: jdbc:mysql://127.0.0.1:3306/demo?useSSL=false&allowPublicKeyRetrieval=true&useServerPrepStmts=true&cachePrepStmts=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
      username: root
      password: oinone
      initialSize: 5
      maxActive: 200
      minIdle: 5
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      asyncInit: true
    base:
      driverClassName: com.mysql.cj.jdbc.Driver
      type: com.alibaba.druid.pool.DruidDataSource
      url: jdbc:mysql://127.0.0.1:3306/demo_base?useSSL=false&allowPublicKeyRetrieval=true&useServerPrepStmts=true&cachePrepStmts=true&useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true&allowMultiQueries=true
      username: root
      password: oinone
      initialSize: 5
      maxActive: 200
      minIdle: 5
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      asyncInit: true

图4-1-1-6 pamirs.datasource配置举例

七、pamirs.sharding

  1. 描述oinone的分库分表配置,当使用pamirs-trigger-bridge-tbschedule工程开启内置schedule功能时必须配置。

  2. 配置举例 - 参考4.1.24【框架之分库分表】一文。

pamirs: 
  sharding:
    define:
      data-sources:
        ds: pamirs
        pamirsSharding: pamirs #申明pamirsSharding库对应的pamirs数据源
        testShardingDs:        #申明testShardingDs库对应的testShardingDs_0\1数据源
          - testShardingDs_0
          - testShardingDs_1
      models:
        "[trigger.PamirsSchedule]":
          tables: 0..13
        "[demo.ShardingModel]":
          tables: 0..7
          table-separator: _
        "[demo.ShardingModel2]":
          ds-nodes: 0..1       #申明testShardingDs库对应的建库规则
          ds-separator: _
          tables: 0..7
          table-separator: _
    rule:
      pamirsSharding: #配置pamirsSharding库的分库分表规则
        actual-ds:
          - pamirs #申明pamirsSharding库对应的pamirs数据源
        sharding-rules:
          # Configure sharding rule,以下配置跟sharding-jdbc配置一致
          - tables:
              demo_core_sharding_model:
                actualDataNodes: pamirs.demo_core_sharding_model_${0..7}
                tableStrategy:
                  standard:
                    shardingColumn: user_id
                    shardingAlgorithmName: table_inline
            shardingAlgorithms:
              table_inline:
                type: INLINE
                props:
                  algorithm-expression: demo_core_sharding_model_${(Long.valueOf(user_id) % 8)}
        props:
          sql.show: true
      testShardingDs: #配置testShardingDs库的分库分表规则
        actual-ds: #申明testShardingDs库对应的pamirs数据源
          - testShardingDs_0
          - testShardingDs_1
        sharding-rules:
          # Configure sharding rule,以下配置跟sharding-jdbc配置一致
          - tables:
              demo_core_sharding_model2:
                actualDataNodes: testShardingDs_${0..1}.demo_core_sharding_model2_${0..7}
                databaseStrategy:
                  standard:
                    shardingColumn: user_id
                    shardingAlgorithmName: ds_inline
                tableStrategy:
                  standard:
                    shardingColumn: user_id
                    shardingAlgorithmName: table_inline
            shardingAlgorithms:
              table_inline:
                type: INLINE
                props:
                  algorithm-expression: demo_core_sharding_model2_${(Long.valueOf(user_id) % 8)}
              ds_inline:
                type: INLINE
                props:
                  algorithm-expression: testShardingDs_${(Long.valueOf(user_id) % 2)}
        props:
          sql.show: true

图4-1-1-7 pamirs.sharding配置举例

八、pamirs.mapper

  1. 库配置:可以通过YAML的“pamirs.mapper.<global或者ds>”配置项进行库配置。如果未配置,系统会采用默认值
配置项 默认值 描述
databaseFormat %s 库名格式化
tableFormat %s 表名格式化
tablePattern %s 动态表名表达式

表4-1-1-2 库配置

  1. 表配置:可以通过YAML的“pamirs.mapper.<global或者ds>.table-info”配置项或者@Model.Persistence注解进行表配置。注解优先级大于YAML配置文件配置。如果未配置,系统会采用默认值
配置项 默认值 描述
databaseFormat %s 库名格式化
tableFormat %s 表名格式化
tablePattern %s 动态表名表达式

表4-1-1-3 表配置

  1. 配置举例
pamirs: 
    mapper:
    static-model-config-locations:
      - pro.shushi.pamirs
    batch: collectionCommit #batch方法的批量提交模式
    batch-config:
      "[base.Field]":
        write: 2000
      "[base.Function]":
        read: 500
        write: 2000
    global: 
      table-info:
        logic-delete: true
        logic-delete-column: is_deleted
        logic-delete-value: REPLACE(unix_timestamp(NOW(6)),'.','')
        logic-not-delete-value: 0
        optimistic-locker: false
        optimistic-locker-column: opt_version
        key-generator: DISTRIBUTION
      table-pattern: '${module}_%s'
    #可以为指定数据配置
    #ds: 
    #   pamirs:
    #   table-info:
    #      logic-delete: true
    #      logic-delete-column: is_deleted
    #      logic-delete-value: REPLACE(unix_timestamp(NOW(6)),'.','')
    #      logic-not-delete-value: 0
    #      optimistic-locker: false
    #      optimistic-locker-column: opt_version
    #      key-generator: DISTRIBUTION
    #   table-pattern: '${module}_%s'

图4-1-1-8 pamirs.mapper配置举例

九、pamirs.persistence

  1. 描述:自动建库,建表

  2. 配置举例

pamirs: 
  persistence:
    global:
      auto-create-database: true
      auto-create-table: true

图4-1-1-9 pamirs.persistence配置举例

十、pamirs.plus

a. 描述mybatisplus的代理配置

b. 配置举例

pamirs: 
    plus:
    configuration:
      map-underscore-to-camel-case: false
      cache-enabled: false

图4-1-1-10 pamirs.plus配置举例

十一、pamirs.event

a. pamirs.event.enabled:启用RocketMQ功能,不启用的情况下无法使用任何功能,使用详见4.1.21【框架之分布式消息】一文。

b. pamirs.event.rocket-mq.namesrv-addr:RocketMQ连接地址字符串

c. pamirs.event.rocket-mq.aliyun : 阿里云版本适配

d. pamirs.event.schedule.enabled:启动异步任务工,不启用的情况下无法使用任何功能

e. 配置举例

pamirs: 
    event:
    enabled: false
    schedule:
      enabled: false
      ownSign: base
      auto-init: true
      auto-create-config-file: true
    rocket-mq:
      namesrv-addr: 127.0.0.1:9876
      # 标识发送消息和消费消息的机器的IP地址,默认为RemotingUtil.getLocalAddress()
      client-ip:
      # 标识发送消息和消费消息的机器的实例名称地址,默认为DEFAULT
      instance-name:
      # 标识发送消息和消费消息的机器的实例ID,无默认值
      namespace:
      # 为每一个topic添加一个固定前缀
      topic-prefix:
      # 是否启用vip netty通道以发送消息
      vip-channel-enabled: false
      # 是否启用消息轨迹追踪(该属性对于阿里云MQ无效)
      enable-trace: false
      # 消息轨迹追踪的topic名称
      trace-topic-name:
      # Pamirs Event工厂
      event-factory: pro.shushi.pamirs.framework.connectors.event.rocketmq.DefaultRocketMQEventFactory
      # acl配置
      accounts:
        - accessKey: RocketMQ
          secretKey: 12345678
      # 阿里云MQ 相关配置
      aliyun:
        # 使用阿里云MQ
        enabled: false
        # 阿里云MQ AccessKey
        access-key:
        # 阿里云MQ SecretKey
        secret-key:
        # 阿里云MQ InstanceId
        instance-id:
        # 阿里云MQ GroupId
        group-id:

图4-1-1-11 pamirs.event配置举例

十二、pamirs.auth

  1. pamirs.auth.modelFilter:配置模型所有的query方法不需要过权限控制 #下个版本作废,不建议使用

  2. pamirs.auth.funFilter:配置模型的特定query方法不需要过权限控制

  3. 配置举例

pamirs: 
    auth:
    model-filter:
      - user.PamirsUserTransient
      - auth.ResourcePermission
      - auth.AuthGroup
      - auth.AuthRole
      - base.View
      - resource.ResourceCountry
      - pamirs.web.WebMenu
      - pamirs.web.WebRenderTransient
      - pamirs.message.MessageCenter
      - resource.major.ResourceMajorConfig
    fun-filter:
      - namespace: user.PamirsUserTransient
        fun: login #登录
      - namespace: user.PamirsUserTransient
        fun: loginByVerificationCode #手机号验证码登录
      - namespace: user.PamirsUserTransient
        fun: loginVerificationCode #手机号登录验证码
      - namespace: user.PamirsUserTransient
        fun: signUpVerificationCode #手机号注册验证码

图4-1-1-12 pamirs.auth配置举例

十三、pamirs.file

  1. 描述:导入导出相关配置,使用详见6.1【文件导入导出】一文

  2. 配置举例

pamirs:
    file:
    auto-upload-logo: false
    import-property:
      default-each-import: false # 默认逐行导入
      max-error-length: 100 # 默认最大收集错误行数
    export-property:
      default-clear-export-style: false # 默认使用csv导出
      csv-max-support-length: 1000000 # csv导出最大支持1000000行

#文件导入导出还依赖CDN相关配置
cdn:
  oss:
    name: 阿里云
    type: OSS
    bucket: pamirs
    uploadUrl: oss-cn-hangzhou.aliyuncs.com
    downloadUrl: oss-cn-hangzhou.aliyuncs.com
    accessKeyId: #自行修改值
    accessKeySecret: #自行修改值
    mainDir: upload/demo/test/ 
    validTime: 3600000
    timeout: 600000
    active: true
    referer:
    localFolderUrl:

图4-1-1-13 pamirs.file配置举例

十四、pamirs.channel

  1. 描述:

  2. 配置举例

pamris: 
    channel:
    zkServers: 127.0.0.1:2181

图4-1-1-14 pamirs.channel配置举例

十五、pamirs.zookeeper

  1. 描述:zk配置的代理

  2. 配置举例

pamris:
    zookeeper:
    zkConnectString: 127.0.0.1:2181
    zkSessionTimeout: 60000
    rootPath: /demo

图4-1-1-15 pamirs.zookeeper配置举例

十六、pamirs.eip

  1. 描述:集成相关配置,使用详见集成平台一节

  2. 配置举例

pamirs: 
    eip:
    open-api:
      enabled: false
      standalone:
        host: 127.0.0.1
        port: 8081
        aes-key:
      routes:
        pamirs:
          host: 127.0.0.1
          port: 8081
          aes-key:

图4-1-1-16 pamirs.eip配置举例

高德地图接口的key配置

pamirs: 
    eip:
    map:
        gd:
        key: xxxxxx

图4-1-1-17高德地图接口的key配置

十七、pamirs.elastic

a. 描述:es搜索引擎地址 ,使用详见4.1.25【框架之搜索引擎】一节

b. 配置举例

pamirs: 
    elastic:
    url: 127.0.0.1:9200

图4-1-1-18 pamirs.elastic配置举例

十八、pamirs.load

oinone的默认模式下元数据都是以DB为准,当A模块依赖B模块,A与B模块不在没有部署在一起同时元数据的Base库也不是一个,那么A的元数据库怎么没有B模型,会导致系统出现模型定义找不到的错误。那么则需要A启动内存元数据模式,因为在A的元数据计算的时,因为A依赖B模块,同时有B的接口包,在内存中会扫描B的模型。所以我们要启动内存模式。应对分布式开发场景设计,更多请详见4.4【oinone的分布式体验进阶

pamirs:
  load:
    sessionMode: true

图4-1-1-19 pamirs.load配置举例

Oinone社区 作者:史, 昂原创文章,如若转载,请注明出处:https://doc.oinone.top/oio4/9276.html

访问Oinone官网:https://www.oinone.top获取数式Oinone低代码应用平台体验

Like (0)
史, 昂's avatar史, 昂数式管理员
Previous 2024年5月23日 am9:02
Next 2024年5月23日

相关推荐

  • 4.1.9 函数之元位指令

    元位指令系统是通过给请求上下文的指令位字段作按位与标记来对函数处理下发对应指令的系统。 一、元位指令介绍 元位指令系统是通过给请求上下文的指令位字段作按位与标记来对函数处理下发对应指令的系统。 元位指令系统分为请求上下文指令和数据指令两种。 数据指令 数据指令基本都是系统内核指令。业务开发时用不到这里就不介绍了。前20位都是系统内核预留 请求上下文指令 请求上下文指令:使用session上下文中非持久化META_BIT属性设置指令。 位 指令 指令名 前端默认值 后端默认值 描述 20 builtAction 内建动作 否 否 是否是平台内置定义的服务器动作对应操作:PamirsSession.directive().disableBuiltAction(); PamirsSession.directive().enableBuiltAction(); 21 unlock 失效乐观锁 否 否 系统对带有乐观锁模型默认使用乐观锁对应操作:PamirsSession.directive().enableOptimisticLocker(); PamirsSession.directive().disableOptimisticLocker(); 22 check 数据校验 是 否 系统后端操作默认不进行数据校验,标记后生效数据校验对应操作:PamirsSession.directive().enableCheck(); PamirsSession.directive().disableCheck(); 23 defaultValue 默认值计算 是 否 是否自动填充默认值对应操作:PamirsSession.directive().enableDefaultValue(); PamirsSession.directive().disableDefaultValue(); 24 extPoint 执行扩展点 是 否 前端请求默认执行扩展点,可以标记忽略扩展点。后端编程式调用数据管理器默认不执行扩展点对应操作:PamirsSession.directive().enableExtPoint(); PamirsSession.directive().disableExtPoint(); 25 hook 拦截 是 否 是否进行函数调用拦截对应操作:PamirsSession.directive().enableHook(); PamirsSession.directive().disableHook(); 26 authenticate 鉴权 是 否 系统默认进行权限校验与过滤,标记后使用权限校验对应操作:PamirsSession.directive().sudo(); PamirsSession.directive().disableSudo(); 27 ormColumn ORM字段别名 否 否 系统指令,请勿设置 28 usePkStrategy 使用PK策略 是 否 使用PK是否空作为采用新增还是更新的持久化策略对应操作:PamirsSession.directive().enableUsePkStrategy(); PamirsSession.directive().disableUsePkStrategy(); 29 fromClient 是否客户端调用 是 否 是否客户端(前端)调用对应操作:PamirsSession.directive().enableFromClient(); PamirsSession.directive().disableFromClient(); 30 sync 同步执行函数 否 否 异步执行函数强制使用同步方式执行(仅对Spring Bean有效) 31 ignoreFunManagement 忽略函数管理 否 否 忽略函数管理器处理,防止Spring调用重复拦截对应操作:PamirsSession.directive().enableIgnoreFunManagement(); PamirsSession.directive().disableIgnoreFunManagement(); 表4-1-9-1 请求上下文指令 二、使用指令 普通模式 PamirsSession.directive().disableOptimisticLocker(); try{ 更新逻辑 } finally { PamirsSession.directive().enableOptimisticLocker(); } 图4-1-9-1 普通模式代码示意 批量设置模式 Models.directive().run(() -> {此处添加逻辑}, SystemDirectiveEnum.AUTHENTICATE) 图4-1-9-2 批量设置模式代码示意 三、使用举例 我们在4.1.5【模型之持久层配置】一文中提到过失效乐观锁,我们在这里就尝试下吧。 Step1 修改PetItemInventroyAction 手动失效乐观锁 package pro.shushi.pamirs.demo.core.action; import org.springframework.stereotype.Component; import pro.shushi.pamirs.demo.api.model.PetItemInventroy; import pro.shushi.pamirs.meta.annotation.Function; import pro.shushi.pamirs.meta.annotation.Model; import pro.shushi.pamirs.meta.api.session.PamirsSession; import pro.shushi.pamirs.meta.constant.FunctionConstants; import pro.shushi.pamirs.meta.enmu.FunctionOpenEnum; import pro.shushi.pamirs.meta.enmu.FunctionTypeEnum; import java.util.ArrayList; import java.util.List; @Model.model(PetItemInventroy.MODEL_MODEL) @Component public class PetItemInventroyAction { @Function.Advanced(type= FunctionTypeEnum.UPDATE) @Function.fun(FunctionConstants.update) @Function(openLevel = {FunctionOpenEnum.API}) public PetItemInventroy update(PetItemInventroy data){ List<PetItemInventroy> inventroys = new ArrayList<>(); inventroys.add(data); PamirsSession.directive().disableOptimisticLocker(); try{ //批量更新会,自动抛错 int i = data.updateBatch(inventroys); //单记录更新,不自动抛售需要自行判断 // int i = data.updateById();…

    2024年5月23日
    1.3K00
  • 合作伙伴中心

    合作伙伴中心包含“公司、个人、部门、岗位、员工”五个菜单。其中公司、个人为合作伙伴,是创建组织架构的前置条件;部门、岗位、员工为组织架构,是选择的公司下的内部架构。 合作伙伴 公司页面中包含常规的增删改查和查看详情。 公司的创建页面如下: 个人暂不支持创建。 组织架构 同样菜单中包含常规的增删改查和查看详情。 组织架构可以依次创建部门、岗位、员工。对应关系为,一个部门下有多个岗位,一个员工可以归属于多个部门和多个岗位。 部门创建页面如下: 岗位创建页面如下: 员工创建页面如下: 合作伙伴中心创建的员工会自动生成可登录的用户并进行绑定。 在用户中心创建的用户仅为可登录用户无法操作管理员工、关联部门。 流程设计器中可选到的操作人分类为“员工、部门、角色”。

    2024年6月20日
    1.3K00
  • 4.5.2 研发辅助之SQL优化

    Oinone体系中是不需要针对模型写SQL的,默认提供了通用的数据管理器。在带来便利的情况下,也导致传统的sql审查就没办法开展。但是我们可以以技术的手段收集慢SQL和限制问题SQL执行。 慢SQL搜集目的:去发现非原则性问题的慢SQL,并进行整改 限制问题SQL执行:对应一些不规范的SQL系统上直接做限制,如果有特殊情况手动放开 一、发现慢SQL 这个功能并没有直接加入到oinone的版本中,需要业务自行写插件,插件代码如下。大家可以根据实际情况进行改造比如: 堆栈入口,例子中只是放了pamirs,可以根据实际情况改成业务包路径 对慢SQL的定义是5s还是3s,根据实际情况变 package pro.shushi.pamirs.demo.core.plugin; import org.apache.ibatis.executor.Executor; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.plugin.*; import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.RowBounds; import org.springframework.stereotype.Component; import pro.shushi.pamirs.meta.annotation.fun.extern.Slf4j; @Intercepts({ @Signature(type = Executor.class,method = "query",args = {MappedStatement.class,Object.class, RowBounds.class, ResultHandler.class}) }) @Component @Slf4j public class SlowSQLAnalysisInterceptor implements Interceptor { @Override public Object intercept(Invocation invocation) throws Throwable { long start = System.currentTimeMillis(); Object result = invocation.proceed(); long end = System.currentTimeMillis(); if (end – start > 10000) {//大于10秒 try { StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); StringBuffer slowLog = new StringBuffer(); slowLog.append(System.lineSeparator()); for (StackTraceElement element : stackTraceElements) { if (element.getClassName().indexOf("pamirs") > 0) { slowLog.append(element.getClassName()).append(":").append(element.getMethodName()).append(":").append(element.getLineNumber()).append(System.lineSeparator()); } } Object parameter = null; if (invocation.getArgs().length > 1) { parameter = invocation.getArgs()[1]; } MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0]; BoundSql boundSql = mappedStatement.getBoundSql(parameter); Configuration configuration = mappedStatement.getConfiguration(); String originalSql = showSql(configuration, boundSql); originalSql = originalSql.replaceAll("\'", "").replace("\"", ""); log.warn("检测到的慢SQL为:" + originalSql); log.warn("业务慢SQL入口为:" + slowLog.toString()); } catch (Throwable e1) { //忽略 } } return result; } public String showSql(Configuration configuration, BoundSql boundSql) { Object parameterObject = boundSql.getParameterObject(); List<ParameterMapping> parameterMappings = boundSql.getParameterMappings(); String sql = boundSql.getSql().replaceAll("[\\s]+", " "); if (parameterMappings.size() > 0 && parameterObject != null) { TypeHandlerRegistry typeHandlerRegistry…

    Oinone 7天入门到精通 2024年5月23日
    1.7K00
  • 登录日志

    1. 登录日志 登录日志:记录企业成员/用户登录平台的历史明细,包括登录时间、位置、IP、登录设备、登录平台等信息,登录平台包括:PC Web、小程序、H5、APP。登录日志不需要通过审计规则订阅,平台会记录每位用户的登录日志。 操作支持导出、查看详情。

    2024年6月20日
    1.4K00
  • 5.2 CDM之工程模式

    两种工程模式介绍 oinone推荐的两种工程模式都保留互联网特性,如跟业务无关的基础平台还是采用平台化思路建设。二种侧重点差异如下 第一种:比较适合企业采用多供应商联合开发场景,先以业务区分,各个业务线有独立的领域平台,最大限度保持不同业务线的独立性,有利于各个业务线独立发展(目前oinone上层星空系列产品采用这种工程模式,因为我们期望的时候帮助企业构建软件生态,必然要考虑不同供应商联合开发场景) 第二种:比较接近传统互联网架构,先按平台领域区分,如商品领域:商品平台做总工程,但里面按业务区分模块分子工程来保持业务相互独立,相对于第一种把领域的代码放一起,带来好处强化大家思考模型通用性。但不适用于跨公司主体间配合。 图5-2-1 Oinone-CDM的两种工程模式 注意事项: oinone兼容传统互联网架构 不管哪种模式,都需要解决CDM的维护问题 CDM维护的常见问题: Q:CDM层缺少模型怎么办? A:CDM层模型是逐步完善和丰富的。如果是特定业务自己需要的模型,这类模型无通用性。则加到自己的工程中;如果是通用的,则架构组确定是否需要纳入到CDM。 Q:CDM层已有的模型缺少字段怎么办? A:CDM层模型的字段也是逐步完善和丰富的,通用的字段在架构组确定后也会被吸收进来 Q:CDM层不同业务线相互影响怎么办? A:扩展字段最好带上自有前缀标志,如果觉得通用则提交架构组走模型缺少字段加入 Q:CDM层某模型新增加了的字段,但原先业务线已经加了相同含义字段 A:业务线可以把自己的字段related到CDM增加的新字段,并做数据迁移

    2024年5月23日
    1.9K00

Leave a Reply

Please Login to Comment