mirror of https://github.com/elunez/eladmin
commit
e67300e919
|
@ -127,6 +127,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"all"})
|
||||||
public CacheErrorHandler errorHandler() {
|
public CacheErrorHandler errorHandler() {
|
||||||
// 异常处理,当Redis发生异常时,打印日志,但是程序正常走
|
// 异常处理,当Redis发生异常时,打印日志,但是程序正常走
|
||||||
log.info("初始化 -> [{}]", "Redis CacheErrorHandler");
|
log.info("初始化 -> [{}]", "Redis CacheErrorHandler");
|
||||||
|
@ -152,7 +153,6 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +161,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
* @author /
|
* @author /
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
|
||||||
|
|
||||||
private final Class<T> clazz;
|
private final Class<T> clazz;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T deserialize(byte[] bytes) {
|
public T deserialize(byte[] bytes) {
|
||||||
if (bytes == null || bytes.length <= 0) {
|
if (bytes == null || bytes.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String str = new String(bytes, StandardCharsets.UTF_8);
|
String str = new String(bytes, StandardCharsets.UTF_8);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Zheng Jie
|
* @author Zheng Jie
|
||||||
|
@ -71,8 +72,15 @@ public class DeptController {
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
DeptDto deptDto = deptService.findById(id);
|
DeptDto deptDto = deptService.findById(id);
|
||||||
List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
|
List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
|
||||||
|
for (DeptDto dept : depts) {
|
||||||
|
if(dept.getId().equals(deptDto.getPid())) {
|
||||||
|
dept.setSubCount(dept.getSubCount() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
deptSet.addAll(depts);
|
deptSet.addAll(depts);
|
||||||
}
|
}
|
||||||
|
// 编辑部门时不显示自己以及自己下级的数据,避免出现PID数据环形问题
|
||||||
|
deptSet = deptSet.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
|
||||||
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK);
|
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import me.zhengjie.modules.system.domain.Menu;
|
||||||
import me.zhengjie.exception.BadRequestException;
|
import me.zhengjie.exception.BadRequestException;
|
||||||
import me.zhengjie.modules.system.domain.vo.MenuVo;
|
import me.zhengjie.modules.system.domain.vo.MenuVo;
|
||||||
import me.zhengjie.modules.system.service.MenuService;
|
import me.zhengjie.modules.system.service.MenuService;
|
||||||
|
import me.zhengjie.modules.system.service.dto.DeptDto;
|
||||||
import me.zhengjie.modules.system.service.dto.MenuDto;
|
import me.zhengjie.modules.system.service.dto.MenuDto;
|
||||||
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
|
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
|
||||||
import me.zhengjie.modules.system.service.mapstruct.MenuMapper;
|
import me.zhengjie.modules.system.service.mapstruct.MenuMapper;
|
||||||
|
@ -43,7 +44,6 @@ import java.util.stream.Collectors;
|
||||||
* @author Zheng Jie
|
* @author Zheng Jie
|
||||||
* @date 2018-12-03
|
* @date 2018-12-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "系统:菜单管理")
|
@Api(tags = "系统:菜单管理")
|
||||||
|
@ -104,8 +104,16 @@ public class MenuController {
|
||||||
if(CollectionUtil.isNotEmpty(ids)){
|
if(CollectionUtil.isNotEmpty(ids)){
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
MenuDto menuDto = menuService.findById(id);
|
MenuDto menuDto = menuService.findById(id);
|
||||||
menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>()));
|
List<MenuDto> menuDtoList = menuService.getSuperior(menuDto, new ArrayList<>());
|
||||||
|
for (MenuDto menu : menuDtoList) {
|
||||||
|
if(menu.getId().equals(menuDto.getPid())) {
|
||||||
|
menu.setSubCount(menu.getSubCount() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
menuDtos.addAll(menuDtoList);
|
||||||
}
|
}
|
||||||
|
// 编辑菜单时不显示自己以及自己下级的数据,避免出现PID数据环形问题
|
||||||
|
menuDtos = menuDtos.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
|
||||||
return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK);
|
return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK);
|
return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK);
|
||||||
|
|
Loading…
Reference in New Issue