54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
package data
|
|
|
|
import (
|
|
"context"
|
|
dto "erp/model/dto/data"
|
|
service "erp/service/data"
|
|
|
|
"gitea.com/red-future/common/beans"
|
|
)
|
|
|
|
type scheduleController struct{}
|
|
|
|
// Schedule 排班控制器
|
|
var Schedule = new(scheduleController)
|
|
|
|
// CreateSchedule 创建排班
|
|
func (c *scheduleController) CreateSchedule(ctx context.Context, req *dto.CreateScheduleReq) (res *dto.CreateScheduleRes, err error) {
|
|
|
|
return service.Schedule.Create(ctx, req)
|
|
}
|
|
|
|
// ListSchedule 获取排班列表
|
|
func (c *scheduleController) ListSchedule(ctx context.Context, req *dto.ListScheduleReq) (res *dto.ListScheduleRes, err error) {
|
|
|
|
return service.Schedule.List(ctx, req)
|
|
}
|
|
|
|
// GetSchedule 获取排班详情
|
|
func (c *scheduleController) GetSchedule(ctx context.Context, req *dto.GetScheduleReq) (res *dto.GetScheduleRes, err error) {
|
|
|
|
return service.Schedule.GetOne(ctx, req)
|
|
}
|
|
|
|
// UpdateSchedule 更新排班
|
|
func (c *scheduleController) UpdateSchedule(ctx context.Context, req *dto.UpdateScheduleReq) (res *beans.ResponseEmpty, err error) {
|
|
|
|
err = service.Schedule.Update(ctx, req)
|
|
return
|
|
}
|
|
|
|
// UpdateScheduleStatus 更新排班状态
|
|
func (c *scheduleController) UpdateScheduleStatus(ctx context.Context, req *dto.UpdateScheduleStatusReq) (res *beans.ResponseEmpty, err error) {
|
|
|
|
err = service.Schedule.UpdateStatus(ctx, req)
|
|
return
|
|
}
|
|
|
|
// DeleteSchedule 删除排班
|
|
func (c *scheduleController) DeleteSchedule(ctx context.Context, req *dto.DeleteScheduleReq) (res *beans.ResponseEmpty, err error) {
|
|
|
|
err = service.Schedule.Delete(ctx, req)
|
|
return
|
|
}
|