fit:超算概览两个查询接口
This commit is contained in:
parent
5dc3ec6b22
commit
7ae1c6ffca
|
@ -35,7 +35,5 @@ message GetRegionSlurmReq{
|
||||||
}
|
}
|
||||||
message GetRegionSlurmResp{
|
message GetRegionSlurmResp{
|
||||||
int32 code = 1;
|
int32 code = 1;
|
||||||
int32 regionSum =2;
|
repeated RegionSlurmSumInfo regionSlurmSumInfo =2;
|
||||||
int32 softStackSum =3;
|
|
||||||
repeated RegionSlurmSumInfo regionSlurmSumInfo =4;
|
|
||||||
}
|
}
|
|
@ -68,21 +68,31 @@ func GetRegion() *slurmCommon.GetRegionSlurmResp {
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("数据库连接成功")
|
fmt.Println("数据库连接成功")
|
||||||
}
|
}
|
||||||
var r *slurmCommon.RegionSlurmSumInfo
|
|
||||||
errRegionSum := db.QueryRow(`SELECT count(t.RegionName) as RegionSum FROM region_slurm t`).Scan(&r.RegionSum) //获取所有数据
|
var regionSumList []*slurmCommon.RegionSlurmSumInfo
|
||||||
|
|
||||||
|
rows, errRegionSum := db.Query(`SELECT count(RegionName) as RegionSum FROM region_slurm`) //获取所有数据
|
||||||
|
var r slurmCommon.RegionSlurmSumInfo
|
||||||
if errRegionSum != nil {
|
if errRegionSum != nil {
|
||||||
fmt.Println(errRegionSum)
|
fmt.Println(errRegionSum)
|
||||||
}
|
}
|
||||||
|
for rows.Next() {
|
||||||
|
rows.Scan(&r.RegionSum)
|
||||||
|
}
|
||||||
|
|
||||||
errSoftStackSum := db.QueryRow(`SELECT count(t.SoftStack) as SoftStackSum FROM region_slurm t`).Scan(&r.SoftStackSum) //获取所有数据
|
rowsSoftStack, errSoftStackSum := db.Query(`SELECT count(SoftStack) as SoftStackSum FROM region_slurm`) //获取所有数据
|
||||||
if errSoftStackSum != nil {
|
if errSoftStackSum != nil {
|
||||||
fmt.Println(errSoftStackSum)
|
fmt.Println(errSoftStackSum)
|
||||||
}
|
}
|
||||||
fmt.Println(r)
|
for rowsSoftStack.Next() {
|
||||||
|
rowsSoftStack.Scan(&r.SoftStackSum)
|
||||||
|
}
|
||||||
|
regionSumList = append(regionSumList, &r)
|
||||||
|
|
||||||
resp := slurmCommon.GetRegionSlurmResp{}
|
resp := slurmCommon.GetRegionSlurmResp{}
|
||||||
resp.Code = 200
|
resp.Code = 200
|
||||||
resp.RegionSum = r.RegionSum
|
resp.RegionSlurmSumInfo = regionSumList
|
||||||
resp.SoftStackSum = r.SoftStackSum
|
/*resp.RegionSum = r.RegionSum
|
||||||
|
resp.SoftStackSum = r.SoftStackSum*/
|
||||||
return &resp
|
return &resp
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue