mirror of
				https://github.com/bufanyun/hotgo.git
				synced 2025-11-04 08:13:45 +08:00 
			
		
		
		
	Merge branch 'bufanyun:v2.0' into v2.0-refactoring
This commit is contained in:
		@@ -15,10 +15,10 @@
 | 
			
		||||
5. 命令行运行 `pnpm -v` 若控制台输出版本号则前端环境搭建成功
 | 
			
		||||
 | 
			
		||||
### 后端环境
 | 
			
		||||
1. 下载golang安装 版本号需>=1.21
 | 
			
		||||
1. 下载golang安装 版本号需>=1.23
 | 
			
		||||
2. 国际: https://golang.org/dl/
 | 
			
		||||
3. 国内: https://golang.google.cn/dl/
 | 
			
		||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.19
 | 
			
		||||
4. 命令行运行 go 若控制台输出各类提示命令 则安装成功 输入 `go version` 确认版本大于1.23
 | 
			
		||||
5. 开发工具推荐 [Goland](https://www.jetbrains.com/go/)
 | 
			
		||||
 | 
			
		||||
### 使用说明
 | 
			
		||||
@@ -26,6 +26,6 @@
 | 
			
		||||
> 需要本地具有 git node golang 环境
 | 
			
		||||
 | 
			
		||||
- node版本 >= 16.0.0
 | 
			
		||||
- golang版本 >= 1.21
 | 
			
		||||
- golang版本 >= 1.23
 | 
			
		||||
- mysql版本 >= 5.7,引擎需要是 innoDB
 | 
			
		||||
- IDE推荐:Goland
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
### 环境要求
 | 
			
		||||
 | 
			
		||||
- node版本 >= v16.0.0
 | 
			
		||||
- golang版本 >= v1.21
 | 
			
		||||
- golang版本 >= v1.23
 | 
			
		||||
- goframe版本 >=v2.7.0
 | 
			
		||||
- mysql版本 >=5.7
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -179,7 +179,11 @@ func GenTypeSelect(ctx context.Context) (res sysin.GenTypeSelects, err error) {
 | 
			
		||||
			Templates: make(sysin.GenTemplateSelects, 0),
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		confName, ok := consts.GenCodesTypeConfMap[k]
 | 
			
		||||
		km := k
 | 
			
		||||
		if km == consts.GenCodesTypeTree {
 | 
			
		||||
			km = consts.GenCodesTypeCurd
 | 
			
		||||
		}
 | 
			
		||||
		confName, ok := consts.GenCodesTypeConfMap[km]
 | 
			
		||||
		if ok {
 | 
			
		||||
			var temps []*model.GenerateAppCrudTemplate
 | 
			
		||||
			err = g.Cfg().MustGet(ctx, "hggen.application."+confName+".templates").Scan(&temps)
 | 
			
		||||
 
 | 
			
		||||
@@ -403,6 +403,7 @@ func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) (err error)
 | 
			
		||||
		"importWebApi":     in.options.ImportWebApi,                                     // 导入webApi
 | 
			
		||||
		"apiPrefix":        in.options.ApiPrefix,                                        // api前缀
 | 
			
		||||
		"componentPrefix":  componentPrefix,                                             // vue子组件前缀
 | 
			
		||||
		"in":  				in.In, 														 // 在模版中使用`in`参数,如:插件目录名称
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	in.view = view
 | 
			
		||||
 
 | 
			
		||||
@@ -286,8 +286,8 @@ func (l *gCurd) generateLogicListWhereEach(buffer *bytes.Buffer, in *CurdPreview
 | 
			
		||||
		case WhereModeNotLike:
 | 
			
		||||
			whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "NotLike(" + tablePrefix + "dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")\n\t}"
 | 
			
		||||
		case WhereModeJsonContains:
 | 
			
		||||
			val := tablePrefix + "fmt.Sprintf(`JSON_CONTAINS(%s,'%v')`, dao." + daoName + ".Columns()." + columnName + ", in." + field.GoName + ")"
 | 
			
		||||
			whereTag = "\tif in." + field.GoName + linkMode + " {\n\t\tmod = mod." + wherePrefix + "(" + val + ")\n\t}"
 | 
			
		||||
			val := tablePrefix + `"JSON_CONTAINS("+dao.` + daoName + `.Columns().` + columnName + `+",?)", in.` + field.GoName
 | 
			
		||||
			whereTag = "\tif " + linkMode + " {\n\t\tmod = mod." + wherePrefix + "(" + val + ")\n\t}"
 | 
			
		||||
 | 
			
		||||
		default:
 | 
			
		||||
			buffer.WriteString(fmt.Sprintf(LogicWhereNoSupport, field.QueryWhere))
 | 
			
		||||
 
 | 
			
		||||
@@ -177,8 +177,14 @@ func (s *sSysGenCodes) List(ctx context.Context, in *sysin.GenCodesListInp) (lis
 | 
			
		||||
		if row == nil {
 | 
			
		||||
			return ""
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		genType := int(row.GenType)
 | 
			
		||||
		if genType == consts.GenCodesTypeTree {
 | 
			
		||||
			genType = consts.GenCodesTypeCurd
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for _, v := range typeSelect {
 | 
			
		||||
			if v.Value == int(row.GenType) {
 | 
			
		||||
			if v.Value == genType {
 | 
			
		||||
				for index, template := range v.Templates {
 | 
			
		||||
					if index == row.GenTemplate {
 | 
			
		||||
						return template.Label
 | 
			
		||||
@@ -186,7 +192,6 @@ func (s *sSysGenCodes) List(ctx context.Context, in *sysin.GenCodesListInp) (lis
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -151,11 +151,11 @@ func (s *s@{.servFunName}) Delete(ctx context.Context, in *@{.templateGroup}in.@
 | 
			
		||||
		return gerror.New("请先删除该@{.tableComment}下的所有下级!")
 | 
			
		||||
	}@{end}
 | 
			
		||||
	@{ if eq .deletedUpdate "" }
 | 
			
		||||
	if _, err = s.Model(ctx@{ if eq .options.Step.HasNotFilterAuth true } ,&handler.Option{FilterAuth: false}@{end}).WherePri(in.@{.pk.GoName}).Delete();err != nil {
 | 
			
		||||
	if _, err = s.Model(ctx@{ if eq .options.Step.HasNotFilterAuth true } ,&handler.Option{FilterAuth: false}@{end}).WherePri(in.@{.pk.GoName}).Unscoped().Delete();err != nil {
 | 
			
		||||
		err = gerror.Wrap(err, "删除@{.tableComment}失败,请稍后重试!")
 | 
			
		||||
    	return
 | 
			
		||||
	}@{else}
 | 
			
		||||
	if _, err = s.Model(ctx@{ if eq .options.Step.HasNotFilterAuth true } ,&handler.Option{FilterAuth: false}@{end}).WherePri(in.@{.pk.GoName}).Data(@{.deletedUpdate}).Update();err != nil {
 | 
			
		||||
	if _, err = s.Model(ctx@{ if eq .options.Step.HasNotFilterAuth true } ,&handler.Option{FilterAuth: false}@{end}).WherePri(in.@{.pk.GoName}).Data(@{.deletedUpdate}).Unscoped().Update();err != nil {
 | 
			
		||||
		err = gerror.Wrap(err, "删除@{.tableComment}失败,请稍后重试!")
 | 
			
		||||
		return
 | 
			
		||||
	}@{end}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user