jeecg-boot-2.0.0 心得

jeecg-boot-2.0.0 心得

学习开发:
RongWan 是一款基于代码生成器的JAVA快速企业(Online )开发平台

  在公司参与基础平台微服务建设,不断的进行平台产品化方向。上级讨论定下来需要用到微服务框架,平台至少要用到注册中心+配置中心+网关+认证+后台管理+前端vue至少5+1。针对大项目,强大的运维团队支持应该是可以承受,但是哪里天天会有大项目呢?公司几乎都是中小项目,所以在寻找一个轻量级的boot版本,针对小项目,敏捷开发,快速上线部署。在网上寻找到了JEECG,想和原先前后端分离,发现居然有JEECG-BOOT前后端分离版本,让我有了新的研究和学习的方向。
  在jeecg-boot采用前后端分离后,在线开发功能实现,以及加入流程引擎和动态表单加强对业务整合。希望下后面接来的版本中不断产品化,集成auth2平台化,cas单点登录企业级别使用。不断高可用的框架代码。
  学习JEECG-BOOT(http://jeecg-boot.mydoc.io/)技术文档,非常的详细。不过在使用它的过程也出现一下问题,在此提出本人的建议。

  1. 进行模块化、组件化开发,将原先开源版本system里面板块尽量剥离处理,保留简洁版的后台管理功能。
├─jeecg-boot-parent(父POM: 项目依赖、modules组织)
│  ├─jeecg-boot-common(共通Common模块: 底层工具类、注解、接口)
│  │  ├─jeecg-boot-common-bom 公共版本控制
│  │  ├─jeecg-boot-common-core 公共工具类核心包
│  │  ├─jeecg-boot-common-datasource 动态切换数据源
│  │  ├─jeecg-boot-common-log 日志服务
│  │  ├─jeecg-boot-common-minio 文件系统依赖
│  │  ├─jeecg-boot-common-swagger 接口文档
│  │  ├─jeecg-boot-common-security 安全工具
│  ├─jeecg-boot-system (系统管理模块: 系统管理、权限等功能) -- 默认作为启动项目
│  │  ├─jeecg-boot-system-api
│  │  ├─jeecg-boot-system-biz
│  ├─jeecg-boot-module-{?} (自己扩展新模块项目,启动的时候,在system里面引用即可)
│  │  ├─jeecg-boot-code-gen
│  │  ├─jeecg-boot-module-iso8583 报文解析
│  │  ├─jeecg-boot-module-demo   测试样例
│  │  ├─jeecg-boot-module-online 在线开发
│  │  ├─jeecg-boot-module-quartz 定时任务
│  │  ├─jeecg-boot-module-aggrega 聚合平台
│  │  ├─jeecg-boot-module-monitor 监控管理
│  │  ├─jeecg-boot-module-pos8583gbk 银联POS
│  │  ├─jeecg-boot-module-agiledata 银联银商
│  │  ├─jeecg-boot-module-message 消息中心

为了进一步根据开发调用,采用模板对外接口公共api模块,POM如下:

│  ├─jeecg-boot-system 
│  │  ├─jeecg-boot-system-api 系统管理对外接口公共api模块
│  │  ├─jeecg-boot-system 系统管理
  1. 数据库表结构上面建议
    在这里插入图片描述
  • 统一优化使用数据库版本,mysql必须5.7+以上,mysql5.7上有json类型,且建议使用utf8mb4字符集,以免特殊字符丢失到时数据无法查看;

  • 字段命名问题,如es_type建议改成type,其他类似;create_by建议改成create_user,加入del_flag,调整create_time (调整CURRENT_TIMESTAMP),其他类似排查,统一规范。
    在这里插入图片描述

  • 建议邮件、短信设计分离,因为邮件支持富文本;

  • int长度建议为9;类型、状态相关字段建议使用tinint。

3.代码调整
在实体类entity中,加入
import lombok.Data; 引入@Data,去除代码中大量的get和set
import com.baomidou.mybatisplus.annotation.TableLogic; 引入@TableLogic,进行默认delFlag

4.插件升级
插件升级以及properties属性进行版本管理为何
springboot升级2.1.5.RELEASE
mybatis-plus升级3.1.1
hutool加入4.4.5

 <properties>
        <jeecgboot.common.version>2.0.0</jeecgboot.common.version>
        <java.version>1.8</java.version>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mybatis-plus.version>3.1.1</mybatis-plus.version>
        <druid.version>1.1.10</druid.version>
        <commons.version>2.6</commons.version>
        <hutool.version>4.4.5</hutool.version>
    </properties>
<dependencies>
        <!-- mybatis-plus -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>${mybatis-plus.version}</version>
        </dependency>
        <!--hutool-->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>${hutool.version}</version>
        </dependency>
</dependencies>
  1. 接口返回对象类调整
Builder
ToString
Accessors(chain = true)
AllArgsConstructor
@ApiModel(value = "接口返回对象", description = "接口返回对象")
public class Result<T> implements Serializable {
    ...

    public Result(T data) {
        super();
        this.result = data;
    }
    ...
}
  1. 开发规范性建议
  • 代码中大量重复造轮子代码
  • 注释说明规范性不统一
  • 建议采用阿里巴巴规范插件开发
  • 代码充出现大量神秘代码“0”,“1”,统一采用常量进行管理
  • 采用缓存机制
  • 加入现流行的auth2,可进行第三方接入
  • 加入企业级cas单点登录,提高企业级多系统之间的跳转
发布了83 篇原创文章 · 获赞 24 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/u010638673/article/details/91796753