作者主页:编程指南针
?简介:Java领域优质创作者、CSDN博客专家? Java项目、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-PT-019
后台开发技术:SSM框架
前端开发技术:Bootstrap+Jquery+Ajax
开发工具:IDEA / ECLIPSE
基于MAVEN开发
数据库:MYSQL5.7
JDK:1.8
本项目基于SSM实现的校友录平台,功能完整:主要包含校友通讯录模块,论坛模块,新闻模块,招聘模块,校内各组织管理模块,班级管理模块等,功能还是比较完整的,运行无误。数据库采用MYSQL,开发工具为IDEA或Eclipse.
下面展示一下系统的部分功能;
访问http://localhost:8080/ar-portal/index.action
输入密码: black? /? 12345678
?登陆:
首页
新闻中心
班级通讯录
校友组织:
校友论坛
职业招聘
校园服务
个人后台管理中心
我的班级
我的论坛
我的招聘
系统管理员进入:
http://localhost:8080/ar-portal/index.action
sa? /? 12345678
后台管理主界面
信息中心
组织管理
招聘管理
用户管理
权限管理
数据字典管理
本系统功能完整,全面,运行无误,结构清晰,使用SSM框架开发,适合做毕业设计使用。
部分核心实现代码:
package com.xzit.ar.manage.controller.user;
import com.xzit.ar.common.base.BaseController;
import com.xzit.ar.common.exception.UtilException;
import com.xzit.ar.common.page.Page;
import com.xzit.ar.common.po.user.User;
import com.xzit.ar.common.util.CommonUtil;
import com.xzit.ar.manage.service.user.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* TODO ${TODO}
*
* @author znz
* @Date:2021/5/19 17:16.
*/
@Controller
@RequestMapping("/user")
public class UserController extends BaseController {
@Resource
private UserService userService;
/**
* TODO 加载用户管理界面
* @return
*/
@RequestMapping("")
public String index() {
return "user/user-index";
}
/**
* TODO 查询用户列表
* @param model
* @param query
* @param state
* @return
*/
@RequestMapping("/queryUser")
public String queryUser(Model model, String query, String state, String isAdmin) {
// 分页类
Page<Map<String, Object>> page = new Page<>(getPageIndex(), getPageSize());
Map<String, Object> user = new HashMap<>();
// 参数校验
if (CommonUtil.isNotEmpty(query)) {
user.put("query", "%" + query + "%");
}
if (CommonUtil.isNotEmpty(state)) {
user.put("state", state);
}
if (CommonUtil.isNotEmpty(isAdmin)) {
user.put("isAdmin", isAdmin);
}
page.setQueryMap(user);
// 查询用户
userService.queryUser(page);
// 数据返回
model.addAttribute("page", page);
model.addAttribute("query", query);
model.addAttribute("state", state);
model.addAttribute("isAdmin", isAdmin);
return "user/user-query";
}
@RequestMapping("/add")
public String userAddPage(Model model) {
model.addAttribute("sex", false);
return "user/user-add";
}
@RequestMapping(value = "/add/submit", method = RequestMethod.POST)
public String userAddSubmit(Model model,
@RequestParam("account") String account,
@RequestParam("trueName") String trueName,
@RequestParam("isAdmin") String isAdmin,
@RequestParam("email") String email,
@RequestParam("introduce") String introduce) throws UtilException {
if (CommonUtil.isNotEmpty(account)) {
Map<String, Object> _user = userService.getUserByAccount(account);
if (_user != null) {
setMessage(account + " 已存在");
System.out.println(account + " 已存在");
return "redirect:/user.action";
} else {
User user = new User();
user.setAccount(account);
user.setTrueName(trueName);
user.setEmail(email);
user.setIsAdmin(isAdmin);
user.setIntroduce(introduce);
user.setState("A");
user.setPassword(CommonUtil.md5("12345678"));
user.setImageId(1);
user.setStateTime(new Date());
user.setCreateTime(new Date());
userService.addUser(user);
}
}
return "redirect:/user.action";
}
}
/**
* TODO ${TODO}
*
* @author znz
* @Date:2021/5/19 17:16.
*/
package com.xzit.ar.manage.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.xzit.ar.common.base.BaseController;
import com.xzit.ar.common.constant.WebConstant;
/**
* TODO ${TODO}
*
* @author znz
* @Date:2021/5/19 17:16.
*/
@Controller
@RequestMapping("")
public class ManageController extends BaseController {
/**
* @Description: TODO 空请求跳转<br>
* @author znz <br>
* @date 2021年12月23日 下午12:36:56 <br>
*/
@RequestMapping(value = "/manage", method = RequestMethod.GET)
public String index(ModelMap map) throws Exception {
return "main/index";
}
/**
* @Description: TODO 加载 欢迎界面 <br>
* @author znz <br>
* @date 2016年1月3日 下午4:23:41 <br>
*/
@RequestMapping("/manage/welcome")
public String welcomeManage(Model model) {
return "main/welcome";
}
/**
* @Description: TODO 错误请求跳转<br>
* @author znz <br>
* @date 2021年12月23日 上午11:46:19 <br>
*/
@RequestMapping(method = RequestMethod.GET, value = "/error/{errCode}")
public String error(@PathVariable("errCode") String errCode) {
return "404".equals(errCode) ? WebConstant.PAGE_ERROR_404 : WebConstant.PAGE_ERROR_500;
}
}
/**
* @Title: ControllerReflect.java <br>
* @Package com.xzit.ar.manage.controller <br>
* @Description: TODO <br>
* @author znz <br>
* @date 2021年1月3日 上午10:25:46 <br>
* @version V1.0 <br>
*/
package com.xzit.ar.manage.controller.right;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.xzit.ar.common.base.BaseController;
import com.xzit.ar.common.exception.ServiceException;
import com.xzit.ar.common.page.Page;
import com.xzit.ar.common.po.role.Right;
import com.xzit.ar.common.util.privilege.PrivilegeUtil;
import com.xzit.ar.manage.service.right.RightService;
/**
* @ClassName: ControllerReflect <br>
* @Description: TODO <br>
* @author znz <br>
* @date 2021年1月3日 上午10:25:46 <br>
* @version V1.0 <br>
*/
@Controller
@RequestMapping("/right")
public class RightController extends BaseController {
@Resource
private RightService rightService;
/**
* @Description: TODO 加载权限管理索引界面<br>
* @author znz <br>
* @date 2021年1月4日 上午11:39:33 <br>
*/
@RequestMapping("/indexRight")
public String indexRight() {
return "authority/right/right-index";
}
@RequestMapping("/queryRights")
public String queryRights(Model model, String queryInput) throws ServiceException {
Page<Right> page = new Page<Right>();
page.setPageIndex(getPageIndex());
page.setPageSize(getPageSize());
rightService.queryRights(page, queryInput);
model.addAttribute("page", page);
model.addAttribute("queryInput", queryInput);
return "authority/right/right-query";
}
/**
* @Title: addRight
* @Description: TODO addRight
*/
@RequestMapping("/addRight")
public String addRight() {
return null;
}
@RequestMapping("/updateRight")
public String updateRight(Model model, @RequestParam("rightId") Integer rightId) throws ServiceException {
Right right = rightService.selectById(rightId);
model.addAttribute("right", right);
setMessage(model, "只能改变权限名、是否公开");
return "authority/right/right-update";
}
@RequestMapping("/updateRightSubmit")
public String updateRightSubmit(Model model, Right right) throws ServiceException {
int row = 0;
if (right != null) {
// 更新操作
row = rightService.updateRight(right);
}
// 结果判断
if (row < 1) {
setMessage(model, "修改失败!");
} else {
setMessage(model, "修改成功!");
}
return "forward:queryRights.action";
}
/**
* @Title: scanAddRights
* @Description: TODO 扫描并添加未被添加的权限
*/
@RequestMapping("/scanAddRights")
public String scanAddRights(Model model) throws ServiceException {
int newRights = 0;
// 索引当前所有权限url
List<String> rightUrlList = PrivilegeUtil.detectAllRightURL();
for (String rightUrl : rightUrlList) {
// 判断是否存在
if (rightService.selectByRightUrl(rightUrl) == null) {
// 生成默认格式right
Right right = PrivilegeUtil.makeDefaultRight(rightUrl);
// 持久化right
if (rightService.saveRight(right) > 0) {
newRights++;
}
}
}
if (newRights > 0) {
setMessage(model, "新增权限" + newRights + "条权限");
} else {
setMessage(model, "没有新增权限");
}
return "forward:queryRights.action";
}
}
/**
* @Title: RoleController.java
* @Package com.xzit.uscdl.manage.controller.right
* @Description: TODO
* @author znz
* @date 2021年3月15日 下午7:05:25
* @version V1.0
*/
package com.xzit.ar.manage.controller.right;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import com.xzit.ar.common.base.BaseController;
import com.xzit.ar.common.exception.ServiceException;
import com.xzit.ar.common.page.Page;
import com.xzit.ar.common.po.role.Right;
import com.xzit.ar.common.po.role.Role;
import com.xzit.ar.common.util.CommonUtil;
import com.xzit.ar.manage.service.right.RightService;
import com.xzit.ar.manage.service.right.RoleService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @author znz
* @ClassName: RoleController
* @Description: TODO
* @date 2021年3月15日 下午7:05:25
*/
@Controller
@RequestMapping("/role")
public class RoleController extends BaseController {
@Resource
private RoleService roleService;
@Resource
private RightService rightService;
@RequestMapping("")
public String index() {
return "authority/role/role-index";
}
@RequestMapping("/queryRole")
public String queryRole(Model model) throws ServiceException {
Page<Role> page = new Page<>(getPageIndex(), getPageSize());
// 传递数据
model.addAttribute("page", roleService.queryRole(page));
return "authority/role/role-query";
}
@RequestMapping("/edit")
public String edit(Model model) {
return "";
}
@RequestMapping("/editSubmit")
public String editSubmit() {
return "";
}
@RequestMapping("/add")
public String add() {
return "";
}
@RequestMapping("/addSubmit")
public String addSubmit() {
return "";
}
@RequestMapping("/allot")
public String allot(Model model, Integer roleId) throws ServiceException {
// 传递数据
model.addAttribute("role", roleService.getRoleById(roleId));
// 所有权限
model.addAttribute("rightList", rightService.getIsNotPublicRights());
// 角色已分配的权限
List<Right> roleRights = roleService.getRightsByRole(roleId);
List<Integer> rightIds = new ArrayList<>();
for (Right right : roleRights) {
rightIds.add(right.getRightId());
}
model.addAttribute("roleRights", roleRights);
model.addAttribute("rightIds", rightIds);
return "authority/role/role-allot";
}
@RequestMapping("/allotSubmit")
public String allotSubmit(Model model, String rightIds, Integer roleId) throws ServiceException {
List<Integer> idList = CommonUtil.splitIds(rightIds);
if (roleService.updateRoleRights(roleId, idList) > 0) {
setMessage(model, "更新成功");
} else {
setMessage(model, "更新失败");
}
return "forward:queryRole.action";
}
}
|