75 lines
2.6 KiB
Go
75 lines
2.6 KiB
Go
|
// ==========================================================================
|
|||
|
// GFast自动生成controller操作代码。
|
|||
|
// 生成日期:2024-03-13 18:10:56
|
|||
|
// 生成路径: internal/app/system/controller/construction_details.go
|
|||
|
// 生成人:gfast
|
|||
|
// desc:施工类别详情
|
|||
|
// company:云南奇讯科技有限公司
|
|||
|
// ==========================================================================
|
|||
|
|
|||
|
package controller
|
|||
|
|
|||
|
import (
|
|||
|
"context"
|
|||
|
|
|||
|
"github.com/tiger1103/gfast/v3/api/v1/system"
|
|||
|
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
|||
|
"github.com/tiger1103/gfast/v3/third/create"
|
|||
|
)
|
|||
|
|
|||
|
type constructionDetailsController struct {
|
|||
|
BaseController
|
|||
|
}
|
|||
|
|
|||
|
var ConstructionDetails = new(constructionDetailsController)
|
|||
|
|
|||
|
// List 列表
|
|||
|
func (c *constructionDetailsController) List(ctx context.Context, req *system.ConstructionDetailsSearchReq) (res *system.ConstructionDetailsSearchRes, err error) {
|
|||
|
res, err = service.ConstructionDetails().List(ctx, req)
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// Get 获取施工类别详情
|
|||
|
func (c *constructionDetailsController) Get(ctx context.Context, req *system.ConstructionDetailsGetReq) (res *system.ConstructionDetailsGetRes, err error) {
|
|||
|
res = new(system.ConstructionDetailsGetRes)
|
|||
|
res.ConstructionDetailsInfoRes, err = service.ConstructionDetails().GetById(ctx, req.Id)
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// Add 添加施工类别详情
|
|||
|
func (c *constructionDetailsController) Add(ctx context.Context, req *system.ConstructionDetailsAddReq) (res *system.ConstructionDetailsAddRes, err error) {
|
|||
|
err = service.ConstructionDetails().Add(ctx, req)
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// Edit 修改施工类别详情
|
|||
|
func (c *constructionDetailsController) Edit(ctx context.Context, req *system.ConstructionDetailsEditReq) (res *system.ConstructionDetailsEditRes, err error) {
|
|||
|
err = service.ConstructionDetails().Edit(ctx, req)
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// Delete 删除施工类别详情
|
|||
|
func (c *constructionDetailsController) Delete(ctx context.Context, req *system.ConstructionDetailsDeleteReq) (res *system.ConstructionDetailsDeleteRes, err error) {
|
|||
|
err = service.ConstructionDetails().Delete(ctx, req.Ids)
|
|||
|
return
|
|||
|
}
|
|||
|
|
|||
|
// 查询指定方阵下,设施的可选择余量
|
|||
|
// func (c *constructionDetailsController) GetByConstruction(ctx context.Context, req *system.ConstructionDetailsListReq) (res *system.ConstructionDetailsListRes, err error) {
|
|||
|
// res = new(system.ConstructionDetailsListRes)
|
|||
|
// }
|
|||
|
|
|||
|
// 返回指定方阵ID下的 gannt json
|
|||
|
func (c *constructionDetailsController) GetByFangzhen(ctx context.Context, req *system.GanntJsonReq) (*system.GanntJsonRes, error) {
|
|||
|
data, err := create.FetchGanttData(ctx, req.FangzhenID)
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
res := new(system.GanntJsonRes)
|
|||
|
|
|||
|
res.List = data
|
|||
|
|
|||
|
return res, nil
|
|||
|
}
|