forked from free-lancers/electricity_bill_calc_service
feat(park):增加园区列表功能。
This commit is contained in:
24
repository/park.go
Normal file
24
repository/park.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"electricity_bill_calc/global"
|
||||
"electricity_bill_calc/model"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type _ParkRepository struct{}
|
||||
|
||||
var ParkRepo _ParkRepository
|
||||
|
||||
func (_ParkRepository) ListAllParkBelongsTo(uid string) ([]model.Park, error) {
|
||||
var parks []model.Park
|
||||
err := global.DBConn.
|
||||
Where(builder.Eq{"user_id": uid}).
|
||||
NoAutoCondition().
|
||||
Find(&parks)
|
||||
if err != nil {
|
||||
return make([]model.Park, 0), err
|
||||
}
|
||||
return parks, nil
|
||||
}
|
Reference in New Issue
Block a user