1.renren-fast 用来做后台系统:https://gitee.com/renrenio/renren-fast.git
2.renren-fast-vue 用来做前台系统:https://gitee.com/renrenio/renren-fast-vue.git
3.在桌面打开Git Bush
输入命令:git clone https://gitee.com/renrenio/renren-fast.git
git clone https://gitee.com/renrenio/renren-fast-vue.git
克隆两个项目到卓面
然后删除两个项目中的.git文件,将两个项目复制到gulimail聚合项目中
然后将renren-fast名字加入到聚合pom文件中
4.然后将renren-fast的pom文件添加到maven控制面板中,然后刷新启动renren-fast项目
但是这里renren-fast还是爆红,打开项目结构、,原来是没有配置JDK
5.安装renren-fast-vue前端项目的依赖:npm install
package.json中规定好了以来的版本,会根据这个来下载依赖:
但是这里报错说缺少python环境,查了原因是因为node版本wenti,将node版本由14换成10.16.3就能成功运行npm install命令来下载依赖了
6.依赖下载好了之后直接运行:npm run dev
访问路径:localhost:8001(账号/密码:admin)
7.clone人人开源的代码生成器:renren-generator
git clone https://gitee.com/renrenio/renren-generator.git
同样将项目放入gulimail聚合工程中,并在maven中引入pom文件,在工程结构中添加JDK
8.使用代码生成器生成代码:
(1)在yml文件中配置数据库ip,以及要生成模块的数据库表。这里要生成gulimail-product模块的代码所以数据库表为gulimail_pms
(2)在 generator.properties中配置包名等:
(3)启动代码生成器:(80端口)
它会将所有的表展示出来,我们勾选所有表,然后生成代码。将会下载一个压缩包,我们进行加压就行:生成的代码都在此文件夹中,我们将其复制到idea中相应的模块中就行
9.创建gulimail_common公共类:里面存放所有模块共用的配置
在pom文件中引入mybatisplus和lombok依赖,以及mysql驱动
10.配置gulimail-product模块的数据源以及mp相关配置:
创建yml文件:
spring:
datasource:
username: root
password: root
url: jdbc:mysql://192.168.43.196:3306/gulimail_pms
driver-class-name: com.mysql.cj.jdbc.Driver
#告诉Mybatis-plus,sql映射文件位置
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
#定义实体类主键生成规则
global-config:
db-config:
id-type: auto
11.在gulimail-product模块启动类需要加@MaperScan注解,告诉spring,Dao(Mapper)文件的位置:
package com.atguigu.gulimail.product;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/*
*配置mybatis-plus
* 1.导入依赖
* 2.使用@MapperScan注解
* 3.告诉Mybatis-plus,sql映射文件位置
* */
@MapperScan("com.atguigu.gulimail.product.dao")
@SpringBootApplication
public class GulimailProductApplication {
public static void main(String[] args) {
SpringApplication.run(GulimailProductApplication.class, args);
}
}
12.mybatis-plus中会继承Iservice接口,里面提供了增删改查的各种方法:
package com.atguigu.gulimail.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.uilts.PageUtils;
import com.atguigu.gulimail.product.entity.BrandEntity;
import java.util.Map;
/**
* 品牌
*
* @author dlf
* @email [email protected]
* @date 2021-10-30 17:12:30
*/
public interface BrandService extends IService<BrandEntity> {
PageUtils queryPage(Map<String, Object> params);
}
13.接下来一次生成其他模块的代码,重复上面的步骤。