fix(meter):在按照编号列表获取表计详细的时候,对于表计编号列表是空的防御措施。

This commit is contained in:
徐涛 2023-06-26 16:22:53 +08:00
parent ac36c158c0
commit b224f51613

View File

@ -185,6 +185,9 @@ func (mr _MeterRepository) MetersIn(pid string, page uint, keyword *string) ([]*
// 列出指定园区中指定列表中所有表计的详细信息,将忽略所有表计的当前状态
func (mr _MeterRepository) ListMetersByIDs(pid string, ids []string) ([]*model.MeterDetail, error) {
mr.log.Info("列出指定园区中指定列表中所有表计的详细信息", zap.String("park id", pid), zap.Strings("meter ids", ids))
if len(ids) == 0 {
return make([]*model.MeterDetail, 0), nil
}
ctx, cancel := global.TimeoutContext()
defer cancel()