delete_xunji_service_logic.go 940 B

123456789101112131415161718192021222324252627282930313233343536
  1. package xunji_service
  2. import (
  3. "context"
  4. "github.com/suyuan32/simple-admin-common/msg/errormsg"
  5. "wechat-api/ent/xunjiservice"
  6. "wechat-api/internal/utils/dberrorhandler"
  7. "wechat-api/internal/svc"
  8. "wechat-api/internal/types"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type DeleteXunjiServiceLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewDeleteXunjiServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteXunjiServiceLogic {
  17. return &DeleteXunjiServiceLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx}
  21. }
  22. func (l *DeleteXunjiServiceLogic) DeleteXunjiService(req *types.IDsReq) (*types.BaseMsgResp, error) {
  23. _, err := l.svcCtx.DB.XunjiService.Delete().Where(xunjiservice.IDIn(req.Ids...)).Exec(l.ctx)
  24. if err != nil {
  25. return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
  26. }
  27. return &types.BaseMsgResp{Msg: errormsg.DeleteSuccess}, nil
  28. }