重命名VO DTO

This commit is contained in:
冷冷 2018-04-07 13:52:33 +08:00
parent fbbca0ee4c
commit 165bf328ac
15 changed files with 53 additions and 53 deletions

View File

@ -1,7 +1,7 @@
package com.github.pig.auth.feign;
import com.github.pig.auth.feign.fallback.UserServiceFallbackImpl;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -19,7 +19,7 @@ public interface UserService {
* @return UserVo
*/
@GetMapping("/user/findUserByUsername/{username}")
UserVo findUserByUsername(@PathVariable("username") String username);
UserVO findUserByUsername(@PathVariable("username") String username);
/**
* 通过手机号查询用户角色信息
@ -28,7 +28,7 @@ public interface UserService {
* @return UserVo
*/
@GetMapping("/user/findUserByMobile/{mobile}")
UserVo findUserByMobile(@PathVariable("mobile") String mobile);
UserVO findUserByMobile(@PathVariable("mobile") String mobile);
/**
* 根据OpenId查询用户信息
@ -36,5 +36,5 @@ public interface UserService {
* @return UserVo
*/
@GetMapping("/user/findUserByOpenId/{openId}")
UserVo findUserByOpenId(@PathVariable("openId") String openId);
UserVO findUserByOpenId(@PathVariable("openId") String openId);
}

View File

