一、ruoyi-vue-pro简介
ruoyi-vue-pro是一个基于Spring Boot和Vue.js的开源企业快速开发平台,提供了一整套通用的后台管理系统解决方案,包括但不限于如下特性:
- 权限管理
- 定时任务
- 数据库监控
- 代码生成器
该项目已经发布了七个版本,由于其灵活性、扩展性和易用性,备受广大开发者的欢迎。
二、安装步骤
- 下载源码:
$ git clone https://gitee.com/y_project/RuoYi-Vue-Pro.git
- 安装依赖: a. 后端java部分:
- JDK1.8+
- Maven
b. 前端vue部分: - Nodejs
- npm
- 配置数据库:
打开
ruoyi-admin/src/main/resources/application.yml
,修改对应的数据库连接信息。
datasource:
# 数据源类型
type: com.alibaba.druid.pool.DruidDataSource
# Underscore To CamelCase
name: db1
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ry-ui?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&autoReconnect=true&serverTimezone=Asia/Shanghai
username: root
password:
- 运行程序: a. 前端运行:
$ cd ruoyi-ui
$ npm install
$ npm run dev
b. 后端运行: 在项目根目录执行:
$ mvn clean install
$ java -jar ruoyi-admin/target/ruoyi-admin.jar
三、使用指南
- 登录页面:
浏览器访问
http://localhost:8080
即可进入ruoyi-vue-pro的登录页面,输入管理员账号和密码即可登录。 - 系统管理: 该模块包括了菜单管理、字典管理、系统配置等子模块:
// 菜单管理
<routes>
<route path="/menu" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
</routes>
// 字典管理
<routes>
<route path="/dict" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
</routes>
// 系统配置
<routes>
<route path="/config" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
</routes>
- 代码生成器
该模块用于生成数据库表对应的CRUD相关代码。生成后的代码放在
ruoyi-codegen
模块下,可以直接使用或者进行修改。
// 页面路由
<routes>
<route path="/tool/gen" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
</routes>
// 后端接口
public interface GeneratorService
{
List<TableInfo> selectTableList(TableInfo tableInfo);
byte[] generatorCode(String[] tableNames);
}
- 权限管理 该模块用于管理系统中的用户和角色,以及进行权限管理。
// 页面路由
<routes>
<route path="/system/user" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
<route path="/system/role" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
<route path="/system/menu" component="{Layout}">
<route path="/" component="{List}" exact />
<route path="/add" component="{Add}" />
<route path="/edit" component="{Edit}" />
</route>
</routes>
// 后端接口
public interface ISysUserService
{
List<SysUser> selectUserList(SysUser user);
SysUser selectUserByUserName(String userName);
SysUser selectUserById(Long userId);
int deleteUserByIds(String ids);
int updateUser(SysUser user);
int insertUser(SysUser user);
}
四、总结
ruoyi-vue-pro是一个非常实用的企业级快速开发平台,大大降低了开发人员的工作难度和工作量,同时提高了企业项目管理的水平和效率。本篇文章介绍了ruoyi-vue-pro的安装步骤和使用指南,希望能够帮助到需要使用这一平台的开发者。