Browse Source

Merge remote-tracking branch 'origin/gva-vue3' into gva-vue3

main
qimiao 3 years ago
parent
commit
dabb7335b5
  1. 4
      server/service/system/sys_auto_code.go
  2. 10
      server/service/system/sys_autocode_history.go

4
server/service/system/sys_auto_code.go

@ -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

10
server/service/system/sys_autocode_history.go

@ -1,6 +1,7 @@
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{

Loading…
Cancel
Save