| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package base
- import (
- "context"
- model "dashoo.cn/micro/app/model/base"
- service "dashoo.cn/micro/app/service/base"
- "dashoo.cn/common_definition/comm_def"
- "github.com/gogf/gf/frame/g"
- )
- type BaseDistributorContact struct{}
- // Swagger:DistributorContact 经销商代理商联系人 查询
- func (c *BaseDistributorContact) List(ctx context.Context, req *model.BaseDistributorContactListReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("BaseDistributorContact.List request %#v ", *req)
- s, err := service.NewBaseDistributorContactService(ctx)
- if err != nil {
- return err
- }
- total, ent, err := s.List(ctx, req)
- if err != nil {
- return err
- }
- if ent == nil {
- ent = []*model.BaseDistributorContact{}
- }
- rsp.Data = map[string]interface{}{
- "total": total,
- "list": ent,
- }
- return nil
- }
- // Swagger:DistributorContact 经销商代理商联系人 新增
- func (c *BaseDistributorContact) Add(ctx context.Context, req *model.BaseDistributorContactAddReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("BaseDistributorContact.Add request %#v ", *req)
- s, err := service.NewBaseDistributorContactService(ctx)
- if err != nil {
- return err
- }
- id, err := s.Add(ctx, req)
- if err != nil {
- return err
- }
- rsp.Data = id
- return nil
- }
- // Swagger:DistributorContact 经销商代理商联系人 更新
- func (c *BaseDistributorContact) Update(ctx context.Context, req *model.BaseDistributorContactUpdateReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("BaseDistributorContact.Update request %#v ", *req)
- s, err := service.NewBaseDistributorContactService(ctx)
- if err != nil {
- return err
- }
- err = s.Update(ctx, req)
- if err != nil {
- return err
- }
- return nil
- }
- // Swagger:DistributorContact 经销商代理商联系人 删除
- func (c *BaseDistributorContact) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_def.CommonMsg) error {
- g.Log().Infof("BaseDistributorContact.Delete request %#v ", *req)
- s, err := service.NewBaseDistributorContactService(ctx)
- if err != nil {
- return err
- }
- err = s.Delete(ctx, req.Id)
- if err != nil {
- return err
- }
- return nil
- }
|