perf: 优化para5G参数,移除网元版本新增修改删除接口

This commit is contained in:
TsMask
2024-05-10 10:15:42 +08:00
parent ea548d0fdb
commit a4a31c9a16
6 changed files with 9 additions and 255 deletions

View File

@@ -21,7 +21,4 @@ type INeVersion interface {
// DeleteByIds 批量删除信息
DeleteByIds(ids []string) int64
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
CheckUniqueTypeAndID(neVersion model.NeVersion) string
}

View File

@@ -1,7 +1,6 @@
package repository
import (
"fmt"
"strings"
"time"
@@ -181,41 +180,6 @@ func (r *NeVersionImpl) SelectByIds(cmdIds []string) []model.NeVersion {
return r.convertResultRows(results)
}
// CheckUniqueTypeAndID 校验网元类型和网元ID是否唯一
func (r *NeVersionImpl) CheckUniqueTypeAndID(neVersion model.NeVersion) string {
// 查询条件拼接
var conditions []string
var params []any
if neVersion.NeType != "" {
conditions = append(conditions, "ne_type = ?")
params = append(params, neVersion.NeType)
}
if neVersion.NeId != "" {
conditions = append(conditions, "ne_id = ?")
params = append(params, neVersion.NeId)
}
// 构建查询条件语句
whereSql := ""
if len(conditions) > 0 {
whereSql += " where " + strings.Join(conditions, " and ")
} else {
return ""
}
// 查询数据
querySql := "select id as 'str' from ne_version " + whereSql + " limit 1"
results, err := datasource.RawDB("", querySql, params)
if err != nil {
logger.Errorf("query err %v", err)
return ""
}
if len(results) > 0 {
return fmt.Sprint(results[0]["str"])
}
return ""
}
// Insert 新增信息
func (r *NeVersionImpl) Insert(neVersion model.NeVersion) string {
// 参数拼接