package com.yyx.info.commons.result;import lombok.Data;import lombok.experimental.Accessors;import java.util.Map;@Data@Accessors(chain =true)publicclassR{private Integer code;private String message;private Object object;publicR(){}publicstatic R ok(){
R r =newR();
r.setCode(ResultEnum.SUCCESS.getCode()).setMessage(ResultEnum.SUCCESS.getMessage());return r;}publicstatic R error(){
R r =newR();
r.setCode(ResultEnum.FAIL.getCode());
r.setMessage(ResultEnum.FAIL.getMessage());return r;}public R data(Object data){this.setObject(data);returnthis;}public R message(String message){this.setMessage(message);returnthis;}public R code(Integer code){this.setCode(code);returnthis;}}
@PostMapping("/insertStaff")public R insertStaff(@RequestBody Staff staff){boolean result = staffService.insertStaff(staff);if(result){return R.ok().message("插入成功");}else{return R.error().message("插入失败");}}