编程知识 cdmana.com

Erupt framework: an open source artifact that helps you to handle enterprise level background management system without front-end code

LOGO


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

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

Preface : Is backstage important ?

At the beginning of work , I don't care so much about the back office management system , After all, it's for internal use , Just make do with it . But as experience grows , I find that the more successful the business is , The more power you put in backstage .

Background management system , It reflects the R & D team's logic 、 Good command of business and ability of in-depth analysis , A well-designed backstage can even affect the organizational structure in turn , The development and change of the whole organization .

and , Today's Internet traffic is carved up by giants , There's not much space on the surface of the Glacier , And all walks of life that have not been fully enabled by information technology are the explosive points of the future market . And for these industries , Backstage needs are the core .

How to improve the efficiency of background development ?

Although the subtle differences in business processes have a huge impact on the enterprise , But the design and implementation of the background management system can follow certain rules .

therefore , For the background system development , There are many mature front ends on the market UI Templates , Like ants Ant Design, Old school Ext.js etc. , These frameworks simplify the front-end development process , But for the whole system , The cost of development is still high , There are still two systems . Some companies may not be able to support two teams , The back end is often forced to write front-end code .

Is it possible to go further , Only using back-end technology can complete the development ?

I believe seeing this , A lot of friends think of Code generator , But is it really the best solution ?

Its essence is to generate tedious code in a way similar to full text translation , Lack of flexibility . When it needs to be modified later , The generated code will be difficult to merge , Think Mybatis-Generator, It's basically a disposable thing .

The artifact we're going to introduce today , It is a whole process without writing any front-end code , There's no need to write multiple layers of CURD Logic , You don't need to create a table manually , Only one class file is needed to quickly build the enterprise level Admin The framework for managing the backstage —— Erupt Framework.

It not only improves efficiency , Release the back-end partners from the dilemma of being forced to write the front end , By the way, it also solved the problem of beauty , On the last few pictures, you can feel :

login

code

log

tpl

chart

Here is the project demo address , You can visit :

https://www.erupt.xyz/demo ( Adaptive layout , Support mobile access )

You can also try it :

Simple 4 Step , build 0 Front end code background management system

I. establish Spring Boot project → Spring Initializr

II. stay pom.xml Add erupt Dependency package

<!-- User authority management -->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-upms</artifactId>
  <version>1.5.2</version>
</dependency>
<!-- Interface data security -->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-security</artifactId>
  <version>1.5.2</version>
</dependency>
<!-- backstage WEB Interface -->
<dependency>
  <groupId>xyz.erupt</groupId>
  <artifactId>erupt-web</artifactId>
  <version>1.5.2</version>
</dependency>

III. stay application.yml / application.properties Add database configuration and JPA To configure

#  Configure to mysql For example , Of course erupt It also supports other managed databases , Such as Oracle、PostgreSQL、SQL Server etc. 
spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/erupt
    username: root
    password: 1234567
  jpa:
    show-sql: true
    generate-ddl: true
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
    database: mysql

IV. modify Spring Boot Entrance class

package com.example.demo;

@SpringBootApplication                  // ↓ xyz.erupt There has to be 
@ComponentScan({
   
    "xyz.erupt","com.xxx"}) // ↓ com.xxx To replace it with a code package that actually needs to be scanned 
@EntityScan({
   
    "xyz.erupt","com.xxx"})    // ↓  for example DemoApplication The package is  com.example.demo
@EruptScan({
   
    "xyz.erupt","com.xxx"})     // →  be :com.xxx → com.example.demo
public class DemoApplication {
   
    
    public static void main(String[] args) {
   
    
        SpringApplication.run(DemoApplication.class, args);
    }
}

Be accomplished

Take a look at the effect after starting

1

2

3

There is no need to perform initialization manually sql Script , After successful startup , Self contained menu maintenance 、 Organization maintenance 、 Role maintenance 、 User maintenance 、 Dictionary maintenance 、 Login log and operation log function !

Add a little more function to warm up

Hello World

@Erupt(name = " Introductory example ")         //erupt Core class annotations 
@Table(name = "t_hello_world")  // Database table name 
@Entity                        //JPA Entity class ID 
public class HelloWorld extends BaseModel {
   
     //BaseModel Only primary key information is defined in 

    @EruptField(
            views = @View(title = " Text "),
            edit = @Edit(title = " Text ")
    )
    private String input;

    @EruptField(
            views = @View(title = " The number "),
            edit = @Edit(title = " The number ")
    )
    private Float number1;

    @EruptField(
            views = @View(title = " Boolean "),
            edit = @Edit(title = " Boolean ")
    )
    private Boolean bool;


    @EruptField(
            views = @View(title = " Time "),
            edit = @Edit(title = " Time ")
    )
    private Date dateField;

}

Name the class HelloWorld Add to menu 、 The configuration is as follows :

4

After successful addition, refresh the page to see the sample menu , The effect is as follows :

5

6

Generated database table

create table demo_simple
(
    id         bigint auto_increment primary key,
    bool       bit          null,
    date_field datetime     null,
    input      varchar(255) null,
    number1    float        null
);

7

increase 、 Delete 、 Change 、 check 、 All functions such as column control can be used directly , No extra code required !

Student management

@Erupt(name = " Student management ")
@Table(name = "demo_student")
@Entity
public class Student extends BaseModel {
   
    

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

    @EruptField(
            views = @View(title = " Gender "),
            edit = @Edit(title = " Gender ",
                    boolType = @BoolType(trueText = " male ", falseText = " Woman "))
    )
    private Boolean sex;

