fix(meter):修正表计信息的检索。

This commit is contained in:
徐涛 2023-06-13 14:25:54 +08:00
parent e2a61d58ac
commit ef325aede5

View File

@ -1080,7 +1080,7 @@ func (mr _MeterRepository) ListLastMeterReading(pid string, date types.Date) ([]
func (mr _MeterRepository) ListMeterDocForTemplate(pid string) ([]*model.SimpleMeterDocument, error) { func (mr _MeterRepository) ListMeterDocForTemplate(pid string) ([]*model.SimpleMeterDocument, error) {
mr.log.Info("列出指定园区中的表计与商户的关联详细记录", zap.String("park id", pid)) mr.log.Info("列出指定园区中的表计与商户的关联详细记录", zap.String("park id", pid))
cacheConditions := []string{pid} cacheConditions := []string{pid}
if docs, err := cache.RetrieveSearch[[]*model.SimpleMeterDocument]("simple_meter_doc", cacheConditions...); err == nil { if docs, err := cache.RetrieveSearch[[]*model.SimpleMeterDocument]("simple_meter_doc", cacheConditions...); err == nil && docs != nil {
mr.log.Info("从缓存中获取到了指定园区中的表计与商户的关联详细记录", zap.Int("count", len(*docs))) mr.log.Info("从缓存中获取到了指定园区中的表计与商户的关联详细记录", zap.Int("count", len(*docs)))
return *docs, nil return *docs, nil
} }
@ -1110,7 +1110,7 @@ func (mr _MeterRepository) ListMeterDocForTemplate(pid string) ([]*model.SimpleM
Where( Where(
goqu.I("m.park_id").Eq(pid), goqu.I("m.park_id").Eq(pid),
goqu.I("m.enabled").IsTrue(), goqu.I("m.enabled").IsTrue(),
goqu.I("m.disassociated_at").IsNull(), goqu.I("tm.disassociated_at").IsNull(),
). ).
Order(goqu.I("m.seq").Asc()). Order(goqu.I("m.seq").Asc()).
Prepared(true).ToSQL() Prepared(true).ToSQL()