@ -1,7 +1,7 @@
package com.github.pig.auth.feign.fallback;
import com.github.pig.auth.feign.UserService;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@ -16,7 +16,7 @@ public class UserServiceFallbackImpl implements UserService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public UserVo findUserByUsername(String username) {
public UserVO findUserByUsername(String username) {
logger.error("调用{}异常:{}", "findUserByUsername", username);
return null;
}
@ -28,7 +28,7 @@ public class UserServiceFallbackImpl implements UserService {
* @return UserVo
*/
@Override
public UserVo findUserByMobile(String mobile) {
public UserVO findUserByMobile(String mobile) {
logger.error("调用{}异常:{}", "通过手机号查询用户", mobile);
return null;
}
@ -40,7 +40,7 @@ public class UserServiceFallbackImpl implements UserService {
* @return UserVo
*/
@Override
public UserVo findUserByOpenId(String openId) {
public UserVO findUserByOpenId(String openId) {
logger.error("调用{}异常:{}", "通过OpenId查询用户", openId);
return null;
}

View File

@ -2,7 +2,7 @@ package com.github.pig.auth.serivce;
import com.github.pig.auth.feign.UserService;
import com.github.pig.auth.util.UserDetailsImpl;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@ -20,7 +20,7 @@ public class UserDetailServiceImpl implements UserDetailsService {
@Override
public UserDetailsImpl loadUserByUsername(String username) throws UsernameNotFoundException {
UserVo userVo = userService.findUserByUsername(username);
UserVO userVo = userService.findUserByUsername(username);
return new UserDetailsImpl(userVo);
}
}

View File

@ -3,7 +3,7 @@ package com.github.pig.auth.util;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.constant.SecurityConstants;
import com.github.pig.common.vo.SysRole;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
@ -25,7 +25,7 @@ public class UserDetailsImpl implements UserDetails {
private String status;
private List<SysRole> roleList = new ArrayList<>();
public UserDetailsImpl(UserVo userVo) {
public UserDetailsImpl(UserVO userVo) {
this.username = userVo.getUsername();
this.password = userVo.getPassword();
this.status = userVo.getDelFlag();

View File

@ -3,7 +3,7 @@ package com.github.pig.common.bean.resolver;
import com.github.pig.common.constant.SecurityConstants;
import com.github.pig.common.util.UserUtils;
import com.github.pig.common.vo.SysRole;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -42,7 +42,7 @@ public class TokenArgumentResolver implements HandlerMethodArgumentResolver {
*/
@Override
public boolean supportsParameter(MethodParameter methodParameter) {
return methodParameter.getParameterType().equals(UserVo.class);
return methodParameter.getParameterType().equals(UserVO.class);
}
/**
@ -69,7 +69,7 @@ public class TokenArgumentResolver implements HandlerMethodArgumentResolver {
logger.error("resolveArgument error token is empty");
return null;
}
Optional<UserVo> optional = Optional.ofNullable(cacheManager.getCache(SecurityConstants.TOKEN_USER_DETAIL).get(token, UserVo.class));
Optional<UserVO> optional = Optional.ofNullable(cacheManager.getCache(SecurityConstants.TOKEN_USER_DETAIL).get(token, UserVO.class));
if (optional.isPresent()) {
logger.info("return cache user vo,token :{}", token);
return optional.get();
@ -77,11 +77,11 @@ public class TokenArgumentResolver implements HandlerMethodArgumentResolver {
return optional.orElseGet(() -> generatorByToken(request, token));
}
private UserVo generatorByToken(HttpServletRequest request, String token) {
private UserVO generatorByToken(HttpServletRequest request, String token) {
String username = UserUtils.getUserName(request);
List<String> roles = UserUtils.getRole(request);
logger.info("Auth-Token-User:{}-Roles:{}", username, roles);
UserVo userVo = new UserVo();
UserVO userVo = new UserVO();
userVo.setUsername(username);
List<SysRole> sysRoleList = new ArrayList<>();
roles.stream().forEach(role -> {

View File

@ -12,7 +12,7 @@ import java.util.List;
* @date 2017/10/29
*/
@Data
public class UserVo implements Serializable {
public class UserVO implements Serializable {
private static final long serialVersionUID = 1L;
/**

View File

@ -1,6 +1,6 @@
package com.github.pig.gateway.feign;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import com.github.pig.gateway.feign.fallback.UserServiceFallbackImpl;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -19,5 +19,5 @@ public interface UserService {
* @return UserVo
*/
@GetMapping("/user/findUserByUsername/{username}")
UserVo findUserByUsername(@PathVariable("username") String username);
UserVO findUserByUsername(@PathVariable("username") String username);
}

View File

@ -1,6 +1,6 @@
package com.github.pig.gateway.feign.fallback;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import com.github.pig.gateway.feign.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -16,7 +16,7 @@ public class UserServiceFallbackImpl implements UserService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public UserVo findUserByUsername(String username) {
public UserVO findUserByUsername(String username) {
logger.error("调用{}异常:{}", "findUserByUsername", username);
return null;
}

View File

@ -1,6 +1,6 @@
package com.github.pig.gateway.service.impl;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import com.github.pig.gateway.feign.UserService;
import com.github.pig.gateway.util.UserDetailsImpl;
import org.apache.commons.lang.StringUtils;
@ -26,7 +26,7 @@ public class UserDetailServiceImpl implements UserDetailsService, Serializable {
if (StringUtils.isBlank(username)) {
throw new UsernameNotFoundException("用户不存在:" + username);
}
UserVo userVo = userService.findUserByUsername(username);
UserVO userVo = userService.findUserByUsername(username);
return new UserDetailsImpl(userVo);
}
}

View File

@ -3,7 +3,7 @@ package com.github.pig.gateway.util;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.constant.SecurityConstants;
import com.github.pig.common.vo.SysRole;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
@ -25,7 +25,7 @@ public class UserDetailsImpl implements UserDetails {
private String status;
private List<SysRole> roleList = new ArrayList<>();
public UserDetailsImpl(UserVo userVo) {
public UserDetailsImpl(UserVO userVo) {
this.username = userVo.getUsername();
this.password = userVo.getPassword();
this.status = userVo.getDelFlag();

View File

@ -10,7 +10,7 @@ import com.github.pig.common.bean.config.FdfsPropertiesConfig;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.util.Query;
import com.github.pig.common.util.R;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import com.github.pig.common.web.BaseController;
import com.luhuiguo.fastdfs.domain.StorePath;
import com.luhuiguo.fastdfs.service.FastFileStorageClient;
@ -52,7 +52,7 @@ public class UserController extends BaseController {
* @return 用户名
*/
@GetMapping("/info")
public R<UserInfo> user(UserVo userVo) {
public R<UserInfo> user(UserVO userVo) {
UserInfo userInfo = userService.findUserInfo(userVo);
return new R<>(userInfo);
}
@ -64,7 +64,7 @@ public class UserController extends BaseController {
* @return 用户信息
*/
@GetMapping("/{id}")
public UserVo user(@PathVariable Integer id) {
public UserVO user(@PathVariable Integer id) {
return userService.selectUserVoById(id);
}
@ -120,7 +120,7 @@ public class UserController extends BaseController {
* @return UseVo 对象
*/
@GetMapping("/findUserByUsername/{username}")
public UserVo findUserByUsername(@PathVariable String username) {
public UserVO findUserByUsername(@PathVariable String username) {
return userService.findUserByUsername(username);
}
@ -131,7 +131,7 @@ public class UserController extends BaseController {
* @return UseVo 对象
*/
@GetMapping("/findUserByMobile/{mobile}")
public UserVo findUserByMobile(@PathVariable String mobile) {
public UserVO findUserByMobile(@PathVariable String mobile) {
return userService.findUserByMobile(mobile);
}
@ -142,7 +142,7 @@ public class UserController extends BaseController {
* @return 对象
*/
@GetMapping("/findUserByOpenId/{openId}")
public UserVo findUserByOpenId(@PathVariable String openId) {
public UserVO findUserByOpenId(@PathVariable String openId) {
return userService.findUserByOpenId(openId);
}
@ -186,7 +186,7 @@ public class UserController extends BaseController {
* @return success/false
*/
@PutMapping("/editInfo")
public R<Boolean> editInfo(@RequestBody UserDTO userDto, UserVo userVo) {
public R<Boolean> editInfo(@RequestBody UserDTO userDto, UserVO userVo) {
return new R<>(userService.updateUserInfo(userDto, userVo.getUsername()));
}
}

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.github.pig.admin.model.entity.SysUser;
import com.github.pig.common.bean.interceptor.DataScope;
import com.github.pig.common.util.Query;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import java.util.List;
@ -23,7 +23,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param username 用户名
* @return userVo
*/
UserVo selectUserVoByUsername(String username);
UserVO selectUserVoByUsername(String username);
/**
* 分页查询用户信息含角色
@ -40,7 +40,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param mobile 用户名
* @return userVo
*/
UserVo selectUserVoByMobile(String mobile);
UserVO selectUserVoByMobile(String mobile);
/**
* 通过openId查询用户信息
@ -48,7 +48,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param openId openid
* @return userVo
*/
UserVo selectUserVoByOpenId(String openId);
UserVO selectUserVoByOpenId(String openId);
/**
* 通过ID查询用户信息
@ -56,5 +56,5 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @param id 用户ID
* @return userVo
*/
UserVo selectUserVoById(Integer id);
UserVO selectUserVoById(Integer id);
}

View File

@ -7,7 +7,7 @@ import com.github.pig.admin.model.dto.UserInfo;
import com.github.pig.admin.model.entity.SysUser;
import com.github.pig.common.util.Query;
import com.github.pig.common.util.R;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
/**
* @author lengleng
@ -20,7 +20,7 @@ public interface SysUserService extends IService<SysUser> {
* @param username 用户名
* @return userVo
*/
UserVo findUserByUsername(String username);
UserVO findUserByUsername(String username);
/**
* 分页查询用户信息含有角色信息
@ -36,7 +36,7 @@ public interface SysUserService extends IService<SysUser> {
* @param userVo 角色名
* @return userInfo
*/
UserInfo findUserInfo(UserVo userVo);
UserInfo findUserInfo(UserVO userVo);
/**
* 保存验证码
@ -72,7 +72,7 @@ public interface SysUserService extends IService<SysUser> {
* @param mobile 手机号
* @return 用户信息
*/
UserVo findUserByMobile(String mobile);
UserVO findUserByMobile(String mobile);
/**
* 发送验证码
@ -86,12 +86,12 @@ public interface SysUserService extends IService<SysUser> {
* @param openId openId
* @return 用户信息
*/
UserVo findUserByOpenId(String openId);
UserVO findUserByOpenId(String openId);
/**
* 通过ID查询用户信息
* @param id 用户ID
* @return 用户信息
*/
UserVo selectUserVoById(Integer id);
UserVO selectUserVoById(Integer id);
}

View File

@ -22,7 +22,7 @@ import com.github.pig.common.util.R;
import com.github.pig.common.util.UserUtils;
import com.github.pig.common.util.template.MobileMsgTemplate;
import com.github.pig.common.vo.SysRole;
import com.github.pig.common.vo.UserVo;
import com.github.pig.common.vo.UserVO;
import com.xiaoleilu.hutool.collection.CollectionUtil;
import com.xiaoleilu.hutool.util.RandomUtil;
import com.xiaoleilu.hutool.util.StrUtil;
@ -64,7 +64,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private SysDeptRelationService sysDeptRelationService;
@Override
public UserInfo findUserInfo(UserVo userVo) {
public UserInfo findUserInfo(UserVO userVo) {
SysUser condition = new SysUser();
condition.setUsername(userVo.getUsername());
SysUser sysUser = this.selectOne(new EntityWrapper<>(condition));
@ -91,7 +91,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@Cacheable(value = "user_details", key = "#username")
public UserVo findUserByUsername(String username) {
public UserVO findUserByUsername(String username) {
return sysUserMapper.selectUserVoByUsername(username);
}
@ -103,7 +103,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*/
@Override
@Cacheable(value = "user_details_mobile", key = "#mobile")
public UserVo findUserByMobile(String mobile) {
public UserVO findUserByMobile(String mobile) {
return sysUserMapper.selectUserVoByMobile(mobile);
}
@ -115,7 +115,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*/
@Override
@Cacheable(value = "user_details_openid", key = "#openId")
public UserVo findUserByOpenId(String openId) {
public UserVO findUserByOpenId(String openId) {
return sysUserMapper.selectUserVoByOpenId(openId);
}
@ -137,7 +137,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
* @return 用户信息
*/
@Override
public UserVo selectUserVoById(Integer id) {
public UserVO selectUserVoById(Integer id) {
return sysUserMapper.selectUserVoById(id);
}
@ -204,7 +204,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@CacheEvict(value = "user_details", key = "#username")
public Boolean updateUserInfo(UserDTO userDto, String username) {
UserVo userVo = this.findUserByUsername(username);
UserVO userVo = this.findUserByUsername(username);
SysUser sysUser = new SysUser();
if (ENCODER.matches(userDto.getPassword(), userVo.getPassword())) {
@ -238,7 +238,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private List<Integer> getChildDepts() {
//获取当前用户的部门
String username = UserUtils.getUser();
UserVo userVo = findUserByUsername(username);
UserVO userVo = findUserByUsername(username);
Integer deptId = userVo.getDeptId();
//获取当前部门的子部门

View File

@ -16,7 +16,7 @@
</resultMap>
<!-- userVo结果集 -->
<resultMap id="userVoResultMap" type="com.github.pig.common.vo.UserVo">
<resultMap id="userVoResultMap" type="com.github.pig.common.vo.UserVO">
<id column="user_id" property="userId"/>
<result column="username" property="username"/>
<result column="password" property="password"/>