| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package base
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- "dashoo.cn/opms_libary/myerrors"
- "github.com/gogf/gf/frame/g"
- "github.com/gogf/gf/util/gvalid"
- projModel "dashoo.cn/micro/app/model/proj"
- projSrv "dashoo.cn/micro/app/service/proj"
- )
- type BusinessContactHandler struct{}
- // Swagger:BusinessContact 项目联系人 列表
- func (p *BusinessContactHandler) GetList(ctx context.Context, req *projModel.BusinessContactSearchReq, rsp *comm_def.CommonMsg) error {
- if req.BusId == 0 {
- return myerrors.ValidError("项目参数有误!")
- }
- contactService, err := projSrv.NewBusinessContactService(ctx)
- if err != nil {
- return err
- }
- total, list, err := contactService.GetList(req)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": list, "total": total}
- return nil
- }
- // Swagger:BusinessContact 项目联系人 创建
- func (p *BusinessContactHandler) Create(ctx context.Context, req *projModel.BusinessContactReq, rsp *comm_def.CommonMsg) error {
- // 参数校验
- if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
- return err
- }
- contactService, err := projSrv.NewBusinessContactService(ctx)
- if err != nil {
- return err
- }
- err = contactService.Create(req)
- if err != nil {
- return err
- }
- return nil
- }
- // Swagger:BusinessContact 项目联系人 删除
- func (p *BusinessContactHandler) DeleteByIds(ctx context.Context, req *projModel.DeleteBusinessContactReq, rsp *comm_def.CommonMsg) error {
- // 参数校验
- if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
- return err
- }
- contactService, err := projSrv.NewBusinessContactService(ctx)
- if err != nil {
- return err
- }
- err = contactService.DeleteByIds(req)
- return err
- }
|