2022
04-12
04-12
SpringBoot返回统一的JSON标准格式实现步骤
期望返回的JSON格式如下{"code":200,"msg":"操作成功","data":"hellojenkins"}实现步骤如下1.自定义状态码枚举类。@AllArgsConstructor@GetterpublicenumStatusCodeEnum{SC200(200,"操作成功"),SC999(999,"操作失败"),SC401(401,"匿名用户访问权限资源时的异常"),SC403(403,"无访问权限,请联系管理员授予权限"),SC404(404,"请求的资源不存在"),SC500(500,"系统异常,请稍后重试"),...
继续阅读 >