系统主要实现的功能分前台用户和后台管理:
前台功能主要有:账号登录、添加关注模块,新闻快讯、通知公告、校历、求职招聘、学科资源信息展现等。
后台管理功能有:后台管理员角色管理、权限管理、社团管理、老师管理、用户管理、公告管理、新闻管理、校园风采管理、求职招聘管理、校历管理、学科资源管理等,老师。系统功能非常丰富完善。
运行环境:jdk1.8、eclipse/idea、Mysql5.7、Navicat/Sqlyog、Maven3.5/3.6
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
/**
* springMvc多文件上传
* @param files
* @param id
* @return
*/
@RequestMapping(value = "/saveFiles")
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();
* @param file
* @param request
* @param model
* @return
*/
@RequestMapping(value = "/saveFile")
public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {
System.out.println("开始");
String path = request.getSession().getServletContext().getRealPath("/upload");
String fileName = file.getOriginalFilename();
System.out.println(path);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.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("上传出错");
}
}
}
// private Role role;//角色
Role role = roleService.load(id);
Map<String, Object> map = MapUtils.getMap();
map.put("roleId", id);
List<RoleAction> list = roleActionService.list(map);
//查询所有权限
Map<String, Object> map2 = MapUtils.getMap();
List<Action> listAll = actionService.list(map2);
//判断当前选中的
List<Integer> ids = new ArrayList<Integer>();
List<Integer> acids = new ArrayList<Integer>();
List<Action> listAll2 = new ArrayList<Action>();
if(!isEmpty(list)){
for(RoleAction ac : list){
ids.add(ac.getActionId());
}
}
@ResponseBody
public String exUpdateJson(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
userService.update(user);
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
if(type == 2){
return "user/add2";
}
if(type == 3){
return "user/add3";
}
return "user/add";
}
/**
* 添加执行
* @return
*/
@RequestMapping(value = "/exAdd.do")
public String exAdd(User user, Model model, HttpServletRequest request, HttpServletResponse response) {
user.setIsDelete(0);
userService.insert(user);
return "redirect:/user/findByMap.do?type="+user.getType();
}
@RequestMapping(value = "/jsFp.do")
public String jsFp(Integer id,Model model,Integer type) {
if(user.getType() == 2){
return "user/user2";
}
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";
}
return "login/mIndex";
}else{
return "login/login";
}
}else if(type == 2){
User user = new User();
user.setUserName(userName);
user.setPassWord(passWord);
user.setType(type);
User use = userService.loadBySqlId("login",user);
if(!isEmpty(use)){
roleAct(model, use);
request.getSession().setAttribute("user", use);
request.getSession().setAttribute("userId", use.getId());
return "login/mIndex";
}else{
return "login/login";
* 单文件上传
* @param file
* @param request
* @param model
* @return
*/
@RequestMapping(value = "/saveFile")
public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {
System.out.println("开始");
String path = request.getSession().getServletContext().getRealPath("/upload");
String fileName = file.getOriginalFilename();
System.out.println(path);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
return "";
rl.setRoleId(id);
rl.setActionId(q);
roleActionService.insert(rl);
}
}
return "redirect:/role/findByObj.do";
}
/**
* 添加修改
* @return
*/
@RequestMapping(value = "/exUpdate.do")
public String exUpdate(Role role, Model model, HttpServletRequest request, HttpServletResponse response) {
roleService.update(role);
return "redirect:/role/findByObj.do";
Role role = roleService.load(id);
model.addAttribute("obj",role);
return "role/update";
}
/**
* 跳至修改页面
* @return
*/
@RequestMapping(value = "/updateRole.do")
public String updateRole(Integer id,Model model) {
//根据roleId去 角色权限表查看这个角色共有多少权限
// private Integer actionId;//权限id
// private Integer roleId;//角色id
// private Action action;//权限
// private Role role;//角色
Role role = roleService.load(id);
Map<String, Object> map = MapUtils.getMap();
map.put("roleId", id);
List<RoleAction> list = roleActionService.list(map);
//查询所有权限
Map<String, Object> map2 = MapUtils.getMap();