耗时两年开源Erupt Framework 远强于代码生成器,后台管理系统全新解决方案

原创
2020/12/14 23:28
阅读数 1.4K

代码生成器的本质还是生成繁琐的后台代码,一旦修改后期生成的代码很难合并,虽然减轻部分工作,但解决方式并非最佳,后台管理系统开发是否还有更好的解决方案?

框架简介

Erupt Framework通用的后台管理框架,零前端代码,零CURD,快速开发企业级管理后台 !

无需创建 template 、 controller 、 service 、 dao 、 entity 、 mapper 效率提升1000%

无需生成任何代码,仅需单个实体类文件,配合erupt所提供的注解,就可快速开发完成后台管理功能 !

支持数据库:MySQL、Oracle、SQL Server、PostgreSQL、H2、DB2、MongoDB等。

摒弃重复的CURD,专注于核心业务逻辑 !

使用方法

是不是想说学不动了? 但是erupt真的非常简单,花几分钟了解一下,后期可以为你节省大量的后台开发时间!

仅需4四步快速搭建运行环境:

  1. 在Java 8环境下创建Spring Boot项目,
  2. 添加数据库连接配置与JPA配置
  3. 添加依赖
<!--用户权限管理-->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-upms</artifactId>
  <version>1.5.2</version>
</dependency>
<!--接口数据安全-->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-security</artifactId>
  <version>1.5.2</version>
</dependency>
<!--后台WEB界面-->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-web</artifactId>
  <version>1.5.2</version>
</dependency>
  1. 修改入口类配置

@SpringBootApplication                  // ↓ xyz.erupt必须有
@ComponentScan({"xyz.erupt","com.xxx"}) // ↓ com.xxx要替换成实际需要扫描的代码包
@EntityScan({"xyz.erupt","com.xxx"})    // ↓ 例如DemoApplication所在的包为 com.example.demo
@EruptScan({"xyz.erupt","com.xxx"})     // → 则:com.xxx → com.example.demo
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

仅需四步就可完成部署,且自带用户管理相关功能,启动成功:

下面使用erupt开发各行业后台管理功能

学生管理系统

@Erupt(name = "学生管理")      //erupt类注解
@Table(name = "t_student")    //数据库表名
@Entity                       //hibernate实体类标识
public class Student extends BaseModel {

    @EruptField(
        views = @View(title = "姓名"),
        edit = @Edit(title = "姓名")
    )
    private String name;

    @EruptField(
        views = @View(title = "年龄"),
        edit = @Edit(title = "年龄")
    )
    private Integer age;

    @EruptField(
            views = @View(title = "出生日期"),
            edit = @Edit(title = "出生日期", 
                dateType = @DateType(pickerMode = DateType.PickerMode.HISTORY)
            ))
    )
    private Date birthday;

    @EruptField(
        views = @View(title = "性别"),
        edit = @Edit(title = "性别",
                     boolType = @BoolType(trueText = "男", falseText = "女"))
    )
    private Boolean sex;
}

效果预览

可见代码十分简洁,实际场景中学生管理系统涉及字段会很多,仅需添加字段与相关配置就可以了

现在电商系统十分流行,那就使用erupt实现商品管理的后台功能

@Erupt(name = "商品管理", linkTree = @LinkTree(field = "category"))
@Table(name = "mall_goods")
@Entity
public class Goods extends BaseModel {

    @EruptField(
            views = @View(title = "商品图片"),
            edit = @Edit(title = "商品图片", notNull = true, type = EditType.ATTACHMENT,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE, maxLimit = 6))
    )
    private String image;

    @EruptField(
            views = @View(title = "商品名称"),
            edit = @Edit(title = "商品名称", notNull = true, inputType = @InputType(fullSpan = true), search = @Search(vague = true))
    )
    private String name;

    @ManyToOne
    @EruptField(
            views = @View(title = "所属分类", column = "name"),
            edit = @Edit(title = "所属分类", type = EditType.REFERENCE_TREE, search = @Search, notNull = true, referenceTreeType = @ReferenceTreeType(pid = "parent.id"))
    )
    private GoodsCategory category;

    @EruptField(
            views = @View(title = "运费"),
            edit = @Edit(title = "运费", notNull = true, search = @Search(vague = true))
    )
    private final Double freight = 0D;

    @EruptField(
            views = @View(title = "商品状态"),
            edit = @Edit(title = "商品状态", notNull = true, boolType = @BoolType(trueText = "上架", falseText = "下架"), search = @Search)
    )
    private boolean status;

    @Lob
    @EruptField(
            views = @View(title = "商品描述", type = ViewType.HTML),
            edit = @Edit(title = "商品描述", type = EditType.HTML_EDITOR)
    )
    private String description;

    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "goods_id")
    @EruptField(
            edit = @Edit(title = "商品型号", type = EditType.TAB_TABLE_ADD)
    )
    private Set<GoodsSpec> goodsSpecs;

}

效果预览:

erupt支持23类表单录入方式,15种展示形式,满足各种复杂场景的需求!


希望您从此摆脱枯燥的后台代码,早点下班做自己喜欢的事情!适度Coding益脑,过度Coding伤身,合理安排时间,享受健康生活!


更多示例详见框架官网:

https://www.erupt.xyz

创作不易,点击下方👇链接,给框架作者star鼓励

Gitee: https://gitee.com/erupt/erupt

Github: https://github.com/erupts/erupt

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部