Parker 4 years ago
commit 515fba85a7

@ -16,16 +16,13 @@
package org.opsli.common.utils;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
@ -76,6 +73,10 @@ public final class WrapperUtil {
* @return M
*/
public static <T,M> M transformInstance(Object source, Class<M> target, boolean isClone){
if(source == null){
return null;
}
if(isClone){
source = ObjectUtil.cloneByStream(source);
}
@ -99,6 +100,10 @@ public final class WrapperUtil {
* @return List<M>
*/
public static <T,M> List<M> transformInstance(Collection<T> source, Class<M> target, boolean isClone){
if(CollUtil.isEmpty(source)){
return null;
}
if(isClone){
source = ObjectUtil.cloneByStream(source);
}

@ -59,7 +59,7 @@ public enum SystemMsg implements BaseMsg {
EXCEPTION_USER_NO_UNIQUE(20306,"该工号已存在"),
EXCEPTION_ORG_NOT_NULL(20307,"组织不可为空"),
EXCEPTION_USER_ORG_ERROR(20308,"用户组织设置失败"),
EXCEPTION_USER_NULL(20309,"暂无该用户"),
EXCEPTION_USER_NULL(20309,"暂无该用户: {}"),
EXCEPTION_USER_FILE_NULL(20310,"请选择文件"),

@ -21,6 +21,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
@ -44,7 +45,6 @@ import org.opsli.common.exception.TokenException;
import org.opsli.common.utils.HumpUtil;
import org.opsli.common.utils.WrapperUtil;
import org.opsli.core.base.controller.BaseRestController;
import org.opsli.core.msg.CoreMsg;
import org.opsli.core.msg.TokenMsg;
import org.opsli.core.persistence.Page;
import org.opsli.core.persistence.querybuilder.GenQueryBuilder;
@ -460,7 +460,9 @@ public class UserRestController extends BaseRestController<SysUser, UserModel, I
UserModel userModel = IService.queryByUserName(username);
if(userModel == null){
// 暂无该用户
throw new ServiceException(SystemMsg.EXCEPTION_USER_NULL);
throw new ServiceException(SystemMsg.EXCEPTION_USER_NULL.getCode(),
StrUtil.format(SystemMsg.EXCEPTION_USER_NULL.getMessage(), username)
);
}
return ResultVo.success(userModel);
}

Loading…
Cancel
Save