59 lines
1.9 KiB
Go
59 lines
1.9 KiB
Go
package common
|
|
|
|
import (
|
|
"context"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/model"
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/internal/service"
|
|
|
|
"git.5iot.com/iotlcm-public/iotlcm-admin-svr/api/common/v1"
|
|
)
|
|
|
|
// List 查看财务申请表列表
|
|
func (c *ControllerV1) TFinanceApplyList(ctx context.Context, req *v1.TFinanceApplyListReq) (res *v1.TFinanceApplyListRes, err error) {
|
|
list, totalCount, err := service.CommonTFinanceApply().List(ctx, &req.TFinanceApplyListParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
if list == nil {
|
|
list = []*model.TFinanceApplyListModel{}
|
|
}
|
|
|
|
res = new(v1.TFinanceApplyListRes)
|
|
res.Items = list
|
|
res.PageResult.Page = req.Page
|
|
res.PageResult.PageSize = req.PageSize
|
|
res.PageResult.Total = totalCount
|
|
return
|
|
}
|
|
|
|
// Export 导出财务申请表列表
|
|
func (c *ControllerV1) TFinanceApplyExport(ctx context.Context, req *v1.TFinanceApplyExportReq) (res *v1.TFinanceApplyExportRes, err error) {
|
|
err = service.CommonTFinanceApply().Export(ctx, &req.TFinanceApplyListParam)
|
|
return
|
|
}
|
|
|
|
// Edit 更新财务申请表
|
|
func (c *ControllerV1) TFinanceApplyEdit(ctx context.Context, req *v1.TFinanceApplyEditReq) (res *v1.TFinanceApplyEditRes, err error) {
|
|
err = service.CommonTFinanceApply().Edit(ctx, &req.TFinanceApplyEditParam)
|
|
return
|
|
}
|
|
|
|
// View 获取指定财务申请表信息
|
|
func (c *ControllerV1) TFinanceApplyView(ctx context.Context, req *v1.TFinanceApplyViewReq) (res *v1.TFinanceApplyViewRes, err error) {
|
|
data, err := service.CommonTFinanceApply().View(ctx, &req.TFinanceApplyViewParam)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = new(v1.TFinanceApplyViewRes)
|
|
res.TFinanceApplyViewModel = data
|
|
return
|
|
}
|
|
|
|
// Delete 删除财务申请表
|
|
func (c *ControllerV1) TFinanceApplyDelete(ctx context.Context, req *v1.TFinanceApplyDeleteReq) (res *v1.TFinanceApplyDeleteRes, err error) {
|
|
err = service.CommonTFinanceApply().Delete(ctx, &req.TFinanceApplyDeleteParam)
|
|
return
|
|
}
|