代码拉取完成,页面将自动刷新
例如我的系统层级结构是:平台->银行->服务商->商家,我们暂且叫这四个层级为机构类型,如下图:
例如现在平台下有10个银行,每个银行有20个服务商,每个服务商有30个商户,并且要求每个银行、服务商、商户都有自己的角色、权限、用户管理
[
{ "id":1, "parent_id":0, "name":"平台", "code":"platform" },
{ "id":2, "parent_id":1, "name":"银行", "code":"bank" },
{ "id":3, "parent_id":2, "name":"服务商", "code":"service_provider" },
{ "id":4, "parent_id":3, "name":"商户", "code":"shop" }
]
// "code": "string,50,银行编码,1"
// code为数据库字段名称,string是golang中的数据类型,50是字段长度,银行编码是字段描述,1是字段顺序
{
"bank": {
"code": "string,50,银行编码,1",
"name": "string,80,银行名称,2",
"contact_name": "string,40,联系人,3",
"service_phone": "string,20,联系电话,4",
"org_type_id": "int64, 20,所属机构类型ID,5",
"org_type_name": "string,40,所属机构类型名称,6",
"account": "string,40,管理员账号,7"
},
"service_provider": {
"name": "string,80,服务商名称,1",
"contact_name": "string,40,联系人,2",
"service_phone": "string,20,联系电话,3",
"address": "string,80,联系地址,4",
"org_type_id": "int64, 20,所属机构类型ID,5",
"org_type_name": "string,40,所属机构类型名称,6",
"account": "string,40,管理员账号,7"
},
"shop": {
"name": "string,80,商家名称,1",
"contact_name": "string,40,联系人,2",
"service_phone": "string,20,服务电话,3",
"address": "string,80,商家地址,4",
"org_type_id": "int64, 20,所属机构类型ID,5",
"org_type_name": "string,40,所属机构类型名称,6",
"account": "string,40,管理员账号,7"
},
"desc": {
"bank": "银行",
"service_provider": "服务商",
"shop": "商家"
}
}
cd gotools/cmd
go build gotools.go
// MacOS/Linux
./gotools -newProject hello
// Windows windows系统下建议使用git bash命令行工具,下载地址:https://git-scm.com/download/win
./gotools.exe -newProject hello
// 启动生成的go程序
cd gotools/output
// 进入项目根目录
cd hello-go
// 下载依赖包
go mod tidy
// 运行
cd cmd && go run main.go
// 启动生成的前端Vue程序
cd gotools/output
cd hello-admin
npm install && npm run dev
1. 首先在configs/new_gen_module.json中配置数据库表结构,例如:
{
"student": {
"code": "string,50,银行编码,1",
"name": "string,80,银行名称,2",
"contact_name": "string,40,联系人,3",
"service_phone": "string,20,联系电话,4",
"org_type_id": "int64, 20,所属机构类型ID,5",
"org_type_name": "string,40,所属机构类型名称,6",
"account": "string,40,管理员账号,7"
},
"teacher": {
"name": "string,80,服务商名称,1",
"contact_name": "string,40,联系人,2",
"service_phone": "string,20,联系电话,3",
"address": "string,80,联系地址,4",
"org_type_id": "int64, 20,所属机构类型ID,5",
"org_type_name": "string,40,所属机构类型名称,6",
"account": "string,40,管理员账号,7"
},
"class": {
"name": "string,80,商家名称,1",
"contact_name": "string,40,联系人,2",
"service_phone": "string,20,服务电话,3",
"address": "string,80,商家地址,4",
"org_type_id": "int64, 20,所属机构类型ID,5",
"org_type_name": "string,40,所属机构类型名称,6",
"account": "string,40,管理员账号,7"
},
"desc": {
"student": "学生",
"teacher": "老师",
"class": "班级"
}
}
2. 然后只需要执行如下命令, 输入项目名称projectName即可,这里项目名称是hello
// MacOS
./gotools -newModule -projectName hello
// Windows
./gotools.exe -newModule -projectName hello
3. 在output目录下会生成gencodes文件夹,包含了后端代码gocode目录,前端代码vuecode目录
有疑问可以加我微信:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型