    @EruptField(
            views = @View(title = " Date of birth "),
            edit = @Edit(title = " Date of birth ",
                    dateType = @DateType(pickerMode = DateType.PickerMode.HISTORY) // Date of birth must be in the past 
            ))
    private Date birthday;

    @EruptField(
            views = @View(title = " grade ( high school )"),
            edit = @Edit(title = " grade ( high school )", type = EditType.CHOICE,
                    choiceType = @ChoiceType(vl = {
   
    
                            @VL(value = "1", label = " In grade one "),
                            @VL(value = "2", label = " second grade "),
                            @VL(value = "3", label = " Third grade ")
                    })  // Drop down list supports dynamic rendering , For the convenience of demonstration, I have written several 
            ))
    private Integer grade;
}

Effect demonstration :

8
9

Automatically generated database table structure

create table demo_student
(
    id       bigint auto_increment primary key,
    birthday datetime     null,
    name     varchar(255) null,
    sex      bit          null,
    grade    int          null
);

10

Commodity management ( Left tree, right table )

@Erupt(name = " Commodity management ", 
       linkTree = @LinkTree(field = "category") // Left tree right table configuration 
)
@Table(name = "mall_goods")
@Entity
public class Goods extends BaseModel {
   
    

    @EruptField(
            views = @View(title = " Commodity images "),
            edit = @Edit(title = " Commodity images ", notNull = true, type = EditType.ATTACHMENT,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE, maxLimit = 6)) // You can upload up to six 
    )
    private String image;

    @EruptField(
            views = @View(title = " Name of commodity "),
            edit = @Edit(title = " Name of commodity ", notNull = true, inputType = @InputType(fullSpan = true), search = @Search(vague = true)) // Fuzzy query configuration 
    )
    private String name;

    @ManyToOne
    @EruptField(
            views = @View(title = " Classification ", column = "name"),
            edit = @Edit(title = " Classification ", type = EditType.REFERENCE_TREE, search = @Search, notNull = true, referenceTreeType = @ReferenceTreeType(pid = "parent.id"))
    )
    private GoodsCategory category; //GoodsCategory See the class definition below 
    
    @EruptField(
            views = @View(title = " Price "),
            edit = @Edit(title = " Price ", notNull = true , numberType = @NumberType(min = 0))
    )
    private Double price;

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

    @EruptField(
            views = @View(title = " Goods state "),
            edit = @Edit(title = " Goods state ", notNull = true, boolType = @BoolType(trueText = " shelves ", falseText = " Off the shelf "), search = @Search)
    )
    private boolean status;

    @Lob // Define database class as large text type , Support for storing more data 
    @EruptField(
            views = @View(title = " Commodity Description ", type = ViewType.HTML),
            edit = @Edit(title = " Commodity Description ", type = EditType.HTML_EDITOR) // Defined as a rich text editor 
    )
    private String description;

}

// Commodity categories 
@Erupt(name = " Commodity categories ", tree = @Tree(pid = "parent.id"), orderBy = "GoodsCategory.sort")
@Table(name = "mall_goods_category")
@Entity
public class GoodsCategory extends BaseModel {
   
    

    @EruptField(
            edit = @Edit(title = " Sort of pictures ", type = EditType.ATTACHMENT,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE))
    )
    private String image;

    @EruptField(
            edit = @Edit(title = " Category name ", notNull = true)
    )
    private String name;

    @EruptField(
            edit = @Edit(title = " According to the order ")
    )
    private Integer sort;

    @ManyToOne
    @EruptField(
            edit = @Edit(title = " Superior classification ", type = EditType.REFERENCE_TREE, referenceTreeType = @ReferenceTreeType(pid = "parent.id"))
    )
    private GoodsCategory parent;


}

11

12

13

14

Of course, in the actual business, the commodity table needs to maintain more fields , We just need to add or modify the existing product functions !

erupt The supported data entry components are as follows (23 class )

Component name describe
AUTO Default to this type , It can be inferred from the characteristics such as field type
INPUT Text input box
NUMBER Value input box
SLIDER Slide the input bar
DATE Time selector
CHOICE Radio buttons
TAGS tag chooser
AUTO_COMPLETE Done automatically
TEXTAREA Multiline text input box
HTML_EDITOR Rich text editor
CODE_EDITOR Code editor
ATTACHMENT The attachment , picture
MAP Map
DIVIDE Split line
TPL Customize HTML Templates
HIDDEN hide
REFERENCE_TREE Tree reference
REFERENCE_TABLE Table reference
CHECKBOX Check box
TAB_TREE Multi choice tree
TAB_TABLE_REFER Multiple choice tables
TAB_TABLE_ADD One to many new

appendix : The author's message

Erupt Framework General background management framework

Erupt Provide a full stack solution for enterprise level management system , Provide ultra many business components , The page is simple and beautiful , Support multiple data sources , Rigorous security strategy , Perfect user rights management , High scalability , Support operational behavior agent , Annotation type API Simple and clear , Greatly reduce the R & D cycle , Reduce R & D costs .

Erupt The original intention is to make background development easier , I hope you can focus on your core business , Save time to do what you love to do , Since then, it is no longer upset by the tedious background development !

If you like to give the author a star encourage , More interesting and practical features will be added later !

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

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

Official website address :https://erupt.xyz

版权声明
本文为[osc_ lduvstkg]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224113503083J.html

Scroll to Top