controller返回的数据一般都有status和msg两个字段,
请问以下两种返回格式有什么区别优缺点?
public class CommResult<T> {
private String status;
private String msg;
private T data;
}
public class StudentResult {
private String name;
private String desc;
}
public class xxxController {
public CommResult<StudentResult> getStu() {
...
}
}
public class StudentResult extends CommResult {
private String name;
private String desc;
}
public class CommResult {
private String status;
private String msg;
}
public class xxxController {
public StudentResult getStu() {
...
}
}