项目准备工作

人人开源搭建后台管理系统

码云搜索人人开源

image-20220118122020882

renren-fast-vue:前端

renren-generator:代码生成器

renren-fast:后台管理系统

用git clone即可拉取模板项目,拉去完后记得将.git文件夹删除,因为这代表着它连接的还是原来的仓库。

删除.git后,将项目上传到自己gitee的仓库

数据库搭建

在renren-fast项目中dp文件夹里,运行mysql.sql文件

image-20220118122556428

更改配置文件中数据库账号和密码

image-20220118132909182

启动后端测试

image-20220118132928409

前端项目搭建

拉取renren-fast-vue项目,删除.git文件,用cnpm install进行依赖包的安装

可能出现的错误:

错误实例:
p ERR! stack Error: Command failed: F:\Python\python.EXE -c import sys; print “%s.%s.%s” % sys.version_info[:3];
gyp ERR! stack File “”, line 1
gyp ERR! stack import sys; print “%s.%s.%s” % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
UnicodeEncodeError: ‘charmap’ codec can’t encode characters in position 509-510: character maps to 
gyp ERR! configure error

gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Traceback (most recent call last):
File “F:\Code\renren-fast-vue\node_modules_node-gyp@3.8.0@node-gyp\gyp\gyp_main.py”, line 16, in

解决方法:

renren开源里面的代码使用的是python2.7版本的代码,因此只3.0以上的版本不适用在C盘下安装C:/Python27 或自行安装添加环境配置.
至此python环境问题解决.

node环境与sass不兼容问题: 详情查询:https://github.com/sass/node-sass

image-20220118130602670

intsall成功后,npm run dev启动前端

image-20220118131251868

用户名密码均为admin

image-20220118133630569

后端模块代码生成

拉取renren-genrator,删除.git文件

修改generator.properties文件

#路径
mainPath=com.wskh.gulimall
#包名
package=com.wskh.gulimall
moduleName=ware
#作者名
author=WSKH 
#Email
email=1187560563@qq.com
#数据库表前缀
tablePrefix=wms_

#和数据库类型的转换对应表
tinyint=Integer
smallint=Integer
mediumint=Integer
int=Integer
integer=Integer
bigint=Long
float=Float
double=Double
decimal=BigDecimal
bit=Boolean

char=String
varchar=String
tinytext=String
text=String
mediumtext=String
longtext=String


date=Date
datetime=Date
timestamp=Date

NUMBER=Integer
INT=Integer
INTEGER=Integer
BINARY_INTEGER=Integer
LONG=String
FLOAT=Float
BINARY_FLOAT=Float
DOUBLE=Double
BINARY_DOUBLE=Double
DECIMAL=BigDecimal
CHAR=String
VARCHAR=String
VARCHAR2=String
NVARCHAR=String
NVARCHAR2=String
CLOB=String
BLOB=String
DATE=Date
DATETIME=Date
TIMESTAMP=Date
TIMESTAMP(6)=Date

int8=Long
int4=Integer
int2=Integer
numeric=BigDecimal

nvarchar=String

修改application.yml配置,指定要自动生成对象所在的数据库

image-20220118133543652

如果有需要,还可以修改自动生成后的代码模板

image-20220118134321840

默认controller会携带@RequiresPermissions注解,由于暂时用不到该注解(不注释可能会引起报错),所以在controller模板中将该注解注释掉

image-20220118134503462

启动renren-generator模块,进入网址:localhost

image-20220118133910304

选择要生成的数据表,点击生成代码,下载代码.zip,解压后内容如下:

image-20220118134144602

将main文件夹复制,粘贴到对应模块的main下,会完成代码自动替换

image-20220118134551941

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