重命名VO DTO

This commit is contained in:
冷冷 2018-04-06 23:14:39 +08:00
parent 6201c9b278
commit fbbca0ee4c
22 changed files with 54 additions and 54 deletions

View File

@ -10,7 +10,7 @@ import java.io.Serializable;
* @date 2017/11/20
*/
@Data
public class LogVo implements Serializable {
public class LogVO implements Serializable {
private static final long serialVersionUID = 1L;
private SysLog sysLog;

View File

@ -14,7 +14,7 @@ import java.util.Date;
* @since 2017-11-08
*/
@Data
public class MenuVo implements Serializable {
public class MenuVO 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.MenuVo;
import com.github.pig.common.vo.MenuVO;
import com.github.pig.gateway.feign.fallback.MenuServiceFallbackImpl;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
@ -21,5 +21,5 @@ public interface MenuService {
* @return 菜单列表
*/
@GetMapping(value = "/menu/findMenuByRole/{role}")
Set<MenuVo> findMenuByRole(@PathVariable("role") String role);
Set<MenuVO> findMenuByRole(@PathVariable("role") String role);
}

View File

@ -1,6 +1,6 @@
package com.github.pig.gateway.feign.fallback;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import com.github.pig.gateway.feign.MenuService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -18,7 +18,7 @@ import java.util.Set;
public class MenuServiceFallbackImpl implements MenuService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public Set<MenuVo> findMenuByRole(String role) {
public Set<MenuVO> findMenuByRole(String role) {
logger.error("调用{}异常{}","findMenuByRole",role);
return null;
}

View File

@ -4,7 +4,7 @@ import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.constant.MqQueueConstant;
import com.github.pig.common.entity.SysLog;
import com.github.pig.common.util.UserUtils;
import com.github.pig.common.vo.LogVo;
import com.github.pig.common.vo.LogVO;
import com.github.pig.gateway.service.LogSendService;
import com.netflix.zuul.context.RequestContext;
import com.xiaoleilu.hutool.http.HttpUtil;
@ -98,7 +98,7 @@ public class LogSendServiceImpl implements LogSendService {
}
//保存发往MQ只保存授权
LogVo logVo = new LogVo();
LogVO logVo = new LogVO();
logVo.setSysLog(log);
if (StringUtils.isNotEmpty(request.getHeader(CommonConstant.REQ_HEADER))) {
logVo.setToken(request.getHeader(CommonConstant.REQ_HEADER));

View File

@ -1,7 +1,7 @@
package com.github.pig.gateway.service.impl;
import com.baomidou.mybatisplus.toolkit.StringUtils;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import com.github.pig.gateway.feign.MenuService;
import com.github.pig.gateway.service.PermissionService;
import com.xiaoleilu.hutool.collection.CollectionUtil;
@ -42,12 +42,12 @@ public class PermissionServiceImpl implements PermissionService {
return hasPermission;
}
Set<MenuVo> urls = new HashSet<>();
Set<MenuVO> urls = new HashSet<>();
for (SimpleGrantedAuthority authority : grantedAuthorityList) {
urls.addAll(menuService.findMenuByRole(authority.getAuthority()));
}
for (MenuVo menu : urls) {
for (MenuVO menu : urls) {
if (StringUtils.isNotEmpty(menu.getUrl()) && antPathMatcher.match(menu.getUrl(), request.getRequestURI())
&& request.getMethod().equalsIgnoreCase(menu.getMethod())) {
hasPermission = true;

View File

@ -4,7 +4,7 @@ import com.github.pig.admin.service.SysLogService;
import com.github.pig.common.constant.MqQueueConstant;
import com.github.pig.common.entity.SysLog;
import com.github.pig.common.util.UserUtils;
import com.github.pig.common.vo.LogVo;
import com.github.pig.common.vo.LogVO;
import org.slf4j.MDC;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
@ -24,7 +24,7 @@ public class LogReceiveListener {
private SysLogService sysLogService;
@RabbitHandler
public void receive(LogVo logVo) {
public void receive(LogVO logVo) {
SysLog sysLog = logVo.getSysLog();
String username = UserUtils.getUserName(logVo.getToken());
MDC.put(KEY_USER, username);

View File

@ -7,7 +7,7 @@ import com.github.pig.admin.model.entity.SysMenu;
import com.github.pig.admin.service.SysMenuService;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.util.R;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import com.github.pig.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -33,7 +33,7 @@ public class MenuController extends BaseController {
* @return 菜单列表
*/
@GetMapping("/findMenuByRole/{role}")
public Set<MenuVo> findMenuByRole(@PathVariable String role) {
public Set<MenuVO> findMenuByRole(@PathVariable String role) {
return sysMenuService.findMenuByRole(role);
}
@ -65,9 +65,9 @@ public class MenuController extends BaseController {
*/
@GetMapping("/userTree")
public List<Integer> userTree() {
Set<MenuVo> menus = sysMenuService.findMenuByRole(getRole().get(0));
Set<MenuVO> menus = sysMenuService.findMenuByRole(getRole().get(0));
List<Integer> menuList = new ArrayList<>();
for (MenuVo menuVo : menus) {
for (MenuVO menuVo : menus) {
menuList.add(menuVo.getMenuId());
}
return menuList;
@ -81,9 +81,9 @@ public class MenuController extends BaseController {
*/
@GetMapping("/roleTree/{roleName}")
public List<Integer> roleTree(@PathVariable String roleName) {
Set<MenuVo> menus = sysMenuService.findMenuByRole(roleName);
Set<MenuVO> menus = sysMenuService.findMenuByRole(roleName);
List<Integer> menuList = new ArrayList<>();
for (MenuVo menuVo : menus) {
for (MenuVO menuVo : menus) {
menuList.add(menuVo.getMenuId());
}
return menuList;

View File

@ -2,7 +2,7 @@ package com.github.pig.admin.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.github.pig.admin.model.dto.RoleDto;
import com.github.pig.admin.model.dto.RoleDTO;
import com.github.pig.admin.model.entity.SysRole;
import com.github.pig.admin.service.SysRoleMenuService;
import com.github.pig.admin.service.SysRoleService;
@ -46,7 +46,7 @@ public class RoleController extends BaseController {
* @return successfalse
*/
@PostMapping
public R<Boolean> role(@RequestBody RoleDto roleDto) {
public R<Boolean> role(@RequestBody RoleDTO roleDto) {
return new R<>(sysRoleService.insertRole(roleDto));
}
@ -57,7 +57,7 @@ public class RoleController extends BaseController {
* @return success/false
*/
@PutMapping
public R<Boolean> roleUpdate(@RequestBody RoleDto roleDto) {
public R<Boolean> roleUpdate(@RequestBody RoleDTO roleDto) {
return new R<>(sysRoleService.updateRoleById(roleDto));
}

View File

@ -1,7 +1,7 @@
package com.github.pig.admin.controller;
import com.baomidou.mybatisplus.plugins.Page;
import com.github.pig.admin.model.dto.UserDto;
import com.github.pig.admin.model.dto.UserDTO;
import com.github.pig.admin.model.dto.UserInfo;
import com.github.pig.admin.model.entity.SysUser;
import com.github.pig.admin.model.entity.SysUserRole;
@ -89,7 +89,7 @@ public class UserController extends BaseController {
* @return success/false
*/
@PostMapping
public R<Boolean> user(@RequestBody UserDto userDto) {
public R<Boolean> user(@RequestBody UserDTO userDto) {
SysUser sysUser = new SysUser();
BeanUtils.copyProperties(userDto, sysUser);
sysUser.setDelFlag(CommonConstant.STATUS_NORMAL);
@ -108,7 +108,7 @@ public class UserController extends BaseController {
* @return R
*/
@PutMapping
public R<Boolean> userUpdate(@RequestBody UserDto userDto) {
public R<Boolean> userUpdate(@RequestBody UserDTO userDto) {
SysUser user = userService.selectById(userDto.getUserId());
return new R<>(userService.updateUser(userDto, user.getUsername()));
}
@ -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

@ -2,7 +2,7 @@ package com.github.pig.admin.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.github.pig.admin.model.entity.SysMenu;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import org.apache.ibatis.annotations.Param;
import java.util.Set;
@ -23,5 +23,5 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
* @param role 角色名称
* @return 菜单列表
*/
Set<MenuVo> findMenuByRoleName(@Param("role") String role);
Set<MenuVO> findMenuByRoleName(@Param("role") String role);
}

View File

@ -1,6 +1,6 @@
package com.github.pig.admin.model.dto;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import lombok.Data;
/**
@ -38,7 +38,7 @@ public class MenuTree extends TreeNode {
this.label = name;
}
public MenuTree(MenuVo menuVo) {
public MenuTree(MenuVO menuVo) {
this.id = menuVo.getMenuId();
this.parentId = menuVo.getParentId();
this.icon = menuVo.getIcon();

View File

@ -9,7 +9,7 @@ import lombok.Data;
* 角色Dto
*/
@Data
public class RoleDto extends SysRole {
public class RoleDTO extends SysRole {
/**
* 角色部门Id
*/

View File

@ -8,7 +8,7 @@ import lombok.Data;
* @date 2017/11/5
*/
@Data
public class UserDto extends SysUser {
public class UserDTO extends SysUser {
/**
* 角色ID
*/

View File

@ -4,7 +4,7 @@ package com.github.pig.admin.service;
import com.baomidou.mybatisplus.service.IService;
import com.github.pig.admin.model.dto.MenuTree;
import com.github.pig.admin.model.entity.SysMenu;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import java.util.List;
import java.util.Set;
@ -24,7 +24,7 @@ public interface SysMenuService extends IService<SysMenu> {
* @param role 角色名称
* @return 菜单列表
*/
Set<MenuVo> findMenuByRole(String role);
Set<MenuVO> findMenuByRole(String role);
/**
* 通过角色获取菜单权限列表

View File

@ -3,7 +3,7 @@ package com.github.pig.admin.service;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.github.pig.admin.model.dto.RoleDto;
import com.github.pig.admin.model.dto.RoleDTO;
import com.github.pig.admin.model.entity.SysRole;
import com.github.pig.common.util.Query;
@ -25,7 +25,7 @@ public interface SysRoleService extends IService<SysRole> {
* @param roleDto 角色信息
* @return 成功失败
*/
Boolean insertRole(RoleDto roleDto);
Boolean insertRole(RoleDTO roleDto);
/**
* 分页查角色列表
@ -41,7 +41,7 @@ public interface SysRoleService extends IService<SysRole> {
* @param roleDto 含有部门信息
* @return 成功失败
*/
Boolean updateRoleById(RoleDto roleDto);
Boolean updateRoleById(RoleDTO roleDto);
/**
* 通过部门ID查询角色列表

View File

@ -2,7 +2,7 @@ package com.github.pig.admin.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.github.pig.admin.model.dto.UserDto;
import com.github.pig.admin.model.dto.UserDTO;
import com.github.pig.admin.model.dto.UserInfo;
import com.github.pig.admin.model.entity.SysUser;
import com.github.pig.common.util.Query;
@ -57,7 +57,7 @@ public interface SysUserService extends IService<SysUser> {
* @param username 用户名
* @return Boolean
*/
Boolean updateUserInfo(UserDto userDto, String username);
Boolean updateUserInfo(UserDTO userDto, String username);
/**
* 更新指定用户信息
@ -65,7 +65,7 @@ public interface SysUserService extends IService<SysUser> {
* @param username 用户信息
* @return
*/
Boolean updateUser(UserDto userDto, String username);
Boolean updateUser(UserDTO userDto, String username);
/**
* 通过手机号查询用户信息

View File

@ -9,7 +9,7 @@ import com.github.pig.admin.model.entity.SysMenu;
import com.github.pig.admin.service.SysMenuService;
import com.github.pig.common.constant.CommonConstant;
import com.github.pig.common.util.Assert;
import com.github.pig.common.vo.MenuVo;
import com.github.pig.common.vo.MenuVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
@ -36,20 +36,20 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
@Cacheable(value = "menu_details", key = "#role + '_menu'")
public Set<MenuVo> findMenuByRole(String role) {
public Set<MenuVO> findMenuByRole(String role) {
return sysMenuMapper.findMenuByRoleName(role);
}
@Override
public String[] findPermission(String[] roles) {
Set<MenuVo> menuVoSet = new HashSet<>();
Set<MenuVO> menuVoSet = new HashSet<>();
for (String role : roles) {
Set<MenuVo> menuVos = findMenuByRole(role);
Set<MenuVO> menuVos = findMenuByRole(role);
menuVoSet.addAll(menuVos);
}
Set<String> permissions = new HashSet<>();
for (MenuVo menuVo : menuVoSet) {
for (MenuVO menuVo : menuVoSet) {
if (StringUtils.isNotEmpty(menuVo.getPermission())) {
String permission = menuVo.getPermission();
permissions.add(permission);
@ -92,7 +92,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
public List<MenuTree> findUserMenuTree(String roleName) {
// 获取符合条件得菜单
Set<MenuVo> all = findMenuByRole(roleName);
Set<MenuVO> all = findMenuByRole(roleName);
final List<MenuTree> menuTreeList = new ArrayList<>();
all.stream().forEach((menuVo -> {
if (CommonConstant.MENU.equals(menuVo.getType())) {

View File

@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pig.admin.mapper.SysRoleDeptMapper;
import com.github.pig.admin.mapper.SysRoleMapper;
import com.github.pig.admin.model.dto.RoleDto;
import com.github.pig.admin.model.dto.RoleDTO;
import com.github.pig.admin.model.entity.SysRole;
import com.github.pig.admin.model.entity.SysRoleDept;
import com.github.pig.admin.service.SysRoleService;
@ -39,7 +39,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
* @return 成功失败
*/
@Override
public Boolean insertRole(RoleDto roleDto) {
public Boolean insertRole(RoleDTO roleDto) {
SysRole sysRole = new SysRole();
BeanUtils.copyProperties(roleDto, sysRole);
sysRoleMapper.insert(sysRole);
@ -71,7 +71,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean updateRoleById(RoleDto roleDto) {
public Boolean updateRoleById(RoleDTO roleDto) {
//删除原有的角色部门关系
SysRoleDept condition = new SysRoleDept();
condition.setRoleId(roleDto.getRoleId());

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pig.admin.mapper.SysUserMapper;
import com.github.pig.admin.model.dto.UserDto;
import com.github.pig.admin.model.dto.UserDTO;
import com.github.pig.admin.model.dto.UserInfo;
import com.github.pig.admin.model.entity.SysDeptRelation;
import com.github.pig.admin.model.entity.SysUser;
@ -203,7 +203,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@CacheEvict(value = "user_details", key = "#username")
public Boolean updateUserInfo(UserDto userDto, String username) {
public Boolean updateUserInfo(UserDTO userDto, String username) {
UserVo userVo = this.findUserByUsername(username);
SysUser sysUser = new SysUser();
@ -217,7 +217,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
@CacheEvict(value = "user_details", key = "#username")
public Boolean updateUser(UserDto userDto, String username) {
public Boolean updateUser(UserDTO userDto, String username) {
SysUser sysUser = new SysUser();
BeanUtils.copyProperties(userDto, sysUser);
sysUser.setUpdateTime(new Date());

View File

@ -20,7 +20,7 @@
<result column="del_flag" property="delFlag" />
</resultMap>
<resultMap id="MenuVoResultMap" type="com.github.pig.common.vo.MenuVo">
<resultMap id="MenuVoResultMap" type="com.github.pig.common.vo.MenuVO">
<id column="menu_id" property="menuId" />
<result column="name" property="name" />
<result column="permission" property="permission" />

View File

@ -14,7 +14,7 @@
</resultMap>
<!--roleDto-->
<resultMap id="RoleDtoMap" type="com.github.pig.admin.model.dto.RoleDto">
<resultMap id="RoleDtoMap" type="com.github.pig.admin.model.dto.RoleDTO">
<id column="role_id" property="roleId" />
<result column="role_name" property="roleName" />
<result column="role_code" property="roleCode" />