齿轮易创
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chaoneng fc3f7130c3 2rd publish 6 年之前
ci/env 2rd publish 6 年之前
fumao-app 2rd publish 6 年之前
fumao-bi 2rd publish 6 年之前
fumao-common 2rd publish 6 年之前
fumao-company 2rd publish 6 年之前
fumao-place 2rd publish 6 年之前
fumao-service 2rd publish 6 年之前
fumao-system 2rd publish 6 年之前
.gitignore 初始化代码 6 年之前
README.md 2rd publish 6 年之前
pom.xml 2rd publish 6 年之前

README.md

项目结构

  • fumao-app
    • 对外接口和WEB的配置项
  • fumao-common
    • 一些常用的工具类
  • fumao-company
    • 集团端代码
  • fumao-system
    • 系统端代码
  • fumao-service
    • controller里面调用, 聚合其他几个模块的代码
  • fumao-bi
    • 统计数据

jpa相关

快速查询

单表条件查询
@QueryItem(type = QueryType.Eq) 等等

多表条件查询
@QueryItem(join = QueryJoinType.Inner, type = QueryType.equal, column = "实体里面的属性.表属性">

QueryBuilder.build(条件对象) 返回 Predicate 可交给SpringData 查询

非外键原则

@Fetch(FetchMode.JOIN)
@ManyToOne()
@JoinColumn(name = "本实体ID", referencedColumnName = "关联ID", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@NotFound(action=NotFoundAction.IGNORE) 

权限

使用spring security
  • 配置项
    • WebSecurityConfig
  • 过滤器
    • SecurityFilter
  • 注解
    • PreAuthorize(AuthRoles.xxxExp)
  • 使用
    • 实现LoginUser接口
    • 调用JwtUtils.encode
    • 方法或者类上面加PreAuthorize注解
    • 动态角色实现 AccessDecisionManager 接口

集团实例, 基于flyway

新建集团的时候会手动跑Flyway方法, 创建一个新实例

目前策略
主库
    系统数据
    集团数据
集团库
    集团数据
    业务数据
  • DBRouteFilter
    • 从请求上下文自动企切库
    • 集团端和业务端从JWT中抽取库
    • C端和B端, 从URL中收取库
  • DynamicDataSource
    • 扩展DataSource, 可以自动切库
  • DBConfiguration
    • 初始化主库
  • CompanyConfiguration
    • 初始化集团库