fix(#12):修复抄表记录与表记管理处无论选择任何表记类型只会显示全部错误

This commit is contained in:
2023-08-09 15:42:37 +08:00
parent 5f750dd0e0
commit 2aa3729e03
6 changed files with 28 additions and 24 deletions

View File

@@ -54,7 +54,8 @@ func searchMetersWithinPark(c *fiber.Ctx) error {
}
keyword := c.Query("keyword")
page := c.QueryInt("page", 1)
meters, total, err := repository.MeterRepository.MetersIn(parkId, uint(page), &keyword)
mtype := c.QueryInt("type", 0)
meters, total, err := repository.MeterRepository.MetersIn(parkId, uint(page), &keyword, uint(mtype))
if err != nil {
meterLog.Error("无法查询指定园区下的表计信息,无法获取表计列表", zap.Error(err))
return result.Error(http.StatusInternalServerError, err.Error())
@@ -349,6 +350,7 @@ func listUnboundTenementMeters(c *fiber.Ctx) error {
func queryMeterReadings(c *fiber.Ctx) error {
result := response.NewResult(c)
parkId := c.Params("pid")
mtype := c.QueryInt("type")
if pass, err := checkParkBelongs(parkId, meterLog, c, &result); !pass {
return err
}
@@ -373,7 +375,7 @@ func queryMeterReadings(c *fiber.Ctx) error {
endDate = &parsedDate
}
}
readings, total, err := service.MeterService.SearchMeterReadings(parkId, building, startDate, endDate, uint(page), keyword)
readings, total, err := service.MeterService.SearchMeterReadings(parkId, building, startDate, endDate, uint(page), keyword, uint(mtype))
if err != nil {
meterLog.Error("查询指定园区中的表计读数,无法获取表计读数列表", zap.Error(err))
return result.Error(http.StatusInternalServerError, err.Error())