From aec1655f1c8f34387e041aed806706a321179db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Mon, 26 Jun 2023 15:15:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(meter):=E4=BF=AE=E6=AD=A3=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/meter.go | 2 +- model/meter.go | 4 ++-- repository/meter.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/controller/meter.go b/controller/meter.go index a25cc18..bf42f84 100644 --- a/controller/meter.go +++ b/controller/meter.go @@ -45,7 +45,7 @@ func InitializeMeterHandlers(router *fiber.App) { // 查询指定园区下的表计信息 func searchMetersWithinPark(c *fiber.Ctx) error { - parkId := c.Params("parkId") + parkId := c.Params("pid") meterLog.Info("查询指定园区下的表计信息", zap.String("park id", parkId)) result := response.NewResult(c) if pass, err := checkParkBelongs(parkId, meterLog, c, &result); !pass { diff --git a/model/meter.go b/model/meter.go index d592fdc..5f10fa8 100644 --- a/model/meter.go +++ b/model/meter.go @@ -10,7 +10,7 @@ type MeterDetail struct { Code string `json:"code" db:"code"` Park string `json:"parkId" db:"park_id"` Address *string `json:"address" db:"address"` - MeterType int16 `json:"meterType" db:"meter_type"` + MeterType int16 `json:"type" db:"meter_type"` Building *string `json:"building" db:"building"` BuildingName *string `json:"buildingName" db:"building_name"` OnFloor *string `json:"onFloor" db:"on_floor" ` @@ -31,7 +31,7 @@ type MeterRelation struct { SlaveMeter string `json:"slaveMeterId" db:"slave_meter_id"` EstablishedAt types.DateTime `json:"establishedAt"` SuspendedAt *types.DateTime `json:"suspendedAt"` - RevokeAt *types.DateTime `json:"revokeAt"` + RevokedAt *types.DateTime `json:"revokedAt"` } type MeterSynchronization struct { diff --git a/repository/meter.go b/repository/meter.go index 95c11fa..c183f06 100644 --- a/repository/meter.go +++ b/repository/meter.go @@ -135,14 +135,14 @@ func (mr _MeterRepository) MetersIn(pid string, page uint, keyword *string) ([]* ). Where( goqu.I("m.park_id").Eq(pid), - goqu.I("m.detachedAt").IsNull(), + goqu.I("m.detached_at").IsNull(), ) countQuery := mr.ds. From(goqu.T("meter_04kv").As("m")). Select(goqu.COUNT("*")). Where( goqu.I("m.park_id").Eq(pid), - goqu.I("m.detachedAt").IsNull(), + goqu.I("m.detached_at").IsNull(), ) if keyword != nil && len(*keyword) > 0 { @@ -498,12 +498,12 @@ func (mr _MeterRepository) ListPooledMeterRelations(pid, code string) ([]*model. var relations []*model.MeterRelation relationsSql, relationsArgs, _ := mr.ds. - From(goqu.T("meter_relations")). - Select("*"). + From(goqu.T("meter_relations").As("r")). + Select("r.*"). Where( goqu.I("r.park_id").Eq(pid), goqu.I("r.master_meter_id").Eq(code), - goqu.I("r.revoke_at").IsNull(), + goqu.I("r.revoked_at").IsNull(), ). Prepared(true).ToSQL()