41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package server
|
|
|
|
import (
|
|
dto2 "admin/apps/mockpro/internal/model/dto"
|
|
)
|
|
|
|
func (ctl *controller) CommonList(ctx *WebContext, restfulResourceName string, params *dto2.CommonListReq, rsp *dto2.CommonListRsp) error {
|
|
list, err := ctl.svc.CommonList(ctx, restfulResourceName, params)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*rsp = *list
|
|
return nil
|
|
}
|
|
|
|
func (ctl *controller) CommonPost(ctx *WebContext, restfulResourceName string, params *dto2.CommonPostReq, rsp *dto2.CommonPostRsp) error {
|
|
newObj, err := ctl.svc.CommonPost(ctx, restfulResourceName, *params.Dto)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
rsp.Dto = &newObj
|
|
return nil
|
|
}
|
|
|
|
func (ctl *controller) CommonPut(ctx *WebContext, restfulResourceName string, params *dto2.CommonPutReq, rsp *dto2.CommonPutRsp) error {
|
|
newObj, err := ctl.svc.CommonPut(ctx, restfulResourceName, *params.Dto)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
rsp.Dto = &newObj
|
|
return nil
|
|
}
|
|
|
|
func (ctl *controller) CommonDelete(ctx *WebContext, restfulResourceName string, params *dto2.CommonDeleteReq, rsp *dto2.CommonDeleteRsp) error {
|
|
err := ctl.svc.CommonDelete(ctx, restfulResourceName, params.Id)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|