初始
This commit is contained in:
85
internal/app/system/controller/xiangmuhuafenbiao.go
Normal file
85
internal/app/system/controller/xiangmuhuafenbiao.go
Normal file
@ -0,0 +1,85 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2023-10-07 16:08:10
|
||||
// 生成路径: internal/app/system/controller/xiangmuhuafenbiao.go
|
||||
// 生成人:gfast
|
||||
// desc:项目划分
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/common/coryCommon"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/system"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/service"
|
||||
)
|
||||
|
||||
type xiangmuhuafenbiaoController struct {
|
||||
BaseController
|
||||
}
|
||||
|
||||
var Xiangmuhuafenbiao = new(xiangmuhuafenbiaoController)
|
||||
|
||||
// List 列表
|
||||
func (c *xiangmuhuafenbiaoController) List(ctx context.Context, req *system.XiangmuhuafenbiaoSearchReq) (res *system.XiangmuhuafenbiaoSearchRes, err error) {
|
||||
res, err = service.Xiangmuhuafenbiao().List(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取项目划分
|
||||
func (c *xiangmuhuafenbiaoController) Get(ctx context.Context, req *system.XiangmuhuafenbiaoGetReq) (res *system.XiangmuhuafenbiaoGetRes, err error) {
|
||||
res = new(system.XiangmuhuafenbiaoGetRes)
|
||||
res.XiangmuhuafenbiaoInfoRes, err = service.Xiangmuhuafenbiao().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加项目划分
|
||||
func (c *xiangmuhuafenbiaoController) Add(ctx context.Context, req *system.XiangmuhuafenbiaoAddReq) (res *system.XiangmuhuafenbiaoAddRes, err error) {
|
||||
err = service.Xiangmuhuafenbiao().Add(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改项目划分
|
||||
func (c *xiangmuhuafenbiaoController) Edit(ctx context.Context, req *system.XiangmuhuafenbiaoEditReq) (res *system.XiangmuhuafenbiaoEditRes, err error) {
|
||||
err = service.Xiangmuhuafenbiao().Edit(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除项目划分
|
||||
func (c *xiangmuhuafenbiaoController) Delete(ctx context.Context, req *system.XiangmuhuafenbiaoDeleteReq) (res *system.XiangmuhuafenbiaoDeleteRes, err error) {
|
||||
err = service.Xiangmuhuafenbiao().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
// EditExcelFunc 修改excel数据
|
||||
func (c *xiangmuhuafenbiaoController) EditExcelFunc(ctx context.Context, req *system.EditExcelFuncReq) (res *system.XiangmuhuafenbiaoEditRes, err error) {
|
||||
err = service.Xiangmuhuafenbiao().EditExcelFunc(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
// MultipleProjectsListFunc 返回当前项目下所有相同zhixingbiaohao的excel数据
|
||||
func (c *xiangmuhuafenbiaoController) MultipleProjectsListFunc(ctx context.Context, req *system.MultipleProjectsListFuncReq) (res *system.MultipleProjectsListFuncRes, err error) {
|
||||
res = new(system.MultipleProjectsListFuncRes)
|
||||
var entity []*system.MultipleProjectsListFuncOne
|
||||
dao.Xiangmuhuafenbiao.Ctx(ctx).As("a").
|
||||
Fields("a.id,a.json,b.filen_path as filenPath,a.name,a.zhixingbiaohao").
|
||||
LeftJoin("document as b on b.`name` = a.zhixingbiaohao").
|
||||
Where("a.zhixingbiaohao", req.ExecutionTableNumber).
|
||||
Where("a.project_id", req.ProjectId).
|
||||
Scan(&entity)
|
||||
for _, da := range entity {
|
||||
json := da.Json
|
||||
if json != "" {
|
||||
data, err2 := coryCommon.PutJson(json)
|
||||
if err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
da.Json = data
|
||||
}
|
||||
}
|
||||
res.List = entity
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user