package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "youngee_b_api/consts" "youngee_b_api/db" "youngee_b_api/middleware" "youngee_b_api/model/http_model" "youngee_b_api/util" ) func WrapWorkspaceDDLprojectHandler(ctx *gin.Context) { handler := newWorkspaceDDLprojectHandler(ctx) baseRun(handler) } type WorkspaceDDLprojectHandler struct { ctx *gin.Context req *http_model.WorkspaceDDLprojectRequest resp *http_model.CommonResponse } func (w WorkspaceDDLprojectHandler) getContext() *gin.Context { return w.ctx } func (w WorkspaceDDLprojectHandler) getResponse() interface{} { return w.resp } func (w WorkspaceDDLprojectHandler) getRequest() interface{} { return w.req } func (w WorkspaceDDLprojectHandler) run() { auth := middleware.GetSessionAuth(w.ctx) enterpriseID := auth.EnterpriseID data, err := db.GetWorkspaceDDLproject(w.ctx, enterpriseID, w.req.PageSize, w.req.PageNum) if err != nil { // 数据库查询失败,返回5001 logrus.Errorf("[WorkspaceDDLprojectHandler] call GetWorkspaceDDLproject err:%+v\n", err) util.HandlerPackErrorResp(w.resp, consts.ErrorInternal, "") logrus.Info("GetWorkspaceDDLproject fail,req:%+v", w.req) return } w.resp.Data = data } func (w WorkspaceDDLprojectHandler) checkParam() error { return nil } func newWorkspaceDDLprojectHandler(ctx *gin.Context) *WorkspaceDDLprojectHandler { return &WorkspaceDDLprojectHandler{ ctx: ctx, req: http_model.NewWorkspaceDDLprojectRequest(), resp: http_model.NewWorkspaceDDLprojectResponse(), } }