115 lines
3.6 KiB
Go
115 lines
3.6 KiB
Go
// Package gen
|
|
// @Link https://github.com/xiujiecn/xiu-admin
|
|
// @Copyright Copyright (c) 2026 LiXiujie
|
|
// @Author Lxj <xxx@example.com>
|
|
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
|
// @AutoGenerate Version
|
|
package common
|
|
|
|
import (
|
|
"context"
|
|
|
|
v1 "git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
|
)
|
|
|
|
// List 查看批次主表列表
|
|
func (c *ControllerV1) BatchMainList(ctx context.Context, req *v1.BatchMainListReq) (res *v1.BatchMainListRes, err error) {
|
|
list, totalCount, err := service.CommonBatchMain().List(ctx, &req.BatchMainListParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.BatchMainListModel{}
|
|
}
|
|
|
|
res = new(v1.BatchMainListRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) BatchMainSuccessList(ctx context.Context, req *v1.BatchMainSuccessListReq) (res *v1.BatchMainSuccessListRes, err error) {
|
|
list, totalCount, err := service.CommonBatchMain().SuccessList(ctx, &req.BatchMainSuccessListParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.BatchMainSuccessListModel{}
|
|
}
|
|
|
|
res = new(v1.BatchMainSuccessListRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) BatchMainCards(ctx context.Context, req *v1.BatchMainCardsReq) (res *v1.BatchMainCardsRes, err error) {
|
|
list, totalCount, err := service.CommonBatchMain().ListCards(ctx, &req.BatchCardListParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.BatchCardListModel{}
|
|
}
|
|
|
|
res = new(v1.BatchMainCardsRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
// ExportWarehousing 导出入库批次列表(数据与入库管理页一致)
|
|
func (c *ControllerV1) BatchMainExportWarehousing(ctx context.Context, req *v1.BatchMainExportWarehousingReq) (res *v1.BatchMainExportWarehousingRes, err error) {
|
|
err = service.CommonBatchMain().ExportWarehousing(ctx, &req.BatchMainSuccessListParam)
|
|
return
|
|
}
|
|
|
|
// Export 导出批次主表列表
|
|
func (c *ControllerV1) BatchMainExport(ctx context.Context, req *v1.BatchMainExportReq) (res *v1.BatchMainExportRes, err error) {
|
|
err = service.CommonBatchMain().Export(ctx, &req.BatchMainListParam)
|
|
return
|
|
}
|
|
|
|
// Edit 更新批次主表
|
|
func (c *ControllerV1) BatchMainEdit(ctx context.Context, req *v1.BatchMainEditReq) (res *v1.BatchMainEditRes, err error) {
|
|
err = service.CommonBatchMain().Edit(ctx, &req.BatchMainEditParam)
|
|
return
|
|
}
|
|
|
|
// View 获取指定批次主表信息
|
|
func (c *ControllerV1) BatchMainView(ctx context.Context, req *v1.BatchMainViewReq) (res *v1.BatchMainViewRes, err error) {
|
|
data, err := service.CommonBatchMain().View(ctx, &req.BatchMainViewParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = new(v1.BatchMainViewRes)
|
|
res.BatchMainViewModel = data
|
|
return
|
|
}
|
|
|
|
// Delete 删除批次主表
|
|
func (c *ControllerV1) BatchMainDelete(ctx context.Context, req *v1.BatchMainDeleteReq) (res *v1.BatchMainDeleteRes, err error) {
|
|
err = service.CommonBatchMain().Delete(ctx, &req.BatchMainDeleteParam)
|
|
return
|
|
}
|
|
|
|
func (c *ControllerV1) BatchMainRequeue(ctx context.Context, req *v1.BatchMainRequeueReq) (res *v1.BatchMainRequeueRes, err error) {
|
|
data, err := service.CommonBatchMain().Requeue(ctx, &req.BatchMainRequeueParam)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.BatchMainRequeueRes{BatchMainRequeueModel: data}, nil
|
|
}
|