48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
|
|
// 库区控制器
|
|||
|
|
// 职责:库区CRUD接口、状态更新接口
|
|||
|
|
// 调用服务:service.Zone
|
|||
|
|
// 注意:Update/Delete/UpdateStatus返回*beans.ResponseEmpty,直接return
|
|||
|
|
package controller
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
dto "assets/model/dto/stock"
|
|||
|
|
service "assets/service/stock"
|
|||
|
|
"context"
|
|||
|
|
|
|||
|
|
"gitea.com/red-future/common/beans"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
type zone struct{}
|
|||
|
|
|
|||
|
|
var Zone = new(zone)
|
|||
|
|
|
|||
|
|
func init() {
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (c *zone) CreateZone(ctx context.Context, req *dto.CreateZoneReq) (res *dto.CreateZoneRes, err error) {
|
|||
|
|
return service.Zone.Create(ctx, req)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (c *zone) UpdateZone(ctx context.Context, req *dto.UpdateZoneReq) (res *beans.ResponseEmpty, err error) {
|
|||
|
|
err = service.Zone.Update(ctx, req)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (c *zone) DeleteZone(ctx context.Context, req *dto.DeleteZoneReq) (res *beans.ResponseEmpty, err error) {
|
|||
|
|
err = service.Zone.Delete(ctx, req)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (c *zone) UpdateZoneStatus(ctx context.Context, req *dto.UpdateZoneStatusReq) (res *beans.ResponseEmpty, err error) {
|
|||
|
|
err = service.Zone.UpdateStatus(ctx, req)
|
|||
|
|
return
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (c *zone) GetZone(ctx context.Context, req *dto.GetZoneReq) (res *dto.GetZoneRes, err error) {
|
|||
|
|
return service.Zone.GetOne(ctx, req)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
func (c *zone) ListZones(ctx context.Context, req *dto.ListZoneReq) (res *dto.ListZoneRes, err error) {
|
|||
|
|
return service.Zone.List(ctx, req)
|
|||
|
|
}
|