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