基于javaweb+jsp的校园社团门户管理系统

基于javaweb+jsp的校园社团门户管理系统,第1张

基于javaweb+jsp的校园社团门户管理系统(java+SSM+JSP+mysql)
系统主要实现的功能分前台用户和后台管理:
前台功能主要有:账号登录、添加关注模块,新闻快讯、通知公告、校历、求职招聘、学科资源信息展现等。
后台管理功能有:后台管理员角色管理、权限管理、社团管理、老师管理、用户管理、公告管理、新闻管理、校园风采管理、求职招聘管理、校历管理、学科资源管理等,老师。系统功能非常丰富完善。
运行环境:jdk1.8、eclipse/idea、Mysql5.7、Navicat/Sqlyog、Maven3.5/3.6





适用

课程设计,大作业,毕业设计,项目练习,学习演示等

		if(user.getType() == 3){
			return "user/user3";
		}
		return "user/user";
	}
	
	
	/**
	 * 跳至添加页面
	 * @return
	 */
	@RequestMapping(value = "/add.do")
	public String add(Integer type) {
		if(type == 1){
			return "user/add1";
		}
		if(type == 2){
			return "user/add2";
		}
		if(type == 3){
			return "user/add3";
		}
		return "user/add";
	}
	
        	params.put("isDelete", role.getIsDelete());
		}
		//分页查询
		Pager<Role> pagers = roleService.findByMap(params);
		JSONObject jsonObject = JsonUtil2.getJsonObject();
		jsonObject.put("pagers", pagers);
		jsonObject.put("obj", role);
		return jsonObject.toString();
	}
	
	
	/**
	 * ajax 添加
	 * @param 
	 * @return
	 */
	@RequestMapping(value = "/exAdd.json", method = RequestMethod.POST)
	@ResponseBody
	public String exAddJson(Role role, Model model, HttpServletRequest request, HttpServletResponse response) {
				
				request.getSession().setAttribute("user", use);
				request.getSession().setAttribute("userId", use.getId());
			}
		}
		return "login/index";
	}
	private void roleAct(Model model, User user) {
		if(!isEmpty(user.getRole())){
			List<Action> actions = new ArrayList<Action>();
			List<RoleAction> roleActions = user.getRole().getRoleActions();
			if(!isEmpty(roleActions)){
				for (RoleAction ra: roleActions) {
					actions.add(actionService.load(ra.getActionId()));
				}
			}
				}else{
					ac.setIsCheck(0);
				}
				listAll2.add(ac);
			}
		}
		model.addAttribute("list",list);
		model.addAttribute("id",id);
		model.addAttribute("listAll",listAll2);
		return "role/updateRole";
	}
	
	
	@RequestMapping(value = "/exUpdateRole.do")
	public String exUpdateRole(Integer[] qx,Model model,Integer id) {
		Map<String, Object> map = MapUtils.getMap();
		map.put("roleId", id);
		roleActionService.deleteBySqId("deleteBySqId", map);
		if(!isEmpty(qx)){
			for(Integer q : qx){
				RoleAction rl = new RoleAction();
				rl.setRoleId(id);
				rl.setActionId(q);
		List<Notice> notices = noticeService.listAll();
		//9个招聘
		List<SchoolJob> sjs = schoolJobService.listAll();
		//5个校历
		List<Xl> xls = xlService.listAll();
		model.addAttribute("phs", phs);
		model.addAttribute("news", news);
		model.addAttribute("notices", notices);
		model.addAttribute("sjs", sjs);
		model.addAttribute("xls", xls);
		WebCount load = webCountService.load(1);
		load.setCountAll(load.getCountAll()+1);
		webCountService.update(load);
		model.addAttribute("count", load.getCountAll()+1);
		return "login/index";
		return jsonObject.toString();
	}
	
	
	/**
	 * ajax 添加
	 * @param 
	 * @return
	 */
	@RequestMapping(value = "/exAdd.json", method = RequestMethod.POST)
	@ResponseBody
	public String exAddJson(Role role, Model model, HttpServletRequest request, HttpServletResponse response) {
		roleService.insert(role);
        	params.put("zy", user.getZy());
		}
        if(!isEmpty(user.getNj())){
        	params.put("nj", user.getNj());
		}
        if(!isEmpty(user.getIsDelete())){
        	params.put("isDelete", user.getIsDelete());
		}
        if(!isEmpty(user.getType())){
        	params.put("type", user.getType());
		}
		//分页查询
		Pager<User> pagers = userService.findByMap(params);
		JSONObject jsonObject = JsonUtil2.getJsonObject();
		jsonObject.put("pagers", pagers);
		jsonObject.put("obj", user);
		return jsonObject.toString();
	}
	}
 // --------------------------------------- 华丽分割线 ------------------------------
	
	
}
用户管理控制层:
@Controller
@RequestMapping("/user")
public class UserController extends BaseController {
	
	/**
	 * 依赖注入 start dao/service/===
	 */
	@Autowired
	private UserService userService;
	@Autowired
	private RoleService roleService;
	// --------------------------------------- 华丽分割线 ------------------------------
	
    public String saveFiles(@RequestParam("file") CommonsMultipartFile[] files,Integer id,HttpServletRequest request){
		for(int i = 0;i<files.length;i++){
	      	System.out.println("fileName---------->" + files[i].getOriginalFilename());
		  if(!files[i].isEmpty()){
            int pre = (int) System.currentTimeMillis();
	     	try {
			//拿到输出流,同时重命名上传的文件
			 String filePath = request.getRealPath("/upload");
			 File f=new File(filePath);
			 if(!f.exists()){
				f.mkdirs();
			 }
		     String fileNmae=new Date().getTime() + files[i].getOriginalFilename();
		     File file=new File(filePath+"/"+pre + files[i].getOriginalFilename());
			  if(!file.exists()){
				  file.createNewFile();
			 }
			  files[i].transferTo(file);
		     } catch (Exception e) {
				e.printStackTrace();
				System.out.println("上传出错");
	 */
	@RequestMapping(value = "/exUpdate.json",method = RequestMethod.POST)
	@ResponseBody
	public String exUpdateJson(Role role, Model model, HttpServletRequest request, HttpServletResponse response) {
		roleService.update(role);
		JSONObject jsonObject = JsonUtil2.getJsonObject();
		jsonObject.put("message", "修改成功");
		return jsonObject.toString();
	}
	/**
	 * ajax 删除
	 * @return
	 */
	@RequestMapping(value = "/delete.json", produces = "text/html;charset=UTF-8", method = RequestMethod.GET)
	@ResponseBody
	public String exDeleteJson(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
		//真正删除
		roleService.deleteById(id);
		//通过参数删除
        //Map params = new HashMap();
		//分页查询
		Pager<Role> pagers = roleService.findByEntity(role);
		JSONObject jsonObject = JsonUtil2.getJsonObject();
		jsonObject.put("pagers", pagers);
		jsonObject.put("obj", role);
		return jsonObject.toString();
	}
	
	  
	/**
	 * 分页查询 返回list json(通过Map)
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/findByMap.json", method = RequestMethod.GET)
	@ResponseBody
	public String findByMapMap(Role role, Model model, HttpServletRequest request, HttpServletResponse response) {
		//通过map查询
		Map<String,Object> params = new HashMap<String,Object>();
        if(!isEmpty(role.getName())){
        	params.put("name", role.getName());
		}
        if(!isEmpty(role.getIsDelete())){

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/725670.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-26
下一篇 2022-04-26

发表评论

登录后才能评论

评论列表(0条)

保存