revt: 回退网元软件包类型字段变更

This commit is contained in:
TsMask
2024-05-27 19:02:33 +08:00
parent 83192c3172
commit 57a18656df
6 changed files with 33 additions and 34 deletions

View File

@@ -15,12 +15,12 @@ import (
// 实例化数据层 NewNeSoftware 结构体
var NewNeSoftwareImpl = &NeSoftwareImpl{
selectSql: `select
id, type, name, path, version, description, create_by, create_time, update_by, update_time
id, ne_type, name, path, version, description, create_by, create_time, update_by, update_time
from ne_software`,
resultMap: map[string]string{
"id": "ID",
"type": "Type",
"ne_type": "NeType",
"name": "Name",
"path": "Path",
"version": "Version",
@@ -60,16 +60,16 @@ func (r *NeSoftwareImpl) SelectPage(query map[string]any) map[string]any {
// 查询条件拼接
var conditions []string
var params []any
if v, ok := query["type"]; ok && v != "" {
if v, ok := query["neType"]; ok && v != "" {
softwareType := v.(string)
if strings.Contains(softwareType, ",") {
softwareTypeArr := strings.Split(softwareType, ",")
placeholder := repo.KeyPlaceholderByQuery(len(softwareTypeArr))
conditions = append(conditions, "type in ("+placeholder+")")
conditions = append(conditions, "ne_type in ("+placeholder+")")
parameters := repo.ConvertIdsSlice(softwareTypeArr)
params = append(params, parameters...)
} else {
conditions = append(conditions, "type = ?")
conditions = append(conditions, "ne_type = ?")
params = append(params, strings.Trim(softwareType, " "))
}
}
@@ -131,9 +131,9 @@ func (r *NeSoftwareImpl) SelectList(neSoftware model.NeSoftware) []model.NeSoftw
// 查询条件拼接
var conditions []string
var params []any
if neSoftware.Type != "" {
conditions = append(conditions, "type = ?")
params = append(params, neSoftware.Type)
if neSoftware.NeType != "" {
conditions = append(conditions, "ne_type = ?")
params = append(params, neSoftware.NeType)
}
if neSoftware.Path != "" {
conditions = append(conditions, "path = ?")
@@ -184,9 +184,9 @@ func (r *NeSoftwareImpl) CheckUniqueTypeAndNameAndVersion(neSoftware model.NeSof
// 查询条件拼接
var conditions []string
var params []any
if neSoftware.Type != "" {
conditions = append(conditions, "type = ?")
params = append(params, neSoftware.Type)
if neSoftware.NeType != "" {
conditions = append(conditions, "ne_type = ?")
params = append(params, neSoftware.NeType)
}
if neSoftware.Version != "" {
conditions = append(conditions, "version = ?")
@@ -222,8 +222,8 @@ func (r *NeSoftwareImpl) CheckUniqueTypeAndNameAndVersion(neSoftware model.NeSof
func (r *NeSoftwareImpl) Insert(neSoftware model.NeSoftware) string {
// 参数拼接
params := make(map[string]any)
if neSoftware.Type != "" {
params["type"] = neSoftware.Type
if neSoftware.NeType != "" {
params["ne_type"] = neSoftware.NeType
}
if neSoftware.Name != "" {
params["name"] = neSoftware.Name
@@ -271,8 +271,8 @@ func (r *NeSoftwareImpl) Insert(neSoftware model.NeSoftware) string {
func (r *NeSoftwareImpl) Update(neSoftware model.NeSoftware) int64 {
// 参数拼接
params := make(map[string]any)
if neSoftware.Type != "" {
params["type"] = neSoftware.Type
if neSoftware.NeType != "" {
params["ne_type"] = neSoftware.NeType
}
if neSoftware.Name != "" {
params["name"] = neSoftware.Name