Browse Source

add param type for listclusterlogic

Former-commit-id: d6386bb55f
pull/9/head
zhouqunjie 2 years ago
parent
commit
7f76293de7
4 changed files with 7 additions and 3 deletions
  1. +1
    -0
      adaptor/PCM-CORE/api/desc/core/pcm-core.api
  2. +1
    -0
      adaptor/PCM-CORE/api/internal/logic/core/listclusterlogic.go
  3. +1
    -0
      adaptor/PCM-CORE/api/internal/types/types.go
  4. +4
    -3
      adaptor/PCM-CORE/model/computeclustermodel_gen.go

+ 1
- 0
adaptor/PCM-CORE/api/desc/core/pcm-core.api View File

@@ -287,6 +287,7 @@ type (
ComputeCluster {
Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
JcceDomainId int64 `json:"jcceDomainId"`
JcceDomainName string `json:"jcceDomainName"`
Longitude float64 `json:"longitude"`


+ 1
- 0
adaptor/PCM-CORE/api/internal/logic/core/listclusterlogic.go View File

@@ -44,6 +44,7 @@ func (l *ListClusterLogic) ListCluster(req *types.ListClusterReq) (*types.ListCl
var cluster types.ComputeCluster
cluster.Id = clusterModel.Id
cluster.Name = clusterModel.Name.String
cluster.Type = clusterModel.Type.String
cluster.JcceDomainId = clusterModel.JcceDomainId.Int64
cluster.JcceDomainName = clusterModel.JcceDomainName.String
cluster.Longitude = clusterModel.Longitude.Float64


+ 1
- 0
adaptor/PCM-CORE/api/internal/types/types.go View File

@@ -267,6 +267,7 @@ type ClusterData struct {
type ComputeCluster struct {
Id int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
JcceDomainId int64 `json:"jcceDomainId"`
JcceDomainName string `json:"jcceDomainName"`
Longitude float64 `json:"longitude"`


+ 4
- 3
adaptor/PCM-CORE/model/computeclustermodel_gen.go View File

@@ -37,6 +37,7 @@ type (
ComputeCluster struct {
Id int64 `db:"id"` // 集群id
Name sql.NullString `db:"name"` // 集群名
Type sql.NullString `db:"type"` // 集群类型
CenterId sql.NullInt64 `db:"center_id"` // 数据中心id
CenterName sql.NullString `db:"center_name"` // 数据中心名称
JcceDomainId sql.NullInt64 `db:"jcce_domain_id"` // JCCE侧域ID
@@ -75,14 +76,14 @@ func (m *defaultComputeClusterModel) FindOne(ctx context.Context, id int64) (*Co
}

func (m *defaultComputeClusterModel) Insert(ctx context.Context, data *ComputeCluster) (sql.Result, error) {
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?)", m.table, computeClusterRowsExpectAutoSet)
ret, err := m.conn.ExecCtx(ctx, query, data.Name, data.CenterId, data.CenterName, data.JcceDomainId, data.JcceDomainName, data.Longitude, data.Latitude, data.Description)
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, computeClusterRowsExpectAutoSet)
ret, err := m.conn.ExecCtx(ctx, query, data.Name, data.Type, data.CenterId, data.CenterName, data.JcceDomainId, data.JcceDomainName, data.Longitude, data.Latitude, data.Description)
return ret, err
}

func (m *defaultComputeClusterModel) Update(ctx context.Context, data *ComputeCluster) error {
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, computeClusterRowsWithPlaceHolder)
_, err := m.conn.ExecCtx(ctx, query, data.Name, data.CenterId, data.CenterName, data.JcceDomainId, data.JcceDomainName, data.Longitude, data.Latitude, data.Description, data.Id)
_, err := m.conn.ExecCtx(ctx, query, data.Name, data.Type, data.CenterId, data.CenterName, data.JcceDomainId, data.JcceDomainName, data.Longitude, data.Latitude, data.Description, data.Id)
return err
}



Loading…
Cancel
Save