逆向工程搭建和使用
下载逆向工程项目
使用git下载
git clone https://gitee.com/renrenio/renren-generator.git
配置逆向工程的参数
讲创建好的逆向工程导入gulimall项目中,并修改数据库配置及一些参数
以coupon模块为例
mainPath=com.xfwang.gulimall
#\u5305\u540D
package=com.xfwang.gulimall
moduleName=coupon
#\u4F5C\u8005
author=xfwang
#Email
email=[email protected]
#\u8868\u524D\u7F00(\u7C7B\u540D\u4E0D\u4F1A\u5305\u542B\u8868\u524D\u7F00)
tablePrefix=sms_
yml文件
url: jdbc:mysql://47.103.206.82:3306/gulimall_sms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
修改逆向工程的模板并使用
修改模板中的controller模板
注释掉
//@RequiresPermissions("${moduleName}:${pathName}:list")
并去掉shiro的import
使用
运行项目打开浏览器
localhost/index.html 生成相应的代码
创建gulimall公用模块
将生成好的代码放入项目中解决报错问题创建公共依赖模块
项目上右击(在项目上右击很重要)new modules— maven—然后在name上输入gulimall-common。
在common项目的pom.xml中添加
<!-- mybatisPLUS-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.2</version>
</dependency>
<!--简化实体类,用@Data代替getset方法-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</dependency>
<!-- httpcomponent包。发送http请求 -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.13</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
再在各个模块中添加common的依赖即可
renren-fast----utils包下的Query和PageUtils、R、Constant复制到common项目的java/com.xfwang.common.utils下