erupt 降维打击代码生成器,急速开发企业级管理后台

5 篇文章 1 订阅
4 篇文章 0 订阅
环境搭建

编程语言:Java8+
使用框架:Spring Boot,Erupt

1. 在spring boot项目基础上导入erupt依赖

<!--用户权限管理-->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-upms</artifactId>
  <version>1.5.1</version>
</dependency>
<!--接口数据安全-->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-security</artifactId>
  <version>1.5.1</version>
</dependency>
<!--后台WEB界面-->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-web</artifactId>
  <version>1.5.1</version>
</dependency>

2. 添加数据库配置

3. 修改入口类配置

@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);
    }
}

4. 启动项目,浏览器访问:http://localhost:8080

效果演示:

现在开始开发第一个后台管理页面,优惠券管理,创建一个名为Coupon的实体类,代码如下

@Erupt(name = "优惠券管理")
@Table(name = "mall_goods_coupon")
@Entity
public class Coupon extends BaseModel {

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

    @EruptField(
            views = @View(title = "金额"),
            edit = @Edit(title = "金额", notNull = true, search = @Search)
    )
    private Double price;

    @EruptField(
            views = @View(title = "商品金额满多少可用"),
            edit = @Edit(title = "商品金额满多少可用", notNull = true, search = @Search)
    )
    private Double priceMax;

    @EruptField(
            views = @View(title = "发行量"),
            edit = @Edit(title = "发行量", notNull = true, search = @Search(vague = true))
    )
    private Integer maxCount;

    @EruptField(
            views = @View(title = "颜色", template = "'<div style=\"width:100%;height:20px;background:'+value+'\"></div>'"),
            edit = @Edit(title = "颜色", notNull = true, inputType = @InputType(type = "color"))
    )
    private String color;

    @EruptField(
            views = @View(title = "生效时间"),
            edit = @Edit(title = "生效时间", notNull = true, dateType = @DateType(type = DateType.Type.DATE_TIME))
    )
    private Date startTime;

    @EruptField(
            views = @View(title = "失效时间"),
            edit = @Edit(title = "失效时间", notNull = true, dateType = @DateType(type = DateType.Type.DATE_TIME))
    )
    private Date endTime;

}

开发完成效果如下:

效果不错吧?仅使用了一个文件,加上少量注解就轻松完成了优惠券的后台管理功能!

Erupt 还有很多有趣的功能,如自定义模板,SQL图表,动态定时任务,MongoDB数据源管理等,欢迎体验,项目官网如下:https://www.erupt.xyz

开源仓库:

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

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

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值