提交 5a59f25d 编写于 作者: S songzhibin97

feat: issues #692

上级 6c798aff
......@@ -154,6 +154,10 @@ func (autoCodeService *AutoCodeService) PreviewTemp(autoCode system.AutoCodeStru
//@return: err error
func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruct, ids ...uint) (err error) {
// 增加判断: 重复创建struct
if autoCode.AutoMoveFile && AutoCodeHistoryServiceApp.Repeat(autoCode.StructName) {
return RepeatErr
}
dataList, fileList, needMkdir, err := autoCodeService.getNeedList(&autoCode)
if err != nil {
return err
......
package system
import (
"errors"
"fmt"
"path/filepath"
"strings"
......@@ -14,11 +15,20 @@ import (
"go.uber.org/zap"
)
var RepeatErr = errors.New("重复创建")
type AutoCodeHistoryService struct {
}
var AutoCodeHistoryServiceApp = new(AutoCodeHistoryService)
func (autoCodeHistoryService *AutoCodeHistoryService) Repeat(structName string) bool {
var count int64
global.GVA_DB.Model(&system.SysAutoCodeHistory{}).Where("struct_name = ?", structName).Count(&count)
return count > 0
}
// CreateAutoCodeHistory RouterPath : RouterPath@RouterString;RouterPath2@RouterString2
func (autoCodeHistoryService *AutoCodeHistoryService) CreateAutoCodeHistory(meta, structName, structCNName, autoCodePath string, injectionMeta string, tableName string, apiIds string) error {
return global.GVA_DB.Create(&system.SysAutoCodeHistory{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册