Get Started Quickly with Ruoyi Code Generator (2022)


foreword

Get started quickly and use the Ruoyi code generator
to directly save a set of curd


1. Start the Ruoyi framework

Skip this first,
directly refer to the official document
http://doc.ruoyi.vip/ruoyi/document/hjbs.html

2. Use the code generator

Refer to the official document to write
http://doc.ruoyi.vip/ruoyi/document/htsc.html#%E4%BB%A3%E7%A0%81%E7%94%9F%E6%88%90

1 Import the sample table

First create a new table in your backend database
for an example

drop table if exists sys_student;
create table sys_student (
  student_id           int(11)         auto_increment    comment '编号',
  student_name         varchar(30)     default ''        comment '学生名称',
  student_age          int(3)          default null      comment '年龄',
  student_hobby        varchar(30)     default ''        comment '爱好(0代码 1音乐 2电影)',
  student_sex          char(1)         default '0'       comment '性别(0男 1女 2未知)',
  student_status       char(1)         default '0'       comment '状态(0正常 1停用)',
  student_birthday     datetime                          comment '生日',
  primary key (student_id)
) engine=innodb auto_increment=1 comment = '学生信息表';

insert image description here

2 Use the built-in code to generate a zip file

insert image description here
insert image description here

2.1 Illegal mix of collations error resolution

Original link
https://blog.csdn.net/ahook/article/details/111880668

there is a pit

If an error is reported when clicking the import table

If the table cannot be imported according to the system code generation: Illegal mix of collations...

It is the table information_schema.tables that comes with mysql, which is associated with the tables of the Ruoyi system.
The information_schema is sorted by utf8_general_ci encoding. If you build a database, utf8_unicode_ci is selected by default.

Therefore, rebuild the Ruoyi database and use utf8_general_ci encoding.

problem solved.

Three Paste the contents of the zip file into the corresponding module

3.1 Paste background code

1
controller pasted into

The red circle is the project package name
insert image description here
and code package name
insert image description here
, but we found that the controller package name of the project
is not consistent with the controller package name of the generated code

The name of the project package is used here.
At this time, change the name of the controller package that generates the code to the package name of the project controller.

insert image description here

2 Paste the rest of the generated code
insert image description here
into
insert image description here
Discovery
insert image description here

This package name is the same as the package name of the generated code
without any changes

In this way, the background code is pasted

3.2 Paste the foreground code

Just paste it directly

3.3 Run menu sql statement

Open the database
, run the sql file,
and directly run the generated sql

4. Restart the frontend and backend

First maven clean to clear the compiled target
and then restart

Front-end ctrl+s to save

final effect
insert image description here


Summarize

Tip: Here is a summary of the article:
For example: the above is what I will talk about today. This article only briefly introduces the use of pandas, and pandas provides a large number of functions and methods that allow us to process data quickly and easily.

Guess you like

Origin blog.csdn.net/weixin_51751186/article/details/126959688