Management background system based on SpringBoot 2

Download the demo of this article: http://www.wisdomdd.cn/Wisdom/resource/articleDetail.htm?resourceId=1062

A management background system based on SpringBoot 2, including user management, organization management, role management, function point management, menu management, permission assignment, data permission assignment, code generation and other functions

The system is based on Spring Boot2 technology, and the front end adopts Layui2. The database uses MySQL as an example, which is theoretically a cross-database platform.

The basic technology stack is derived from <<The Essence of Spring Boot 2>>, which I wrote for the Electronic Industry Press (there are also various examples in each chapter of this book, but Springboot-plus is more about application than teaching)

Current version: 1.0.0

Video introduction: https://pan.baidu.com/s/1dFPoaT7

Management background system based on SpringBoot 2

Management background system based on SpringBoot 2

Management background system based on SpringBoot 2

Management background system based on SpringBoot 2

Management background system based on SpringBoot 2

Management background system based on SpringBoot 2

1 Instructions for use

1.1 Installation Instructions

After getting the code from Git, import this Maven project through the IDE, including two sub-projects

  • admin-core , the core package, contains cache, data permissions, public JS and HTML pages.

  • admin-console, system management functions, including users, organizations, roles, permissions, data permissions, code generation and other management functions

com.ibeetl.admin.CosonleApplication is the system startup class. Under the admin-console package, the database needs to be initialized before running this. It is located in doc/starter-mysql.sql. Currently, only mysql and oracle scripts are provided. Theoretically supports all databases

You also need to modify the SpringBoot configuration file application.properties, modify your database address and access user

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/starter?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=falsespring.datasource.username=rootspring.datasource.password=123456

It is recommended that you do not modify other configuration options for the time being before you are thoroughly familiar with the plus system, so that the system cannot be accessed.

This system is based on Spring Boot 2, so please be sure to use JDK8, and open the compile option parameters, and recompile the project. If you do not use the parameters feature of Java8, the system cannot be used normally

Run CosonleApplication, then visit http://127.0.0.1:8080/ and enter admin/123456 to log in directly to the management system

If you run the error after successful startup: the variable userId is undefined, on line 6, it is because you have not enabled parameters

1.2 Creating Subsystems

SpringBoot-plus is an architecture suitable for splitting a large system into small systems, or a micro-service system. Therefore, if you need to create your own business system, such as a CMS subsystem, it is recommended that you do not add code to SpringBoot-Plus , it should be to create a new maven project, rely on admin-core, or rely on admin-console (if you have background management requirements, usually have, but not required)

To create a subsystem, you can go to Code Generation > Subsystem Generation, enter the maven project path, and the package name, and you can directly generate a runnable SpringBoot-Plus-based subsystem

1.2.1 Configuring the Subsystem

The subsystem can run directly in the IDE without any configuration. If you want to run it in a packaged jar, you need to add

<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins></build>

If you want to package it into war and run it under tomcat, you need to modify maven packaged as war

<packaging>war</packaging>

1.2.2 Menu System

The system provides three types of menus by default

  • A system-level menu, which appears at the top of the page and represents a subsystem

  • Navigation menu, which appears on the left side of the page, clicking on the navigation will open all menus under it

  • Menu, click to open the menu will locate the page, the menu must be associated with a function point.

It is recommended to create a new subsystem to place the new functionality

SpringPlus-Boot does not organize the entire system with menus or buttons, but organizes the functions provided by the entire system with function points. If you want the menu to take effect, you must first see a function point and the function point has an access address, and then associate the menu with this function point

It is a good habit for SpringBoot-Plus to establish function points first. The function points are organized into a tree, which represents the functions that the system should provide. We will see that the function points are closely related to menus, permissions, and data permissions when we look at the code. relation

1.2.2 Add code

You can refer to 1.3 Business Code Generation to generate initialization code

1.3 Business code generation

Before introducing how to use Plus to develop the system, first introduce the code generation function. This function can generate a total of 14 files of front-end and back-end code. You can learn how to develop this system through the preview function.

Management background system based on SpringBoot 2

Code generation Code generation is performed for tables, including JS, JAVA, SQL and HTML, which can be previewed directly through the preview function. Before generating the code to the local, some parameters need to be modified, otherwise, the code will be displayed in English after the code is generated.

  • Display field: When this entity is displayed anywhere, it can represent the name of this entity, such as user name, organization name

  • Variable name: You can set a shorter name by yourself, and this variable name will be used for front-end and back-end variables

  • urlBase: The subsystem you plan, the final access path is urlBase + variable name

  • system: the name of the sql directory

Other modifications are

Whether to include import and export, if selected, the code for import and export will be generated, and the import and export template needs to refer to existing functions (such as data dictionary) to complete

Whether to include attachment management, if selected, the business object can be associated with a set of attachments, such as a set of attachments associated with a customer, or a set of attachments associated with application information.

The display name of the field information, this is used for the front-end list, the display of the form, the Chinese name should be entered

As a search, you can check several search conditions, and the system will automatically generate a search configuration class

If the field is associated with a data dictionary, set a data dictionary so that the generated interface will become a drop-down list

1.3.1 Front-end code

The front-end code adopts the JS framework of layui and uses the method of on-demand loading. For the documentation, please refer to http://www.layui.com/doc/base/infrastructure.html.

  • index.js: System entry JS, including queries and tables

  • add.js : all JS for adding actions

  • edit.js: All JS for editing operations

  • del.js: delete all JS for the action

Basic JS

  • Common.js: encapsulates common JS functions, such as jquery's post method, layui's window method

  • Lib.js encapsulates business-related methods, such as submitForm, loadOrgPanel and other methods

1.3.2 HTML code

The page uses layui, and the documentation refers to http://www.layui.com/demo/

The template language uses Beetl, the documentation refers to ibeetl.com

  • index.html: Function Home

  • add.html: add home page

  • edit.html: Edit Action Homepage

The advantage of using layui is that it comes with the management of pages and components, as well as JS, which can complete most business needs.

Basic UI components:

  • orgInput.tag.html Organization Input Box

  • simpleDictSelect.tag.html Dictionary dropdown

  • simpleDataSelect.tag contains a drop-down list of key-value

  • searchForm.tag.html Generic Search Form

  • submitButtons.tag.html Submit button

  • accessButton.tag.html normal button (including permissions)

  • attachment.tag.html attachment management component

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324939353&siteId=291194637