| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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/opms_parent/app/model/proj"
- projSrv "dashoo.cn/opms_parent/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
- }
|