Technology Sharing

AI framework (low-code development)

2024-07-08

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Advance Note:

文章是实时更新,写了就会更。
文章是黑马视频的笔记,如果要自己学可以点及下面的链接:
https://www.bilibili.com/video/BV1pf421B71v/

1. According to the introduction

1. Version Introduction

In order to meet the diverse development needs, Ruyi provides multiple versions

  • RuoYi-Vue (SpringBoot Vue's single project)

  • RuoYi-Cloud (microservice version of SpringCloud Vue project)

  • RuoYi-App (Uniapp Vue mobile version)

    RuoYi-APP does not provide a backend, but can be adapted to RuoYi-Vue and RuoYi-Cloud

  • RuoYi-other (if based on third-party version)

2. Technology selection

This notebook uses RuoYi-Vue

technologyVersion
JDK1.8 and above
Mysql5.7 and above
Redis3.0 and above
Node12 and above

3. Project address

  • Front-end: https://gitee.com/zi-ning/RuoYi-Vue3
  • Backend: https://gitee.com/y_project/RuoYi-Vue

2. Project Construction

1. Backend project construction

1.1 Git clone project

https://gitee.com/y_project/RuoYi-Vue

1.2 Import MySQL

  1. Create a database
  2. Find the backend projectsqlFolder, which contains two sql scripts, execute [contains 30 tables]
  3. Change the database configuration in the SpringBoot project configuration file to your own

1.3 Start Redis

1.4 Start the backend project

项目的启动类在ruoyi-admin模块中的RuoYiApplication中

1.5 Description

The front-end that comes with the back-end project is the Vue2 version. Now we all use Vue3, so we can delete it directly.

2. Front-end construction

2.1 Git clone front-end project

https://gitee.com/zi-ning/RuoYi-Vue3

2.2 Download front-end dependencies

npm install

2.3 Running the front-end project

npm run dev

3. Getting Started Case

Now we need a course management module. The front-end page of this module needs a conditional query box, a data display box, a course addition box, and a course modification box.

1. Prepare the table structure and import it into the database

#SQL示例
CREATE TABLE courses(
    id              INT AUTO_INCREMENT PRIMARY KEY,
    code            VARCHAR(50)    NOT NULL,
    discipline      VARCHAR(100)   NOT NULL,
    course_name     VARCHAR(255)   NOT NULL,
    price           DECIMAL(10, 2) NOT NULL,
    target_audience VARCHAR(255),
    description     TEXT,
    created_at      TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at      TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

2.Configure code generation information [Important]

这一步是通过手动配置,从而生成对应的代码
  1. Start the front-end and back-end projects and enter the front-end page

  2. Select System Tools - Code Generation - Import

    image-20240703143917551

  3. Select the table you just created and click OK [this will hand over the form to the code generator for management]

    image-20240703144032676

    image-20240703144047729

  4. Click the edit button behind the corresponding form [you can view basic information, field information, generation information, etc.]

    image-20240703144140807

    image-20240703144421684

  5. Click Basic Information: Modify the entity class name and author name here

    这里设置的实体类名称就是后面他自动生成的实体类名
    

    image-20240703144732399

  6. Click Field Information: Here you need to modify the field description, Java type, Java attribute, add, delete, and modify check box, query box, query method, and display type.

    1.字段描述:就用于将来展示的列名
    2.java类型:一般不用修改,检查一遍即可
    3.java属性:就是用来生成后面的实体类,注意驼峰命名
    4.增删改勾选框:一般是结合页面原型,如果页面中需要增删改某个字段,就勾上
    5.查询框:就是将来的条件查询,勾了就会在上面显示一个选择框
    6.查询方式:如果是等值就用=,如果是模糊就用like
    7.必填框:如果是必须输入就勾上
    8.显示类型:默认是文本框由用户输入,后面可以改成下拉框等
    
  7. Click to generate information: modify relevant information

    1.包路径
    2.生成模块名
    3.生成业务名
    4.生成功能名
    5.生成方式
    6.上级菜单:生成的页面在哪个模块下,默认在系统工具下
    

    image-20240703150129942

  8. Click Submit

3. Download the code and import the project

上一步配置完成之后,会生成三部分信息:前后端代码以及动态菜单【前端根据动态菜单动态显示页面】,导入项目就可以了
  1. Click the Download button on the right

    image-20240703150422081

  2. Import the downloaded dynamic menu SQL

    这一步不会新生成一个表,而是插入数据到sys_menu表中
    
  3. Import the front-end code [including API and views pages]

  4. Import java code into the admin module [three-tier architecture code and mybatis mapping file]

4. Restart the project

4. Detailed explanation of functions

1. Permission control management

什么是权限控制:不同权限的用户登录相同的系统,可以访问的页面不同
若依提供的权限管理模块:用户管理、角色管理、菜单管理、部门管理、岗位管理

1.1 RBAC

RBAC is a widely used access control model.RoleTo manageuserofMenu Permissions

image-20240703153321716

To achieve the above relationship, five tables are needed: user table, role table, menu table, user role table, role menu table

At the same time, Ruyi provides position and department modules to achieve more refined permission management

image-20240703153757466

The table relationships are as follows:

image-20240703153839336

1.2 Menu categories

  • Catalog: A large category of modules, which can be expanded after clicking, and is not used for page jumps.
  • Menu: Click to enter the corresponding page
  • Button: After clicking the corresponding button, there will be corresponding operations

2. Data dictionary

为什么要有数据字典?
前端页面中的一些表单选项可能在不同表单中都会出现,而单独编写后,后期如果要修改会很麻烦,因此使用数据字典统一管理这些字段

若依内置的数据字典包括:性别、状态等
功能包括:字典类型管理、字典数据管理

2.1 Table Relationship Description

image-20240703160713611

说明:
字典类型用于存储一类字典的统称,例如我有一个下拉框供用户选择城市,那么这类就可以命名为城市,然后字典数据表中存储具体的城市名,由外键指定属于哪一类字典

2.2 Use Cases

Change the subject management fields in the introductory case to data dictionary maintenance

  1. Add dictionary type

    image-20240703161457271

  2. Click the dictionary type to add data

    image-20240703161549616

    image-20240703161604641