|
@@ -4,28 +4,32 @@ import api.common.pojo.vo.system.MenuVO;
|
|
import api.common.util.ObjectUtil;
|
|
import api.common.util.ObjectUtil;
|
|
import com.css.simulation.resource.server.infra.util.AuthUtil;
|
|
import com.css.simulation.resource.server.infra.util.AuthUtil;
|
|
import com.css.simulation.resource.server.infra.db.mysql.mapper.MenuMapper;
|
|
import com.css.simulation.resource.server.infra.db.mysql.mapper.MenuMapper;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
|
+@Slf4j
|
|
public class MenuService {
|
|
public class MenuService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- MenuMapper menuMapper;
|
|
|
|
|
|
+ private MenuMapper menuMapper;
|
|
|
|
|
|
public List<MenuVO> getMenuTree() {
|
|
public List<MenuVO> getMenuTree() {
|
|
List<MenuVO> menus = menuMapper.getMenuTree();
|
|
List<MenuVO> menus = menuMapper.getMenuTree();
|
|
//List<MenuVO> treeList = ObjectUtil.listToTree(menus, "0", MenuVO::getId, MenuVO::getParentId, MenuVO::getChildren, MenuVO::setChildren);
|
|
//List<MenuVO> treeList = ObjectUtil.listToTree(menus, "0", MenuVO::getId, MenuVO::getParentId, MenuVO::getChildren, MenuVO::setChildren);
|
|
- List<MenuVO> menuVOS = ObjectUtil.listToTree(menus);//注解方式转tree
|
|
|
|
- return menuVOS;
|
|
|
|
|
|
+ return ObjectUtil.listToTree(menus);
|
|
}
|
|
}
|
|
|
|
|
|
public List<MenuVO> getMyMenuTree() {
|
|
public List<MenuVO> getMyMenuTree() {
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
|
+ log.info("当前用户角色为:" + roleCode);
|
|
List<MenuVO> menus = menuMapper.getMyMenuTree(roleCode);
|
|
List<MenuVO> menus = menuMapper.getMyMenuTree(roleCode);
|
|
- List<MenuVO> menuVOS = ObjectUtil.listToTree(menus);//注解方式转tree
|
|
|
|
|
|
+ log.info("当前用户菜单为:" + menus);
|
|
|
|
+ List<MenuVO> menuVOS = ObjectUtil.listToTree(menus);
|
|
|
|
+ log.info("当前用户菜单树为:" + menuVOS);
|
|
return menuVOS;
|
|
return menuVOS;
|
|
}
|
|
}
|
|
}
|
|
}
|