基于ssm开发,maven项目引用阿里云镜像资源库,《商洛学院社团管理系统的设计与实现》
1.获取动态菜单列表
package com.sl.cms.service.admin.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.sl.cms.dao.admin.HomeDao;
import com.sl.cms.dto.MenuDto;
import com.sl.cms.module.Module;
import com.sl.cms.service.admin.HomeService;
@Service
public class HomeServiceImpl implements HomeService {
@Resource
private HomeDao homeDao;//注入
@Override
public List
List
List
MenuDto currMenu = null;
for(Module module:modules) {
if(module.getM_pid()==null) {//是主菜单
currMenu = new MenuDto();
currMenu.setMenuId(module.getM_id());
currMenu.setMenuName(module.getM_name());
currMenu.setSubMenuList(new ArrayList
mainList.add(currMenu);
}else {//子菜单
MenuDto subMenu = new MenuDto();
subMenu.setMenuId(module.getM_id());
subMenu.setMenuName(module.getM_name());
subMenu.setMenuUrl(module.getM_url());
currMenu.getSubMenuList().add(subMenu);
}
}
return mainList;
}
@Override
public List
List
System.out.println(modules);
List
MenuDto mainMenu=null;
for(Module module:modules) {
if(mainMenu==null || !mainMenu.getMenuId().equals(module.getP_id())) {
mainMenu=new MenuDto();
mainMenu.setMenuId(module.getP_id());
mainMenu.setMenuName(module.getP_name());
mainMenu.setSubMenuList(new ArrayList
mainList.add(mainMenu);
}
MenuDto subMenu=new MenuDto();
subMenu.setMenuId(module.getM_id());
subMenu.setMenuName(module.getM_name());
subMenu.setMenuUrl(module.getM_url());
mainMenu.getSubMenuList().add(subMenu);
}
System.out.println("mainList:"+mainList);
return mainList;
}
@Override
public List
List
List
MenuDto currMenu = null;
for(Module module:modules) {
if(module.getM_pid()==null) {//是主菜单
currMenu = new MenuDto();
currMenu.setMenuId(module.getM_id());
currMenu.setMenuName(module.getM_name());
currMenu.setSubMenuList(new ArrayList
mainList.add(currMenu);
}else {//子菜单
MenuDto subMenu = new MenuDto();
subMenu.setMenuId(module.getM_id());
subMenu.setMenuName(module.getM_name());
subMenu.setMenuUrl(module.getM_url());
currMenu.getSubMenuList().add(subMenu);
}
}
return mainList;
}
@Override
public List
List
//Map
}
2.mvc-servlet.xml配置
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
3.spring-service.xml配置
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
4.spring-propertis.xml配置
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
6.数据库连接池配置
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
部分截图:
https://blog.csdn.net/zyt947016438/article/details/90486191
投递简历:
https://blog.csdn.net/zyt947016438/article/details/90486191
https://blog.csdn.net/zyt947016438/article/details/90486191
可进行交流补充..