mirror of https://gitee.com/maxjhandsome/pig
♻️ Refactoring code.refactor method name according to "Alibaba Java Coding Guidelines"
This commit is contained in:
parent
0f6655364a
commit
b0cb1e0770
|
@ -56,9 +56,9 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
|
|||
.authorizeRequests()
|
||||
.antMatchers(
|
||||
"/actuator/**",
|
||||
"/oauth/removeToken",
|
||||
"/oauth/delToken/*",
|
||||
"/oauth/listToken",
|
||||
"/oauth/logout",
|
||||
"/oauth/logout/*",
|
||||
"/oauth/token/page",
|
||||
"/mobile/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and().csrf().disable();
|
||||
|
|
|
@ -59,11 +59,11 @@ public class PigTokenEndpoint {
|
|||
private final RedisTemplate redisTemplate;
|
||||
|
||||
/**
|
||||
* 退出token
|
||||
* 退出并删除token
|
||||
*
|
||||
* @param authHeader Authorization
|
||||
*/
|
||||
@GetMapping("/removeToken")
|
||||
@GetMapping("/logout")
|
||||
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
|
||||
if (StringUtils.hasText(authHeader)) {
|
||||
String tokenValue = authHeader.replace("Bearer", "").trim();
|
||||
|
@ -83,8 +83,8 @@ public class PigTokenEndpoint {
|
|||
* @param token token
|
||||
* @param from 内部调用标志
|
||||
*/
|
||||
@DeleteMapping("/delToken/{token}")
|
||||
public R<Boolean> delToken(@PathVariable("token") String token, @RequestHeader(required = false) String from) {
|
||||
@DeleteMapping("/{token}")
|
||||
public R<Boolean> removeToken(@PathVariable("token") String token, @RequestHeader(required = false) String from) {
|
||||
if (StrUtil.isBlank(from)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ public class PigTokenEndpoint {
|
|||
* @param params 分页参数
|
||||
* @param from 标志
|
||||
*/
|
||||
@PostMapping("/listToken")
|
||||
public R tokenList(@RequestBody Map<String, Object> params, @RequestHeader(required = false) String from) {
|
||||
@PostMapping("/token/page")
|
||||
public R getTokenPage(@RequestBody Map<String, Object> params, @RequestHeader(required = false) String from) {
|
||||
if (StrUtil.isBlank(from)) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.a
|
|||
*/
|
||||
@Component
|
||||
public class PigRequestGlobalFilter implements GlobalFilter, Ordered {
|
||||
private static final String HEADER_NAME = "X-Forwarded-Prefix";
|
||||
|
||||
/**
|
||||
* Process the Web request and (optionally) delegate to the next
|
||||
|
|
|
@ -38,8 +38,8 @@ public interface RemoteTokenService {
|
|||
* @param from 内部调用标志
|
||||
* @return page
|
||||
*/
|
||||
@PostMapping("/oauth/listToken")
|
||||
R selectPage(@RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
@PostMapping("/oauth/token/page")
|
||||
R getTokenPage(@RequestBody Map<String, Object> params, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
|
||||
/**
|
||||
* 删除token
|
||||
|
@ -48,6 +48,6 @@ public interface RemoteTokenService {
|
|||
* @param from 调用标志
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/oauth/delToken/{token}")
|
||||
R<Boolean> deleteTokenById(@PathVariable("token") String token, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
@DeleteMapping("/oauth/{token}")
|
||||
R<Boolean> removeToken(@PathVariable("token") String token, @RequestHeader(SecurityConstants.FROM) String from);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class RemoteTokenServiceFallbackImpl implements RemoteTokenService {
|
|||
* @return page
|
||||
*/
|
||||
@Override
|
||||
public R selectPage(Map<String, Object> params, String from) {
|
||||
public R getTokenPage(Map<String, Object> params, String from) {
|
||||
log.error("调用认证中心查询token 失败", cause);
|
||||
return null;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class RemoteTokenServiceFallbackImpl implements RemoteTokenService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R<Boolean> deleteTokenById(String s, String id) {
|
||||
public R<Boolean> removeToken(String s, String id) {
|
||||
log.error("删除token 失败 {}", id, cause);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
|
||||
* <p>
|
||||
* Licensed under the GNU Lesser General Public License 3.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* https://www.gnu.org/licenses/lgpl.html
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.admin.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2018/8/27
|
||||
* 前端日志vo
|
||||
*/
|
||||
@Data
|
||||
public class PreLogVo {
|
||||
private String url;
|
||||
private String time;
|
||||
private String user;
|
||||
private String type;
|
||||
private String message;
|
||||
private String stack;
|
||||
private String info;
|
||||
}
|
|
@ -13,7 +13,6 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.admin.controller;
|
||||
|
||||
import com.pig4cloud.pig.admin.api.entity.SysDept;
|
||||
|
@ -59,8 +58,8 @@ public class DeptController {
|
|||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/tree")
|
||||
public R getTree() {
|
||||
return new R<>(sysDeptService.selectTree());
|
||||
public R listDeptTrees() {
|
||||
return new R<>(sysDeptService.listDeptTrees());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,8 +68,8 @@ public class DeptController {
|
|||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/user-tree")
|
||||
public R getUserTree() {
|
||||
return new R<>(sysDeptService.getUserTree());
|
||||
public R listCurrentUserDeptTrees() {
|
||||
return new R<>(sysDeptService.listCurrentUserDeptTrees());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,14 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pig.admin.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pig.admin.api.vo.PreLogVo;
|
||||
import com.pig4cloud.pig.admin.service.SysLogService;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||
|
@ -29,7 +26,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -81,14 +77,4 @@ public class LogController {
|
|||
return new R<>(sysLogService.save(sysLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入前端异常日志
|
||||
*
|
||||
* @param preLogVoList 日志实体
|
||||
* @return success/false
|
||||
*/
|
||||
@PostMapping("/logs")
|
||||
public R saveBatchLogs(@RequestBody List<PreLogVo> preLogVoList) {
|
||||
return new R<>(sysLogService.saveBatchLogs(preLogVoList));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MenuController {
|
|||
// 获取符合条件的菜单
|
||||
Set<MenuVO> all = new HashSet<>();
|
||||
SecurityUtils.getRoles()
|
||||
.forEach(roleId -> all.addAll(sysMenuService.findMenuByRoleId(roleId)));
|
||||
.forEach(roleId -> all.addAll(sysMenuService.getMenuByRoleId(roleId)));
|
||||
List<MenuTree> menuTreeList = all.stream()
|
||||
.filter(menuVo -> CommonConstants.MENU.equals(menuVo.getType()))
|
||||
.map(MenuTree::new)
|
||||
|
@ -84,7 +84,7 @@ public class MenuController {
|
|||
*/
|
||||
@GetMapping("/tree/{roleId}")
|
||||
public List getRoleTree(@PathVariable Integer roleId) {
|
||||
return sysMenuService.findMenuByRoleId(roleId)
|
||||
return sysMenuService.getMenuByRoleId(roleId)
|
||||
.stream()
|
||||
.map(MenuVO::getMenuId)
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -44,7 +44,7 @@ public class TokenController {
|
|||
*/
|
||||
@GetMapping("/page")
|
||||
public R token(@RequestParam Map<String, Object> params) {
|
||||
return remoteTokenService.selectPage(params, SecurityConstants.FROM_IN);
|
||||
return remoteTokenService.getTokenPage(params, SecurityConstants.FROM_IN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,6 +56,6 @@ public class TokenController {
|
|||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_token_del')")
|
||||
public R<Boolean> delete(@PathVariable String id) {
|
||||
return remoteTokenService.deleteTokenById(id, SecurityConstants.FROM_IN);
|
||||
return remoteTokenService.removeToken(id, SecurityConstants.FROM_IN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class UserController {
|
|||
if (user == null) {
|
||||
return new R<>(Boolean.FALSE, "获取当前用户信息失败");
|
||||
}
|
||||
return new R<>(userService.findUserInfo(user));
|
||||
return new R<>(userService.getUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,7 +71,7 @@ public class UserController {
|
|||
if (user == null) {
|
||||
return new R<>(Boolean.FALSE, String.format("用户信息为空 %s", username));
|
||||
}
|
||||
return new R<>(userService.findUserInfo(user));
|
||||
return new R<>(userService.getUserInfo(user));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +82,7 @@ public class UserController {
|
|||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R user(@PathVariable Integer id) {
|
||||
return new R<>(userService.selectUserVoById(id));
|
||||
return new R<>(userService.getUserVoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,7 +109,7 @@ public class UserController {
|
|||
@PreAuthorize("@pms.hasPermission('sys_user_del')")
|
||||
public R userDel(@PathVariable Integer id) {
|
||||
SysUser sysUser = userService.getById(id);
|
||||
return new R<>(userService.deleteUserById(sysUser));
|
||||
return new R<>(userService.removeUserById(sysUser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ public class UserController {
|
|||
*/
|
||||
@GetMapping("/page")
|
||||
public R getUserPage(Page page, UserDTO userDTO) {
|
||||
return new R<>(userService.getUsersWithRolePage(page, userDTO));
|
||||
return new R<>(userService.getUserWithRolePage(page, userDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,6 +168,6 @@ public class UserController {
|
|||
*/
|
||||
@GetMapping("/ancestor/{username}")
|
||||
public R listAncestorUsers(@PathVariable String username) {
|
||||
return new R<>(userService.listAncestorUsers(username));
|
||||
return new R<>(userService.listAncestorUsersByUsername(username));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,19 +35,19 @@ public interface SysDeptRelationService extends IService<SysDeptRelation> {
|
|||
*
|
||||
* @param sysDept 部门
|
||||
*/
|
||||
void insertDeptRelation(SysDept sysDept);
|
||||
void saveDeptRelation(SysDept sysDept);
|
||||
|
||||
/**
|
||||
* 通过ID删除部门关系
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteAllDeptRealtion(Integer id);
|
||||
void removeDeptRelationById(Integer id);
|
||||
|
||||
/**
|
||||
* 更新部门关系
|
||||
*
|
||||
* @param relation
|
||||
*/
|
||||
void updateDeptRealtion(SysDeptRelation relation);
|
||||
void updateDeptRelation(SysDeptRelation relation);
|
||||
}
|
||||
|
|
|
@ -37,14 +37,14 @@ public interface SysDeptService extends IService<SysDept> {
|
|||
*
|
||||
* @return 树
|
||||
*/
|
||||
List<DeptTree> selectTree();
|
||||
List<DeptTree> listDeptTrees();
|
||||
|
||||
/**
|
||||
* 查询用户部门树
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DeptTree> getUserTree();
|
||||
List<DeptTree> listCurrentUserDeptTrees();
|
||||
|
||||
/**
|
||||
* 添加信息部门
|
||||
|
|
|
@ -18,9 +18,6 @@ package com.pig4cloud.pig.admin.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pig.admin.api.vo.PreLogVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -32,12 +29,4 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysLogService extends IService<SysLog> {
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入前端错误日志
|
||||
*
|
||||
* @param preLogVoList 日志信息
|
||||
* @return true/false
|
||||
*/
|
||||
Boolean saveBatchLogs(List<PreLogVo> preLogVoList);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||
* @param roleId 角色ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
List<MenuVO> findMenuByRoleId(Integer roleId);
|
||||
List<MenuVO> getMenuByRoleId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 级联删除菜单
|
||||
|
|
|
@ -37,7 +37,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SysRole> findRolesByUserId(Integer userId);
|
||||
List<SysRole> listRolesByUserId(Integer userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID,删除角色
|
||||
|
|
|
@ -38,5 +38,5 @@ public interface SysUserRoleService extends IService<SysUserRole> {
|
|||
* @author 寻欢·李
|
||||
* @date 2017年12月7日 16:31:38
|
||||
*/
|
||||
Boolean deleteByUserId(Integer userId);
|
||||
Boolean removeRoleByUserId(Integer userId);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param sysUser 用户
|
||||
* @return userInfo
|
||||
*/
|
||||
UserInfo findUserInfo(SysUser sysUser);
|
||||
UserInfo getUserInfo(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 分页查询用户信息(含有角色信息)
|
||||
|
@ -47,7 +47,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param userDTO 参数列表
|
||||
* @return
|
||||
*/
|
||||
IPage getUsersWithRolePage(Page page, UserDTO userDTO);
|
||||
IPage getUserWithRolePage(Page page, UserDTO userDTO);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
|
@ -55,7 +55,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param sysUser 用户
|
||||
* @return boolean
|
||||
*/
|
||||
Boolean deleteUserById(SysUser sysUser);
|
||||
Boolean removeUserById(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 更新当前用户基本信息
|
||||
|
@ -79,7 +79,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param id 用户ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
UserVO selectUserVoById(Integer id);
|
||||
UserVO getUserVoById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询上级部门的用户信息
|
||||
|
@ -87,7 +87,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
List<SysUser> listAncestorUsers(String username);
|
||||
List<SysUser> listAncestorUsersByUsername(String username);
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMappe
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertDeptRelation(SysDept sysDept) {
|
||||
public void saveDeptRelation(SysDept sysDept) {
|
||||
//增加部门关系表
|
||||
SysDeptRelation condition = new SysDeptRelation();
|
||||
condition.setDescendant(sysDept.getParentId());
|
||||
|
@ -78,7 +78,7 @@ public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMappe
|
|||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void deleteAllDeptRealtion(Integer id) {
|
||||
public void removeDeptRelationById(Integer id) {
|
||||
baseMapper.deleteDeptRelationsById(id);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMappe
|
|||
* @param relation
|
||||
*/
|
||||
@Override
|
||||
public void updateDeptRealtion(SysDeptRelation relation) {
|
||||
public void updateDeptRelation(SysDeptRelation relation) {
|
||||
baseMapper.updateDeptRelations(relation);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
SysDept sysDept = new SysDept();
|
||||
BeanUtils.copyProperties(dept, sysDept);
|
||||
this.save(sysDept);
|
||||
sysDeptRelationService.insertDeptRelation(sysDept);
|
||||
sysDeptRelationService.saveDeptRelation(sysDept);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
}
|
||||
|
||||
//删除部门级联关系
|
||||
sysDeptRelationService.deleteAllDeptRealtion(id);
|
||||
sysDeptRelationService.removeDeptRelationById(id);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
SysDeptRelation relation = new SysDeptRelation();
|
||||
relation.setAncestor(sysDept.getParentId());
|
||||
relation.setDescendant(sysDept.getDeptId());
|
||||
sysDeptRelationService.updateDeptRealtion(relation);
|
||||
sysDeptRelationService.updateDeptRelation(relation);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
* @return 树
|
||||
*/
|
||||
@Override
|
||||
public List<DeptTree> selectTree() {
|
||||
public List<DeptTree> listDeptTrees() {
|
||||
return getDeptTree(this.list(Wrappers.emptyWrapper()));
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeptTree> getUserTree() {
|
||||
public List<DeptTree> listCurrentUserDeptTrees() {
|
||||
Integer deptId = SecurityUtils.getUser().getDeptId();
|
||||
List<Integer> descendantIdList = sysDeptRelationService
|
||||
.list(Wrappers.<SysDeptRelation>query().lambda()
|
||||
|
|
|
@ -18,16 +18,10 @@ package com.pig4cloud.pig.admin.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pig.admin.api.vo.PreLogVo;
|
||||
import com.pig4cloud.pig.admin.mapper.SysLogMapper;
|
||||
import com.pig4cloud.pig.admin.service.SysLogService;
|
||||
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 日志表 服务实现类
|
||||
|
@ -39,27 +33,4 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
|
||||
|
||||
/**
|
||||
* 批量插入前端错误日志
|
||||
*
|
||||
* @param preLogVoList 日志信息
|
||||
* @return true/false
|
||||
*/
|
||||
@Override
|
||||
public Boolean saveBatchLogs(List<PreLogVo> preLogVoList) {
|
||||
List<SysLog> sysLogs = preLogVoList.stream()
|
||||
.map(pre -> {
|
||||
SysLog log = new SysLog();
|
||||
log.setType(CommonConstants.STATUS_LOCK);
|
||||
log.setTitle(pre.getInfo());
|
||||
log.setException(pre.getStack());
|
||||
log.setParams(pre.getMessage());
|
||||
log.setCreateTime(LocalDateTime.now());
|
||||
log.setRequestUri(pre.getUrl());
|
||||
log.setCreateBy(pre.getUser());
|
||||
return log;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return this.saveBatch(sysLogs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
|
||||
@Override
|
||||
@Cacheable(value = "menu_details", key = "#roleId + '_menu'")
|
||||
public List<MenuVO> findMenuByRoleId(Integer roleId) {
|
||||
public List<MenuVO> getMenuByRoleId(Integer roleId) {
|
||||
return baseMapper.listMenusByRoleId(roleId);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List findRolesByUserId(Integer userId) {
|
||||
public List listRolesByUserId(Integer userId) {
|
||||
return baseMapper.listRolesByUserId(userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
|
|||
* @date 2017年12月7日 16:31:38
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteByUserId(Integer userId) {
|
||||
public Boolean removeRoleByUserId(Integer userId) {
|
||||
return baseMapper.deleteByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,11 +94,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UserInfo findUserInfo(SysUser sysUser) {
|
||||
public UserInfo getUserInfo(SysUser sysUser) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setSysUser(sysUser);
|
||||
//设置角色列表 (ID)
|
||||
List<Integer> roleIds = sysRoleService.findRolesByUserId(sysUser.getUserId())
|
||||
List<Integer> roleIds = sysRoleService.listRolesByUserId(sysUser.getUserId())
|
||||
.stream()
|
||||
.map(SysRole::getRoleId)
|
||||
.collect(Collectors.toList());
|
||||
|
@ -107,7 +107,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
//设置权限列表(menu.permission)
|
||||
Set<String> permissions = new HashSet<>();
|
||||
roleIds.forEach(roleId -> {
|
||||
List<String> permissionList = sysMenuService.findMenuByRoleId(roleId)
|
||||
List<String> permissionList = sysMenuService.getMenuByRoleId(roleId)
|
||||
.stream()
|
||||
.filter(menuVo -> StringUtils.isNotEmpty(menuVo.getPermission()))
|
||||
.map(MenuVO::getPermission)
|
||||
|
@ -126,7 +126,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage getUsersWithRolePage(Page page, UserDTO userDTO) {
|
||||
public IPage getUserWithRolePage(Page page, UserDTO userDTO) {
|
||||
return baseMapper.getUserVosPage(page, userDTO);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return 用户信息
|
||||
*/
|
||||
@Override
|
||||
public UserVO selectUserVoById(Integer id) {
|
||||
public UserVO getUserVoById(Integer id) {
|
||||
return baseMapper.getUserVoById(id);
|
||||
}
|
||||
|
||||
|
@ -149,8 +149,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "user_details", key = "#sysUser.username")
|
||||
public Boolean deleteUserById(SysUser sysUser) {
|
||||
sysUserRoleService.deleteByUserId(sysUser.getUserId());
|
||||
public Boolean removeUserById(SysUser sysUser) {
|
||||
sysUserRoleService.removeRoleByUserId(sysUser.getUserId());
|
||||
this.removeById(sysUser.getUserId());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @return R
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> listAncestorUsers(String username) {
|
||||
public List<SysUser> listAncestorUsersByUsername(String username) {
|
||||
SysUser sysUser = this.getOne(Wrappers.<SysUser>query().lambda()
|
||||
.eq(SysUser::getUsername, username));
|
||||
|
||||
|
|
Loading…
Reference in New Issue