@RequiresPermissions({"manager:view"})
@RequestMapping("/getManagers")
@JsonView(Manager.simpleManager.class)
public Result getManagers(){
Result result = new Result();
List<Manager> managers = managerService.selectList(null);
if(managers!=null){
result.setCode(1);
result.setData(managers);
result.setMsg("查询成功");
} else {
result.setCode(0);
result.setMsg("查询失败");
}
return result;
}
封装的返回
public class Result {
private String msg;
private Integer code;
private Object data;
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
只有把返回改成List才有效,我这种情况应怎么处理?