代码优化

This commit is contained in:
xiaoyang
2021-08-13 17:14:41 +08:00
parent 52a1a8f9a1
commit a94eea8db7
7 changed files with 39 additions and 39 deletions

View File

@ -47,30 +47,30 @@ public class ResultBean<T>{
/**
* 业务处理成功,无数据返回
* */
public static ResultBean ok() {
return new ResultBean();
public static ResultBean<Void> ok() {
return new ResultBean<>();
}
/**
* 业务处理成功,有数据返回
* */
public static <T> ResultBean ok(T data) {
return new ResultBean(data);
public static <T> ResultBean<T> ok(T data) {
return new ResultBean<>(data);
}
/**
* 业务处理失败
* */
public static ResultBean fail(ResponseStatus ResponseStatus) {
return new ResultBean(ResponseStatus);
public static ResultBean<Void> fail(ResponseStatus ResponseStatus) {
return new ResultBean<>(ResponseStatus);
}
/**
* 系统错误
* */
public static ResultBean error() {
return new ResultBean(ResponseStatus.ERROR);
public static ResultBean<Void> error() {
return new ResultBean<>(ResponseStatus.ERROR);
}
}

View File

@ -21,7 +21,7 @@ public class BeanUtil {
* @return 新集合
* */
@SneakyThrows
public static <T> List<T> copyList(List source,Class<T> targetClass){
public static <T> List<T> copyList(List<? super T> source,Class<T> targetClass){
List<T> target = new ArrayList<>(source.size());
for( int i = 0 ; i < source.size() ; i++){
Object sourceItem = source.get(i);