1. Quick Start
Maven Dependencies
Choose the dependency based on your Java version:
<!-- Java 17 -->
<dependency>
<groupId>io.github.ezadmin126</groupId>
<artifactId>ezadmin-java17-spring-starter</artifactId>
<version>3.0.7</version>
</dependency>
<!-- Java 8 -->
<dependency>
<groupId>io.github.ezadmin126</groupId>
<artifactId>ezadmin-java8-spring-starter</artifactId>
<version>3.0.7</version>
</dependency>
Enable Configuration
Add @EnableEzadmin annotation to your Spring Boot main class:
@SpringBootApplication
@EnableEzadmin
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
After starting the application, JSON configuration files will take effect automatically without additional configuration.
Visit http://localhost:{port}/topezadmin/edit/create- to start AI-generated lists and forms.
application.yml Configuration
Configure EzAdmin parameters in application.yml:
topezadmin:
# Cache switch, recommended to set false during development
cacheFlag: false
# Data source configuration (comma-separated for multiple)
datasourceBeanNames: 'dataSource'
# File upload configuration
uploadPath: /data/upload
downloadUrl: /core/downloadDesc.html?fileId=
uploadUrl: /system/upload.html
# Log configuration
logType: 1000-10000
# UI configuration
adminStyle: layui
layout: fluid
# System routing configuration
clearUrl: /topezadmin/clearCache.html
signoutUrl: /login/signout.html
indexUrl: /doc/index.html
navUrl: /laynavs.html
# AI feature configuration (optional)
apiUrl: https://api.deepseek.com/v1/chat/completions
apiKey: sk-xxxxxxxxxxxxxxxx
model: deepseek-chat
temperature: 0.8
| Configuration Item | Description | Default Value |
|---|---|---|
cacheFlag |
Whether to enable config file caching | true (production) / false (development) |
datasourceBeanNames |
Data source bean name(s), comma-separated for multiple | dataSource |
uploadPath |
File upload storage path | - |
logType |
Log level configuration | 1000-10000 |
adminStyle |
Admin interface style | layui |
layout |
Page layout mode | fluid |
apiUrl |
AI service API endpoint | - |
apiKey |
AI service API key | - |
model |
AI model name | deepseek-chat |
temperature |
AI generation randomness parameter (0-1) | 0.8 |
2. Configuration Format
JSON configuration file paths:
- List configuration:
topezadmin/config/layui/dsl/list/*.json - Form configuration:
topezadmin/config/layui/dsl/form/*.json
List Configuration Structure
{
"id": "List ID",
"name": "List Name",
"dataSource": "Data source bean name",
"initApi": "Custom API (optional)",
"hideSearch": false,
"body": {
"emptyShow": "-",
"showIndex": true,
"selectable": true,
"rowActionWidth": 175
},
"tabList": [],
"search": [{"row": []},{"row": []}],
"column": [],
"tableButton": [],
"rowButton": [],
"express": {
"main": "Query SQL expression",
"orderBy": "order by xxx",
"groupBy": "group by xxx",
"count": "Custom count statement"
}
}
Form Configuration Structure
{
"id": "Form ID",
"name": "Form Name",
"dataSource": "Data source bean name",
"successUrl": "Redirect URL after successful save",
"cardList": [{
"type": "card",
"label": "Card Title",
"fieldList": [{"row": []},{"row": []}],
"buttonList": []
}],
"buttonList": [],
"initExpress": [],
"submitExpress": [],
"deleteExpress": [],
"statusExpress": []
}
3. Component Configuration
Basic Structure
{
"item_name": "Field name (UPPERCASE)",
"label": "Display label",
"component": "Component type",
"alias": "SQL alias (optional)",
"jdbcType": "Data type (optional)",
"operator": "Operator (optional)",
"initData": {
"dataJson": [{"label":"Option 1","value":"1"}],
"dataSql": "SELECT value,label FROM table",
"dataSource": "Data source name"
},
"props": {
// Layui native properties or custom properties
}
}
Common props Attributes
All components' props support the following common attributes:
| Attribute | Type | Description | Example |
|---|---|---|---|
placeholder |
String | Input placeholder text | "Please enter..." |
lay-verify |
String | Layui validation rules | "required", "phone", "email" |
required |
Boolean | Whether required (shows red *) | true / false |
disabled |
Boolean | Whether disabled | true / false |
readonly |
Boolean | Whether read-only | true / false |
description |
String | Field description text (shown below input) | "Please enter your real name" |
validate |
Object | jQuery Validate validation rules (see details below) | See example below |
jQuery Validate Validation Configuration
Configure more complex form validation rules via props.validate:
{
"props": {
"validate": {
"rule": {
"required": true,
"minlength": 2,
"maxlength": 20,
"range": [0, 100],
"email": true,
"url": true,
"number": true,
"digits": true
},
"message": {
"required": "This field cannot be empty",
"minlength": "Enter at least 2 characters",
"maxlength": "Enter at most 20 characters",
"range": "Enter a number between 0-100",
"email": "Enter a valid email address",
"url": "Enter a valid URL",
"number": "Enter a number",
"digits": "Enter an integer"
}
}
}
}
Common Validation Rules:
required: Required field validationemail: Email formaturl: URL formatnumber: Numberdigits: Integerminlength/maxlength: Length constraintsmin/max: Value rangerange: Value range (array form)uploadMin/uploadMax: Upload file count limits (upload component only)
1. lay-verify for Layui native validation (validates on submit)
2. validate for jQuery Validate validation (real-time validation, more powerful)
3. Both can be used together, recommend validate for complex validation
4. Routing Rules
| URL | Description |
|---|---|
/topezadmin/list/page-{id} |
List page |
/topezadmin/list/data-{id} |
List data API |
/topezadmin/form/page-{id} |
Form page |
/topezadmin/form/data-{id} |
Form initialization data API |
/topezadmin/form/submit|delete|status-{id} |
Form submit/delete/status update API |
/topezadmin/edit/create- |
AI create list/form + drag-and-drop |
/topezadmin/edit/list-{id} | /topezadmin/edit/form-{id} |
AI modify list/form + drag-and-drop |
/topezadmin/dsl/list-{id} | /topezadmin/dsl/form-{id} |
Source code editing |
5. Important Notes
- Field naming convention:
item_namemust be uppercase and match database field names - Data format:
initDatasupports bothdataJson(static) anddataSql(dynamic) methods - Template syntax: Supports laytpl template syntax, e.g.,
{{=d.field}} - Property compatibility:
propssupports all Layui native properties and third-party plugin properties - Expression engine: Based on QLExpress, supports Java syntax and SQL splicing
- Multiple data sources: Defaults to configured
dataSource, can specify other data sources ininitData - Validation rules: Supports all jQuery Validate validation rules
1. Use uppercase field names for consistency
2. Use expressions wisely to avoid complex SQL
3. Make good use of component props for customization
4. Leverage AI prompts to quickly generate configuration files
6. AI Development Workflow
1. Parse user request to check if it contains SQL
2. If contains SQL, parse SQL and generate DSL
3. If no SQL, send all table names to AI model to analyze relevant tables
4. Get relevant table field information and generate DSL
1. Send all current DSL information to AI model to analyze what needs modification
2. If involves express, send all tables to AI model
3. If no express involved, let AI model specify which nodes need what modifications
4. Perform DSL patch operation and save modified DSL