1. renren-fast-vue/renren-fast
https://gitee.com/renrenio
Clone to local:
git clone https://gitee.com/renrenio/renren-fast-vue.git
git clone https://gitee.com/renrenio/renren-fast.git
Delete the ".git" of the copied "renren-fast", copy it to the root directory of the "gulimall" project, and use it as a module of gulimall
Create a "gulimall_admin" database, and then execute the SQl script in "renren-fast/db/mysql.sql"
Modify the "application-dev.yml" file, the default is the dev environment, modify the url to connect to mysql and the username and password
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.137.14:3306/gulimall_admin?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username: root
password: root
Start "gulimall_admin", then visit "http://localhost:8080/renren-fast/"
Install node.js, and install the warehouse
npm config set registry http://registry.npm.taobao.org/
1
PS D:\tmp\renren-fast-vue> npm config set registry http://registry.npm.taobao.org/
PS D:\tmp\renren-fast-vue> npm install
npm WARN [email protected] requires a peer of ajv@>=4.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-sass@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
up to date in 17.227s
PS D:\tmp\renren-fast-vue>
123456789
PS D:\tmp\renren-fast-vue> npm run dev
> [email protected] dev D:\tmp\renren-fast-vue
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
10% building modules 5/10 modules 5 active ...-0!D:\tmp\renren-fast-vue\src\main.js(node:19864) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19864) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:19864) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
12345678910111213141516
常见问题1:“Module build failed: Error: Cannot find module 'node-sass”
During the operation, "Module build failed: Error: Cannot find module'node-sass' error report" appears, the solution
Use npm install -g cnpm --registry=https://registry.npm.taobao.org to download from Taobao mirror, and then cnpm downloads successfully.
Finally, enter cnpm install node-sass --save. npm run dev can finally run! ! !
————————————————
Copyright statement: This article is the original article of the CSDN blogger "A beautiful silhouette in the sunset", and it follows the CC 4.0 BY-SA copyright agreement. Please attach the original source for reprinting. Link and this statement.
Original link: https://blog.csdn.net/qq_38401285/article/details/86483278
Common problem 2: cnpm-Resolve "cnpm: Cannot load file C:\Users\93457\AppData\Roaming\npm\cnpm.ps1 because it is forbidden to run scripts on this system. For more information..."
https://www.cnblogs.com/500m/p/11634969.html
The root cause of all problems is in "node_modules". Before npm install, this folder should be deleted, and then install and run.
Run npm run dev again to return to normal:
2. renren-generator
1.clone
https://gitee.com/renrenio/renren-generator.git
Then place the project under the path of "gulimall", then add the Module, and submit it to github
2. Configure application.yml in renren-generator
url: jdbc:mysql://192.168.56.10:3306/gulimall-pms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
3. Modify the configuration
renren-generator/src/main/resources/generator.properties
#代码生成器,配置信息
# 主目录
mainPath=com.bigdata
#包名
package=com.bigdata.gulimall
#模块名
moduleName=product
#作者
author=cosmoswong
#Email
[email protected]
#表前缀(类名不会包含表前缀) # 我们的pms数据库中的表的前缀都pms
# 如果写了表前缀,每一张表对于的javaBean就不会添加前缀了
tablePrefix=pms_
(The garbled Baidu IDEA here sets the properties encoding)
4. Run "renren-generator"
访问:<http://localhost:80/
Click "renren-fast", you can see that it lists all the tables of "renren-fast":
Select all the tables, then click "Generate Code", unzip the downloaded "renren.zip", take out the main folder, and place it in the main directory of the "gulimall-product" project.
The following modules are also operated in the same way.
But for "undo_log", there is a problem
Its data type is "longblob" type. After reverse engineering, the corresponding data type is unknown:
How to solve this problem?
5. Configure the project application.yml
spring:
datasource:
username: root
password: root
url: jdbc:mysql://192.168.56.10:3306/gulimall-pms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
driver-class-name: com.mysql.jdbc.Driver
# MapperScan
# sql映射文件位置
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
global-config:
db-config:
id-type: auto
The difference between classpath and classpath*:
classpath: only find files in your class path;
classpath*: not only include the class path, but also the jar file (class path) for searching
. The use of classpath*: when there are multiple Classpath path, and load files under multiple classpath paths (most of which will not be encountered in this case) at the same time, it plays a role, if not added , it means that only the first classpath path is loaded.
6. Add annotation @MapperScan() to the main startup class
Scan the *Mapper.java file
7. Test
@SpringBootTest
class gulimallProductApplicationTests {
@Autowired
BrandService brandService;
@Test
void contextLoads() {
BrandEntity brandEntity = new BrandEntity();
brandEntity.setDescript("哈哈1哈");
brandEntity.setName("华为");
brandService.save(brandEntity);
System.out.println("保存成功");
}
}