人人开源项目拉取
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: rootpassword: rooturl: jdbc:mysql://192.168.43.196:3306/gulimail_pmsdriver-class-name: com.mysql.cj.jdbc.Driver#告訴Mybatis-plus,sql映射文件位置 mybatis-plus:mapper-locations: classpath:/mapper/**/*.xml#定義實體類主鍵生成規則global-config:db-config:id-type: auto11.在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 dlf@gmail.com* @date 2021-10-30 17:12:30*/ public interface BrandService extends IService<BrandEntity> {PageUtils queryPage(Map<String, Object> params); }13.接下來一次生成其他模塊的代碼,重復上面的步驟。
總結
- 上一篇: 鸟哥的linux网络基础,鸟哥的 Lin
- 下一篇: 如何计算MP3总时长的问题(三)--对于