若依基础框架开发指南
若依后端开发指南
在若依平台创建自己的项目模块
1.在若依的项目根目录创建module,这里建议是先建空项目,然后再导入自己需要的依赖
2.在ruoyi-admin下的启动类上加上Bean和Mapper的扫描注解
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class },,scanBasePackages ={"com.stitchcodes.**"}) @ComponentScan(value = {"com.ruoyi.**","com.stitchcodes.**"}) @MapperScan(value = {"com.stitchcodes.mapper.**"}) public class RuoYiApplication { public static void main(String[] args) { SpringApplication.run(RuoYiApplication.class, args); System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + " .-------. ____ __ \n" + " | _ _ \\ \\ \\ / / \n" + " | ( ' ) | \\ _. / ' \n" + " |(_ o _) / _( )_ .' \n" + " | (_,_).' __ ___(_ o _)' \n" + " | |\\ \\ | || |(_,_)' \n" + " | | \\ `' /| `-' / \n" + " | | \\ / \\ / \n" + " ''-' `'-' `-..-' "); } }
|
3.在ruoyi-admin下的Maven配置文件中导入自己的模块
4.如果创建自己的模块时选择的不是空模块,需要去项目的Maven配置文件中加上自己模块的module配置
1 2 3 4 5 6 7 8 9
| <modules> <module>ruoyi-admin</module> <module>ruoyi-framework</module> <module>ruoyi-system</module> <module>ruoyi-quartz</module> <module>ruoyi-generator</module> <module>ruoyi-common</module> <module>aliyun-iot-server</module> </modules>
|
若依接入MybatisPlus
1.在项目中引入依赖
1 2 3 4 5
| <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.3.4</version> </dependency>
|
2.修改ruoyi-framework的config包下的MybatisConfig类,将其中的SqlSessionFactory的bean注释掉
3.修改ruoyi-admin下的项目配置文件application.yml,将其中的mybatis相关的配置修改为对应的mybatis-plus配置即可
1 2 3 4 5 6 7 8
| mybatis-plus:
type-aliases-package: com.ruoyi.**.domain,com.stitchcodes.**.domain
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
若依基础工具
获取在线用户信息
1 2 3
| LoginUser loginUser = SecurityUtils.getLoginUser(); Long currentUserId = SecurityUtils.getUserId(); ...
|
若依前端开发指南
若依菜单页面开发
1.在**/src/views**下创建目录进行菜单页面开发
2.在**/src/router/index.js**路由文件中添加菜单,添加样例为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| { path: '/consumer', component: Layout, redirect: 'noredirect', meta: { title: "IOT消费组管理", icon: "user" }, children: [ { path: 'group', component: () => import('@/views/consumer/group/index'), name: 'group', meta: {title: '消费组管理', icon: 'user'} }, { path: 'connect', component: () => import('@/views/consumer/connect/index'), name: 'connect', meta: {title: '消息监控', icon: 'user'} } ] }
|
开启注册功能
若依在默认情况下并没有开启注册功能,在**/src/views/login.vue**的data中将register设置为true则开启了若依的注册功能
修改若依管理系统字样
1.修改**/src/views/login.vue**文件中的h3标题
2.修改**/src/views/index.vue**的模版内容修改首页文字
3.修改**/src/layout/component/Sidebar/Logo.vue**中data域下面的文字
4.修改.env.***文件中的若依管理系统文字
若依部署指南
nginx参考配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| server { listen 80; server_name localhost; charset utf-8;
location / { root /home/ruoyi/projects/ruoyi-h5; try_files $uri $uri/ /index.html; index index.html index.htm; } location /prod-api/ { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE_HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-NginX-Proxy true; proxy_pass http://localhost:8080/; } }
|