Today WE show you an open source Java backend management Framework, the Erupt Framework

Erupt is a low-code, full-stack class framework that uses Java annotations to dynamically generate pages, add, delete, modify, review, and control permissions in the background. It can automatically create table structures without having to know the basics of Spring Boot, without having to know the front-end or write complex curDs. Controller/service/SAO/mapper files do not need to be created, which greatly reduces the development workload and improves the speed of background development to the extreme.

Project address: gitee.com/erupt/erupt

Just create a new entity class, add some comments, and you’ll be fine. Follow me as I explore the limits of restraint.

Start fast

1.1 Environment Preparations

Back-end environment:

  1. JDK 1.8 +
  2. Maven 3.0 +
  3. MYSQL 5.5 +

The development tools

  1. IDE: IDEA
  2. MySQL Visualization: Navicat

1.2 Quick Start

(1) Clone Project

  • Making:
git clone https://github.com/erupts/erupt-example.git
Copy the code
  • Gitee (faster domestic access) :
git clone https://gitee.com/erupt/erupt-example.git
Copy the code

(2) Create MySQL database

Open Navicat, connect to MySQL, create a new database erupt, and set the character set and sorting rules as shown below:

(3) Run back-end projects

Configuration file: Open the back-end project Erupt-Example with IDEA, wait for Maven to finish downloading, open the configuration file yML to configure the database, and change it to MySQL on your machine.

# application. The properties of writing
spring.datasource.url=JDBC: mysql: / / 127.0.0.1:3306 / erupt? useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=123456
spring.jpa.show-sql=true
spring.jpa.generate-ddl=true
spring.jpa.database=mysql
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
Copy the code

When the project starts, the data table is automatically imported into MySQL.

1.3 Effect Preview

The operation is successful. Access http://localhost:8080

Account: erupt

Password: erupt

Two, quickly create an administrative page

2.1 Creating a Java Entity class

Create a Java class with the following code

package xyz.demo.erupt.example.model;

import org.hibernate.annotations.GenericGenerator;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.View;

import javax.persistence.*;


/* * @erupt caps on classes, @eruptfield caps on fields * all other caps are Jpa caps */
@erupt (name = "Simple example ")
@Table(name = "demo_simple")
@Entity
public class Simple {

    / / the primary key
    @Id
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "native")
    @Column(name = "ID")
    @EruptField
    private Long id;

    // Text input
    @eruptfield (views = @view (title = "text "), edit = @edit (title =" text ")
    private String input;
    
    // Numeric input
    @eruptfield (views = @view (title = "limit "), edit = @edit (title =" limit "))
    private Integer number;

    // Boolean select
    @eruptfield (views = @view (title = "limit "), edit = @edit (title =" limit ")
    private Boolean bool;

    // Time selection
    @eruptfield (views = @view (title = "time "), edit = @edit (title =" time ")
    private Date date;

}
Copy the code

2.2 Start the project, add the menu running effect demonstration

Erupt supports up to 23 classes of components, depending on actual requirementsflexibleConfiguration management background!

To Erupt violently from restraint; 3

3.1 Usage

To emerge violently from restraint (limit = "limit ", // to emerge violently from restraint (limit =" limit ", // to emerge violently from restraint (limit = "limit ", // to emerge violently from restraint (limit), // sort expression)
public class EruptTest extends BaseModel {}Copy the code

3.2 Comments on Configuration Items

The property name describe
primaryKeyCol Primary key column name, default is ID
name The name of the function
desc Functional description
authVerify Whether authorization verification is required for access
orderBy Sort rules, refer to the HQL statement order by syntax
power Control add, delete, change, check, import and export functions
filter Data display filter criteria, refer to the WHERE syntax of the HQL statement
tree Tree Node Configuration
linkTree Left tree right table configuration
drills Custom drill-down associated view
rowOperation Custom function buttons
dataProxy Set of proxy callback interface methods
param Custom parameters

To EruptField

4.1 Examples of Annotations

@eruptfield (sort = 10, views = @view (title = "limit "), edit = @edit (title =" limit ")
private String name;
Copy the code

4.2 Comments on Configuration Items

annotations describe
views Table Configuration
edit Edit item Configuration
sort The front end displays the order. By default, the front end displays the order of fields. The smaller the number, the higher the order
params Custom parameters

4.3 @ the View

The property name describe
title Table column name
desc Table column description
column If the modifier field is an object type, you need to use this property to specify which field to display to use this configuration for @manytoone
type Please refer to the form of data presentation for detailsThe type reference
show Whether or not shown
sortable Whether sort operations are performed using table columns at the front end
export Whether Excel export is supported
className Table style class name
template Item. XXX (a column of data). Value (the current data) → template = “‘ name: ‘+ value” → name XXXX

@view → type reference

The property name describe
AUTO Automatically recognize editTypes based on @Edit → EditType or field type.The ATTACHMENT – ATTACHMENTEditType.ATTACHMENT.IMAGE – > IMAGEEditType.HTML_EDITOR HTMLEditType.CODE_EDITOR CODEEditType.MAP MAP Boolean BOOLEANThe Date – DATEInteger NUMBERFloat NUMBERDouble NUMBERother TEXT
TEXT Plain text
IMAGE The picture
IMAGE_BASE64 Base64 format image
SWF Flash animation
HTML Render HTML code snippets
MOBILE_HTML Phone screen size render HTML code snippet
QR_CODE Qr code
LINK New window mode opens links
LINK_DIALOG Dialog mode to open the link
DOWNLOAD Direct download
ATTACHMENT New window mode opens attachments instead
ATTACHMENT_DIALOG Open the attachment in a dialog box
DATE The date of
BOOLEAN Boolean
NUMBER The numerical
MAP The map
CODE code

4.4 @ Edit

The property name describe
title Edit box name
desc describe
notNull This parameter is mandatory
show Whether or not shown
showBy Under what circumstances are components displayed? The specific usage methods are as follows:showBy = @ShowBy(dependField = “number”, expr = “value == 1”)dependField: Shows the components on which this component dependsexprValue indicates the value of the dependent field number. The syntax is JavaScript. If the input value of number is 1, this component is displayed.
placeHolder Description Prompt for the expected value of an input field
search Search supported or not
orderBy Collation, as in the HQL statement ORDER by syntax, is available for objects whose field type is @erupt modified
filter Collation, as in the HQL statement WHERE syntax, is available for objects whose field type is @ERUPt modified
type Edit type, see detailsThe type reference

@edit → type reference

type describe
AUTO By default, this type can be inferred by characteristics such as the field type
INPUT Text entry field
NUMBER Numeric input box
SLIDER Sliding input bar
DATE Time selector
BOOLEAN switch
CHOICE Radio buttons
TAGS Label selector
AUTO_COMPLETE Done automatically
TEXTAREA Multi-line text input box
HTML_EDITOR Rich text editor
CODE_EDITOR Code editor
ATTACHMENT Attachment, picture
MAP The map
DIVIDE The divider
TPL Customize HTML templates
COMBINE Form a joint
HIDDEN hidden
EMPTY Empty (still occupied component location)
👇 The following components are complex to use. You are advised to use them after familiarize yourself with JPA
REFERENCE_TREE Tree reference
REFERENCE_TABLE Table references
CHECKBOX Check box
TAB_TREE Pops up a tree
TAB_TABLE_REFER A multiple-choice form
TAB_TABLE_ADD Add one-to-many

Five, the reference

The official documentation