fix: 网元信息表结构体变更
This commit is contained in:
@@ -330,7 +330,7 @@ func (s *NeInfoController) Add(c *gin.Context) {
|
|||||||
|
|
||||||
s.neVersionService.Insert(neVersion)
|
s.neVersionService.Insert(neVersion)
|
||||||
s.neLicenseService.Insert(neLicense)
|
s.neLicenseService.Insert(neLicense)
|
||||||
body.UpdateBy = loginUserName
|
body.CreateBy = loginUserName
|
||||||
insertId := s.neInfoService.Insert(body)
|
insertId := s.neInfoService.Insert(body)
|
||||||
if insertId != "" {
|
if insertId != "" {
|
||||||
c.JSON(200, result.OkData(insertId))
|
c.JSON(200, result.OkData(insertId))
|
||||||
|
|||||||
@@ -2,22 +2,25 @@ package model
|
|||||||
|
|
||||||
// NeInfo 网元信息对象 ne_info
|
// NeInfo 网元信息对象 ne_info
|
||||||
type NeInfo struct {
|
type NeInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id" gorm:"id"`
|
||||||
NeType string `json:"neType" binding:"required"`
|
NeType string `json:"neType" gorm:"ne_type" binding:"required"`
|
||||||
NeId string `json:"neId" binding:"required"`
|
NeId string `json:"neId" gorm:"ne_id" binding:"required"`
|
||||||
RmUID string `json:"rmUid"`
|
RmUID string `json:"rmUid" gorm:"rm_uid"`
|
||||||
NeName string `json:"neName"`
|
NeName string `json:"neName" gorm:"ne_name"`
|
||||||
IP string `json:"ip" binding:"required"`
|
IP string `json:"ip" gorm:"ip" binding:"required"`
|
||||||
Port int64 `json:"port" binding:"required,number,max=65535,min=1"`
|
Port int64 `json:"port" gorm:"port" binding:"required,number,max=65535,min=1"`
|
||||||
PvFlag string `json:"pvFlag" binding:"oneof=PNF VNF"` // enum('PNF','VNF')
|
PvFlag string `json:"pvFlag" gorm:"pv_flag" binding:"oneof=PNF VNF"` // ''PNF'',''VNF''
|
||||||
Province string `json:"province"` // 省份地域
|
Province string `json:"province" gorm:"province"` // 省份地域
|
||||||
VendorName string `json:"vendorName"`
|
VendorName string `json:"vendorName" gorm:"vendor_name"`
|
||||||
Dn string `json:"dn"`
|
Dn string `json:"dn" gorm:"dn"`
|
||||||
NeAddress string `json:"neAddress"` // MAC地址
|
NeAddress string `json:"neAddress" gorm:"ne_address"` // MAC地址
|
||||||
Status string `json:"status"` // 0离线 1在线 2配置待下发
|
HostIDs string `json:"hostIds" gorm:"host_ids"` // 网元主机ID组 数据格式(ssh,telnet,telnet)
|
||||||
UpdateBy string `json:"updateBy"` // 更新者
|
Status string `json:"status" gorm:"status"` // 0离线 1在线 2配置待下发
|
||||||
UpdateTime string `json:"updateTime"` // 更新时间
|
Remark string `json:"remark" gorm:"remark"` // 备注
|
||||||
HostIDs string `json:"hostIds"` // 网元主机ID组 数据格式(ssh,telnet,telnet)
|
CreateBy string `json:"createBy" gorm:"create_by"` // 创建者
|
||||||
|
CreateTime int64 `json:"createTime" gorm:"create_time"` // 创建时间
|
||||||
|
UpdateBy string `json:"updateBy" gorm:"update_by"` // 更新者
|
||||||
|
UpdateTime int64 `json:"updateTime" gorm:"update_time"` // 更新时间
|
||||||
|
|
||||||
// ====== 非数据库字段属性 ======
|
// ====== 非数据库字段属性 ======
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ var neListSort = []string{
|
|||||||
|
|
||||||
// 实例化数据层 NeInfoImpl 结构体
|
// 实例化数据层 NeInfoImpl 结构体
|
||||||
var NewNeInfoImpl = &NeInfoImpl{
|
var NewNeInfoImpl = &NeInfoImpl{
|
||||||
selectSql: `select id, ne_type, ne_id, rm_uid, ne_name, ip, port, pv_flag, province, vendor_name, dn, ne_address, status, update_time, update_by, host_ids from ne_info`,
|
selectSql: `select id, ne_type, ne_id, rm_uid, ne_name, ip, port, pv_flag, province, vendor_name, dn, ne_address, host_ids, status, remark, create_by, create_time, update_by, update_time from ne_info`,
|
||||||
|
|
||||||
resultMap: map[string]string{
|
resultMap: map[string]string{
|
||||||
"id": "ID",
|
"id": "ID",
|
||||||
@@ -50,10 +50,13 @@ var NewNeInfoImpl = &NeInfoImpl{
|
|||||||
"vendor_name": "VendorName",
|
"vendor_name": "VendorName",
|
||||||
"dn": "Dn",
|
"dn": "Dn",
|
||||||
"ne_address": "NeAddress",
|
"ne_address": "NeAddress",
|
||||||
"status": "Status",
|
|
||||||
"update_time": "UpdateTime",
|
|
||||||
"update_by": "UpdateBy",
|
|
||||||
"host_ids": "HostIDs",
|
"host_ids": "HostIDs",
|
||||||
|
"status": "Status",
|
||||||
|
"remark": "Remark",
|
||||||
|
"create_by": "CreateBy",
|
||||||
|
"create_time": "CreateTime",
|
||||||
|
"update_by": "UpdateBy",
|
||||||
|
"update_time": "UpdateTime",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,15 +303,18 @@ func (r *NeInfoImpl) Insert(neInfo model.NeInfo) string {
|
|||||||
if neInfo.NeAddress != "" {
|
if neInfo.NeAddress != "" {
|
||||||
params["ne_address"] = neInfo.NeAddress
|
params["ne_address"] = neInfo.NeAddress
|
||||||
}
|
}
|
||||||
|
if neInfo.HostIDs != "" {
|
||||||
|
params["host_ids"] = neInfo.HostIDs
|
||||||
|
}
|
||||||
if neInfo.Status != "" {
|
if neInfo.Status != "" {
|
||||||
params["status"] = neInfo.Status
|
params["status"] = neInfo.Status
|
||||||
}
|
}
|
||||||
if neInfo.UpdateBy != "" {
|
if neInfo.Remark != "" {
|
||||||
params["update_by"] = neInfo.UpdateBy
|
params["remark"] = neInfo.Remark
|
||||||
params["update_time"] = time.Now().UnixMilli()
|
|
||||||
}
|
}
|
||||||
if neInfo.HostIDs != "" {
|
if neInfo.CreateBy != "" {
|
||||||
params["host_ids"] = neInfo.HostIDs
|
params["create_by"] = neInfo.CreateBy
|
||||||
|
params["create_time"] = time.Now().UnixMilli()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建执行语句
|
// 构建执行语句
|
||||||
@@ -367,6 +373,10 @@ func (r *NeInfoImpl) Update(neInfo model.NeInfo) int64 {
|
|||||||
params["vendor_name"] = neInfo.VendorName
|
params["vendor_name"] = neInfo.VendorName
|
||||||
params["dn"] = neInfo.Dn
|
params["dn"] = neInfo.Dn
|
||||||
params["ne_address"] = neInfo.NeAddress
|
params["ne_address"] = neInfo.NeAddress
|
||||||
|
if neInfo.HostIDs != "" {
|
||||||
|
params["host_ids"] = neInfo.HostIDs
|
||||||
|
}
|
||||||
|
params["remark"] = neInfo.Remark
|
||||||
if neInfo.Status != "" {
|
if neInfo.Status != "" {
|
||||||
params["status"] = neInfo.Status
|
params["status"] = neInfo.Status
|
||||||
}
|
}
|
||||||
@@ -374,9 +384,6 @@ func (r *NeInfoImpl) Update(neInfo model.NeInfo) int64 {
|
|||||||
params["update_by"] = neInfo.UpdateBy
|
params["update_by"] = neInfo.UpdateBy
|
||||||
params["update_time"] = time.Now().UnixMilli()
|
params["update_time"] = time.Now().UnixMilli()
|
||||||
}
|
}
|
||||||
if neInfo.HostIDs != "" {
|
|
||||||
params["host_ids"] = neInfo.HostIDs
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建执行语句
|
// 构建执行语句
|
||||||
keys, values := repo.KeyValueByUpdate(params)
|
keys, values := repo.KeyValueByUpdate(params)
|
||||||
|
|||||||
Reference in New Issue
Block a user