前台:
人员登记、车辆登记、学生动态、校园卡、论坛信息、新闻资讯、留言反馈、个人中心、跳转后台
后台:
个人中心、学生管理、教师管理、人员登记管理、车辆登记管理、监控系统管理、校园卡办理管理、留言板管理、家校互动、系统管理
开发语言:Java
数据库 :MySQL
系统架构:B/S
后端框架:SSM
前端框架:Vue
开发工具:IDEA或者Eclipse,JDK1.8,Maven
package com.controller;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.MessageEntity;
import com.service.MessageService;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
@RestController
@RequestMapping("/message")
public class MessageController {
@Autowired
private MessageService messageService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, MessageEntity message,
HttpServletRequest request){
EntityWrapper<MessageEntity> ew = new EntityWrapper<MessageEntity>();
if(request.getSession().getAttribute("role").toString().equals("用户")) {
ew.eq("yonghuid",(Long)request.getSession().getAttribute("userId"));
}
PageUtils page = messageService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, message), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, MessageEntity message, HttpServletRequest request){
EntityWrapper<MessageEntity> ew = new EntityWrapper<MessageEntity>();
PageUtils page = messageService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, message), params), params));
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
MessageEntity message = messageService.selectById(id);
return R.ok().put("data", message);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
MessageEntity message = messageService.selectById(id);
return R.ok().put("data", message);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody MessageEntity message, HttpServletRequest request){
if(request.getSession().getAttribute("role").toString().equals("用户")) {
message.setYonghuid((Long)request.getSession().getAttribute("userId"));
message.setYonghuming((String) request.getSession().getAttribute("username"));
}
message.setAdddate(new Date());
messageService.insert(message);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody MessageEntity message, HttpServletRequest request){
if(request.getSession().getAttribute("role").toString().equals("用户")) {
message.setYonghuid((Long)request.getSession().getAttribute("userId"));
message.setYonghuming((String) request.getSession().getAttribute("username"));
}
message.setAdddate(new Date());
messageService.insert(message);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody MessageEntity message, HttpServletRequest request){
messageService.updateById(message);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
messageService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}