48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
// 库位控制器
|
||
// 职责:库位CRUD接口、状态更新接口
|
||
// 调用服务:service.Location
|
||
// 注意: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 location struct{}
|
||
|
||
var Location = new(location)
|
||
|
||
func init() {
|
||
}
|
||
|
||
func (c *location) CreateLocation(ctx context.Context, req *dto.CreateLocationReq) (res *dto.CreateLocationRes, err error) {
|
||
return service.Location.Create(ctx, req)
|
||
}
|
||
|
||
func (c *location) UpdateLocation(ctx context.Context, req *dto.UpdateLocationReq) (res *beans.ResponseEmpty, err error) {
|
||
err = service.Location.Update(ctx, req)
|
||
return
|
||
}
|
||
|
||
func (c *location) DeleteLocation(ctx context.Context, req *dto.DeleteLocationReq) (res *beans.ResponseEmpty, err error) {
|
||
err = service.Location.Delete(ctx, req)
|
||
return
|
||
}
|
||
|
||
func (c *location) UpdateLocationStatus(ctx context.Context, req *dto.UpdateLocationStatusReq) (res *beans.ResponseEmpty, err error) {
|
||
err = service.Location.UpdateStatus(ctx, req)
|
||
return
|
||
}
|
||
|
||
func (c *location) GetLocation(ctx context.Context, req *dto.GetLocationReq) (res *dto.GetLocationRes, err error) {
|
||
return service.Location.GetOne(ctx, req)
|
||
}
|
||
|
||
func (c *location) ListLocations(ctx context.Context, req *dto.ListLocationReq) (res *dto.ListLocationRes, err error) {
|
||
return service.Location.List(ctx, req)
|
||
}
|