篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第162天学习打卡(谷粒商城4 逆向生成所有微服务的CRUD)相关的知识,希望对你有一定的参考价值。
逆向生成所有微服务的CRUD代码
Product
把在Git上克隆下的RENREN-FAST-VUE拖入Visual Studio Code中之后,执行以下命令
npm install
npm run dev
执行成功后会出现: I Your application is running here: http://localhost:8001,点击这个链接进行查看。
![image-20210619163056893](https://image.cha138.com/20210619/105026ede39b4897b2ee7865be65c8cd.jpg)
登录这个页面使用的账号和密码都是admin,登录的页面的显示:
![image-20210619163350473](https://image.cha138.com/20210619/660b74765429404185423a2d85438e22.jpg)
在码云上搜索人人开源,选择下面这个:
renren-generator: 人人开源项目的代码生成器,可在线生成entity、xml、dao、service、vue、sql代码,减少70%以上的开发任务 (gitee.com)
![image-20210619163707435](https://image.cha138.com/20210619/c10ef69160da41a1b89610331b8791c9.jpg)
![image-20210619163800526](https://image.cha138.com/20210619/7003a560749c45f8b1ddffa89e9eb623.jpg)
在Git里面把下面克隆下来
$ git clone https://gitee.com/renrenio/renren-generator.git
![image-20210619164005326](https://image.cha138.com/20210619/8c5afa7d88e64dc3aef932f46be69d15.jpg)
把克隆下来的renren-generator里面的.git文件删除,然后放入gulimall这个总文件下
![image-20210619164301442](https://image.cha138.com/20210619/99e88ed8c0db4570ada8d2480fab8370.jpg)
![image-20210619164359661](https://image.cha138.com/20210619/5c81b662cd0341f09652bdaf9e85e4f0.jpg)
![image-20210619164635184](https://image.cha138.com/20210619/f68747ebed1540ebab1129f07b8b5829.jpg)
修改renren-generator的配置文件
![image-20210619165314143](https://image.cha138.com/20210619/1e8ffe90f14147eaa2e4209f42fb2508.jpg)
![image-20210619170245617](https://image.cha138.com/20210619/2920fe81ee034ed38f4cc20a879d83f5.jpg)
启动这个generator项目之后,访问localhost:80
![image-20210619172214274](https://image.cha138.com/20210619/6a0a2b2845e04e58877851909b645bd1.jpg)
![image-20210619172230537](https://image.cha138.com/20210619/23989c45da0c4fabab0e78759bcb7577.jpg)
![image-20210619172409819](https://image.cha138.com/20210619/7f010ca3a84d41eda08196e676c2a9a4.jpg)
生成代码的压缩包解压把里面的main文件夹复制到gulimall-product里面的main
![image-20210619174118865](https://image.cha138.com/20210619/ad218b53d3fe462681854417a8e8ecdc.jpg)
![image-20210619174334793](https://image.cha138.com/20210619/48e11f6c7db44c81921ef25a84e73ec2.jpg)
创建一个maven模块
![image-20210619185900432](https://image.cha138.com/20210619/78b379f58dbb4d649f99fc5652421cba.jpg)
创建的gulimall-common里面需要的文件我们从renren-fast里面拷贝
![image-20210619195657207](https://image.cha138.com/20210619/2b6b01af1fef474198f4684bcf3b73b9.jpg)
![image-20210619195912680](https://image.cha138.com/20210619/79c60406243e4b4fb8019d138f92060a.jpg)
gulimall-common里面的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>gulimall1-ware</artifactId>
<groupId>com.doudou.gulimall1</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>gulimall-common</artifactId>
<description>每个微服务公共的依赖, bean,工具类等</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.3.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</dependency>