ClusterList

Former-commit-id: 839fd4761ea712bfc0dfccce4c4ad3be2b5784dd
This commit is contained in:
zhangwei 2024-03-08 17:28:50 +08:00
parent 32bee79af3
commit 4a7e646e0e
3 changed files with 8 additions and 4 deletions

View File

@ -726,8 +726,8 @@ type (
)
type ClusterReq {
Id string `json:"id,optional"`
AdapterId string `json:"adapterId,optional"`
Id string `form:"id,optional"`
AdapterId string `form:"adapterId,optional"`
Name string `json:"name,optional"`
Nickname string `json:"nickname,optional"`
Description string `json:"description,optional"`

View File

@ -26,7 +26,11 @@ func NewClusterListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Clust
func (l *ClusterListLogic) ClusterList(req *types.ClusterReq) (resp *types.ClusterListResp, err error) {
resp = &types.ClusterListResp{}
sql := fmt.Sprintf(`select c.* from t_cluster c left join t_adapter a on c.adapter_id = a.id where c.deleted_at is null`)
if req.AdapterId != "" {
sql = fmt.Sprintf(`select * from t_cluster where adapter_id = %s and deleted_at is null `, req.AdapterId)
}
if req.Type != "" {
sql = fmt.Sprintf(`select c.* from t_cluster c left join t_adapter a on c.adapter_id = a.id where c.deleted_at is null and a.type = %s`, req.Type)
}

View File

@ -694,8 +694,8 @@ type AdapterRelation struct {
}
type ClusterReq struct {
Id string `json:"id,optional"`
AdapterId string `json:"adapterId,optional"`
Id string `form:"id,optional"`
AdapterId string `form:"adapterId,optional"`
Name string `json:"name,optional"`
Nickname string `json:"nickname,optional"`
Description string `json:"description,optional"`