fix: 自动化代码需检测简称,简称不可以重复。

This commit is contained in:
pixelmaxQM
2024-11-11 22:40:27 +08:00
parent 58204373aa
commit fbd0f4b9c6
6 changed files with 18 additions and 8 deletions

View File

@@ -52,9 +52,9 @@ func (s *autoCodeHistory) First(ctx context.Context, info common.GetById) (strin
// Repeat 检测重复
// Author [SliverHorn](https://github.com/SliverHorn)
// Author [songzhibin97](https://github.com/songzhibin97)
func (s *autoCodeHistory) Repeat(businessDB, structName, Package string) bool {
func (s *autoCodeHistory) Repeat(businessDB, structName, abbreviation, Package string) bool {
var count int64
global.GVA_DB.Model(&model.SysAutoCodeHistory{}).Where("business_db = ? and struct_name = ? and package = ? and flag = 0", businessDB, structName, Package).Count(&count)
global.GVA_DB.Model(&model.SysAutoCodeHistory{}).Where("business_db = ? and (struct_name = ? OR abbreviation = ?) and package = ?", businessDB, structName, abbreviation, Package).Count(&count).Debug()
return count > 0
}