forked from free-lancers/electricity_bill_calc_service
		
	fix(meter):修正数据库字段映射。
This commit is contained in:
		| @@ -45,7 +45,7 @@ func InitializeMeterHandlers(router *fiber.App) { | |||||||
|  |  | ||||||
| // 查询指定园区下的表计信息 | // 查询指定园区下的表计信息 | ||||||
| func searchMetersWithinPark(c *fiber.Ctx) error { | func searchMetersWithinPark(c *fiber.Ctx) error { | ||||||
| 	parkId := c.Params("parkId") | 	parkId := c.Params("pid") | ||||||
| 	meterLog.Info("查询指定园区下的表计信息", zap.String("park id", parkId)) | 	meterLog.Info("查询指定园区下的表计信息", zap.String("park id", parkId)) | ||||||
| 	result := response.NewResult(c) | 	result := response.NewResult(c) | ||||||
| 	if pass, err := checkParkBelongs(parkId, meterLog, c, &result); !pass { | 	if pass, err := checkParkBelongs(parkId, meterLog, c, &result); !pass { | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ type MeterDetail struct { | |||||||
| 	Code           string              `json:"code" db:"code"` | 	Code           string              `json:"code" db:"code"` | ||||||
| 	Park           string              `json:"parkId" db:"park_id"` | 	Park           string              `json:"parkId" db:"park_id"` | ||||||
| 	Address        *string             `json:"address" db:"address"` | 	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"` | 	Building       *string             `json:"building" db:"building"` | ||||||
| 	BuildingName   *string             `json:"buildingName" db:"building_name"` | 	BuildingName   *string             `json:"buildingName" db:"building_name"` | ||||||
| 	OnFloor        *string             `json:"onFloor" db:"on_floor" ` | 	OnFloor        *string             `json:"onFloor" db:"on_floor" ` | ||||||
| @@ -31,7 +31,7 @@ type MeterRelation struct { | |||||||
| 	SlaveMeter    string          `json:"slaveMeterId" db:"slave_meter_id"` | 	SlaveMeter    string          `json:"slaveMeterId" db:"slave_meter_id"` | ||||||
| 	EstablishedAt types.DateTime  `json:"establishedAt"` | 	EstablishedAt types.DateTime  `json:"establishedAt"` | ||||||
| 	SuspendedAt   *types.DateTime `json:"suspendedAt"` | 	SuspendedAt   *types.DateTime `json:"suspendedAt"` | ||||||
| 	RevokeAt      *types.DateTime `json:"revokeAt"` | 	RevokedAt     *types.DateTime `json:"revokedAt"` | ||||||
| } | } | ||||||
|  |  | ||||||
| type MeterSynchronization struct { | type MeterSynchronization struct { | ||||||
|   | |||||||
| @@ -135,14 +135,14 @@ func (mr _MeterRepository) MetersIn(pid string, page uint, keyword *string) ([]* | |||||||
| 		). | 		). | ||||||
| 		Where( | 		Where( | ||||||
| 			goqu.I("m.park_id").Eq(pid), | 			goqu.I("m.park_id").Eq(pid), | ||||||
| 			goqu.I("m.detachedAt").IsNull(), | 			goqu.I("m.detached_at").IsNull(), | ||||||
| 		) | 		) | ||||||
| 	countQuery := mr.ds. | 	countQuery := mr.ds. | ||||||
| 		From(goqu.T("meter_04kv").As("m")). | 		From(goqu.T("meter_04kv").As("m")). | ||||||
| 		Select(goqu.COUNT("*")). | 		Select(goqu.COUNT("*")). | ||||||
| 		Where( | 		Where( | ||||||
| 			goqu.I("m.park_id").Eq(pid), | 			goqu.I("m.park_id").Eq(pid), | ||||||
| 			goqu.I("m.detachedAt").IsNull(), | 			goqu.I("m.detached_at").IsNull(), | ||||||
| 		) | 		) | ||||||
|  |  | ||||||
| 	if keyword != nil && len(*keyword) > 0 { | 	if keyword != nil && len(*keyword) > 0 { | ||||||
| @@ -498,12 +498,12 @@ func (mr _MeterRepository) ListPooledMeterRelations(pid, code string) ([]*model. | |||||||
|  |  | ||||||
| 	var relations []*model.MeterRelation | 	var relations []*model.MeterRelation | ||||||
| 	relationsSql, relationsArgs, _ := mr.ds. | 	relationsSql, relationsArgs, _ := mr.ds. | ||||||
| 		From(goqu.T("meter_relations")). | 		From(goqu.T("meter_relations").As("r")). | ||||||
| 		Select("*"). | 		Select("r.*"). | ||||||
| 		Where( | 		Where( | ||||||
| 			goqu.I("r.park_id").Eq(pid), | 			goqu.I("r.park_id").Eq(pid), | ||||||
| 			goqu.I("r.master_meter_id").Eq(code), | 			goqu.I("r.master_meter_id").Eq(code), | ||||||
| 			goqu.I("r.revoke_at").IsNull(), | 			goqu.I("r.revoked_at").IsNull(), | ||||||
| 		). | 		). | ||||||
| 		Prepared(true).ToSQL() | 		Prepared(true).ToSQL() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user