| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package base
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- "dashoo.cn/opms_libary/myerrors"
- "github.com/gogf/gf/util/gvalid"
- projModel "dashoo.cn/micro/app/model/proj"
- projSrv "dashoo.cn/micro/app/service/proj"
- )
- type BusinessTeamHandler struct{}
- // GetList 获取列表
- func (p *BusinessTeamHandler) GetList(ctx context.Context, req *projModel.BusinessReq, rsp *comm_def.CommonMsg) error {
- if req.BusId == 0 {
- return myerrors.ValidError("项目参数有误!")
- }
- teamService, err := projSrv.NewBusinessTeamService(ctx)
- if err != nil {
- return err
- }
- list, err := teamService.GetList(req.BusId)
- if err != nil {
- return err
- }
- rsp.Data = list
- return nil
- }
- func (p *BusinessTeamHandler) Create(ctx context.Context, req *projModel.BusinessTeamReq, rsp *comm_def.CommonMsg) error {
- // 参数校验
- if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
- return err
- }
- teamService, err := projSrv.NewBusinessTeamService(ctx)
- if err != nil {
- return err
- }
- err = teamService.Create(req)
- if err != nil {
- return err
- }
- return nil
- }
- func (p *BusinessTeamHandler) DeleteByIds(ctx context.Context, req *comm_def.IdsReq, rsp *comm_def.CommonMsg) error {
- // 参数校验
- if len(req.Ids) == 0 {
- return myerrors.ValidError("id参数有误!")
- }
- teamService, err := projSrv.NewBusinessTeamService(ctx)
- if err != nil {
- return err
- }
- err = teamService.DeleteByIds(req.Ids)
- return err
- }
|