- 2024-12-31定义通用返回包装类
定义通用返回包装类包装返回正确的数据格式,返回类型示例{"code":200,"message":"success","data":[]}通用包装类importlombok.AllArgsConstructor;importlombok.Data;importlombok.NoArgsConstructor;/***@authorzhangshao*@d
- 2024-09-11Springboot 统一返回接口
importlombok.AllArgsConstructor;importlombok.Data;importlombok.NoArgsConstructor;@Data@AllArgsConstructor@NoArgsConstructorpublicclassCommonResponse<T>{privateTdata;privateStringmessage;privateintcode;public
- 2022-12-12封装Response对象
封装Response对象#utils.py#自定制响应fromrest_framework.responseimportResponseclassCommonResponse(Response):def__init__(self,code=10,msg='成功'
- 2022-12-10封装Response对象
封装Response对象#utils.py#自定制响应fromrest_framework.responseimportResponseclassCommonResponse(Response):def__init__(self,code=10,msg='成功'
- 2022-10-14java response 异常抛出
原因:如果没有自定义异常,那么http请求遇到错误时就会返回系统自带的异常,不利于问题的排查{"timestamp":"2022-10-14T05:38:16.881+00:00","status":500,