项目介绍

SpringBoot在线订餐系统项目。主要功能说明:

分为两个角色,餐厅老板和普通用户
餐厅老板可以登录,注册,可以在后台设置菜品目录,菜品详情,查看订单,用户管理,个人中心等
用户查看首页菜品信息,登录后可以点餐,形成购物车,支付后会出现订单详情

请用电脑浏览器打开

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 5.7版本;

技术栈

后端框架:SpringBoot + MybatisPlus
模板引擎:Thymeleaf
前端框架:BootStrap
JS技术 :JQuery + Ajax

设计亮点:用Spring-Security5代替传统的Session拦截页面

使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,下载所需jar包;
3. 将项目中applicaion.yml配置文件中的数据库配置改为自己的配置
4. 配置tomcat,然后运行项目,输入localhost:8080/xxx 登录

java 对接美团 预定 基于java的在线订餐系统_springboot

 

java 对接美团 预定 基于java的在线订餐系统_java_02

 

java 对接美团 预定 基于java的在线订餐系统_html_03

 

java 对接美团 预定 基于java的在线订餐系统_mysql_04

 

java 对接美团 预定 基于java的在线订餐系统_springboot_05

后台订单相关controller: 

/**
 * @author yy  后台订单相关controller
 */

@Controller
public class Back_OrderController {

    @Autowired
    private OrderService orderService;
    @Autowired
    private UserService userService;
    @Autowired
    private EvaService evaService;

    /**
     * 跳转到订单详情页面--并展示订单详情
     * @return
     */
    @RequestMapping("/admin/toOrderList")
    public String orderForm(@RequestParam(required = true, defaultValue = "1") Integer page, Model model) {
        PageHelper.startPage(page, 5);
        List<Order> orderAll = orderService.findOrderAll();
        model.addAttribute("order",orderAll);
        PageInfo<Order> pageInfo = new PageInfo<>(orderAll);
        model.addAttribute("page", pageInfo);
        return "/admin/order/order_list";
    }

    @RequestMapping("/admin/deleteOrder")
    public String deleteOrder(String orderId){
        orderService.deleteOrder(orderId);
        return "redirect:/admin/toOrderList";
    }
    /**
     * 修改后台订单状态
     * @param orderId
     * @param orderStatus
     * @return
     */
    @RequestMapping("/admin/updateAdminOrderStatus")
    public String updateAdminOrderStatus(String orderId,Integer orderStatus){
        orderService.updateOrderStatus(orderStatus,orderId);
        return "redirect:/admin/toOrderList";
    }

    /**
     * 跳转到回复评论界面
     * @param orderId
     * @param model
     * @return
     */
    @RequestMapping("/admin/toAnsEva")
    public String toAnsEva(String orderId,Model model){
        Evaluate evaluate = evaService.findEvaListByOrderId(orderId);
        model.addAttribute("evaluate",evaluate);
        return "/admin/adminAnsEva";
    }
    @RequestMapping("/admin/ansEva")
    public String ansEva(String orderId,String ansContent,Integer orderStatus){
        evaService.saveAnsEva(orderId,ansContent);
        orderService.updateOrderStatus(orderStatus,orderId);
        return "redirect:/admin/toOrderList";
    }
    //跳转到订单详情页面
    @RequestMapping("/admin/orderDetailed")
    public String orderDetailed(String orderId,Model model){

        Order order =  orderService.findListByOrderId(orderId);
        model.addAttribute("order",order);
        return "/admin/order/order_detailed";
    }


    /**
     * 根据订单状态查询订单
     */
    @RequestMapping("/admin/searchOrderList")
    public String searchOrderList(Integer status,Model model){
        List<Order> orderList = orderService.findOrderByStatus(status);
        model.addAttribute("orderList",orderList);
        return "/admin/toOrderList";
    }


    /*
     * 导出到excel
     * @return
     */
    @RequestMapping("/admin/downloadInfoToExcel")
    public ModelAndView downloadInfoToExcel() {
        System.out.println("导出到excel");
        ModelAndView mv = new ModelAndView();
        try {
            //1-根据id数组获取数据库数据
            List<Object> dataList = getExcelDataList();
            //2-获取列标题和封装数据
            Map<String, Object> dataMap = getTitleArrayAndVarList(dataList);
            //3-获取Excel表格文件名和表格标题
            Map<String, String> excelMap = getExcelTitleAndFileName();
            //4-创建AbstractExcelView
            AbstractExcelView erv = getAbstractExcelView(excelMap);
            //ObjectExcelViewOrderOperation erv = new ObjectExcelViewOrderOperation(excelMap.get("fileName"),excelMap.get("excelTitle"));
            mv = new ModelAndView(erv, dataMap);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mv;
    }

    /**
     *@描述 1-1-从数据库获取数据
     */
    protected  List<Object> getExcelDataList(){
        try {
            List<Object> dataList = orderService.find4ExcelDown();
            return dataList;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     *@描述 1-2-导出Excel-自定义列标题和数据
     */
    protected Map<String,Object> getTitleArrayAndVarList(List<Object> dataList) {
        Map<String,Object> dataMap = new HashMap<String,Object>();
        //1-标题
        String[] titleArray = {
                "订单序号",
                "订单编号",
                "订单金额",
                "收货人",
                "收获地址",
                "下单时间",
                "订单状态"
        };
        dataMap.put("titles", Arrays.asList(titleArray));
        //2-数据
        List<OrderExcelExportVO> varList = new ArrayList<OrderExcelExportVO>();
        for(int i=0;i<dataList.size();i++){
            OrderExcelExportVO data = (OrderExcelExportVO)dataList.get(i);
            List<Object> vpd = new ArrayList<>();
            varList.add(data);
        }
        dataMap.put("varList", varList);

        return dataMap;
    }
    /**
     *@描述 1-3-导出excel-自定义Excel标题和文件名
     */
    protected Map<String,String> getExcelTitleAndFileName(){
        Map<String,String> excelMap = new HashMap<String,String>();
        excelMap.put("excelTitle","订单信息表格");//excel标题
        DateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        String time = sdf.format(new Timestamp(System.currentTimeMillis()));
        excelMap.put("fileName","订单信息表格" + time);//文件名
        return excelMap;
    }
    /**
     *@描述 1-4-创建AbstractExcelView
     */
    protected AbstractExcelView getAbstractExcelView(Map<String, String> excelMap){
        try {
            ObjectExcelViewOrder erv = new ObjectExcelViewOrder(excelMap.get("fileName"),excelMap.get("excelTitle"));
            return erv;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

}

 

后端product模块相关的controller:

/**
 * @author yy 后端product模块相关的controller
 */
@Controller
public class Back_ProductController {

    @Autowired
    private ProductService productService;

    @Autowired
    private ProductKindService productKindService;

    /**
     * 按条件查找数据--模糊查询
     * @return
     */
    @RequestMapping("/admin/toSelect")
    public String toSelect(@RequestParam("Pname") String Pname, Model model) {
        List<Product> list = productService.findAllProductCondition(Pname);
        model.addAttribute("productList", list);
        return "/admin/product/product_list";
    }

    /**
     *
     * 后台展示商品列表
     */
    @RequestMapping("/admin/toProductList")
    public String toProductList(@RequestParam(required = true, defaultValue = "1") Integer page,
                                Model model,String errorInfo) {
        if(StringUtil.isNotEmpty(errorInfo)){
            model.addAttribute("errorInfo",errorInfo);
        }
        PageHelper.startPage(page, 10);
        //查询所有的商品信息
        List<Product> productList = productService.findAllProductList();
        model.addAttribute("productList", productList);
        PageInfo<Product> pageInfo = new PageInfo(productList);
        model.addAttribute("page", pageInfo);
        return "/admin/product/product_list";
    }

    /**
     * 去添加商品页面
     */
    @RequestMapping("/admin/toAddProductView")
    public String toAddProductView() {
        return "/admin/product/product_edit";
    }
    /**
     * 新增商品
     */
    @RequestMapping("/admin/addNewProduct")
    public String addNewProduct(MultipartFile imageUrl, HttpServletRequest request,Product product, BindingResult bindingResult){
        //1-依次 得到图片的后缀名、得到菜品的种类、生成新的图片名
        String suffix = imageUrl.getOriginalFilename().substring(imageUrl.getOriginalFilename().lastIndexOf("."));
       // int kindId = product.getProductKindId();
        String newPicName = UUIDUtils.getUUID15()+suffix;
        //2-获取项目路径  指定图片按照商品的分类存放 id为1的图片 放置/static/pro/upload/下的1文件夹里
        ServletContext sc = request.getSession().getServletContext();
        String localPath = "/static/pro/upload/";
        //String localPath = "/static/pro/upload/"+kindId+"/";
        String path = sc.getRealPath(localPath);
        //2-2-如果图片不为空 以流的形式存放到指定的文件夹中
        FileOutputStream fos = null;
        InputStream in = null;
        if (!imageUrl.isEmpty()){
            try{
                fos = new FileOutputStream(path + newPicName);
                in = imageUrl.getInputStream();
                int b = 0;
                while((b = in.read()) != -1){
                    fos.write(b);
                }
                //2-3关闭流
                fos.close();
                in.close();
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        //3-保存商品的信息到数据库中
        product.setImageUrl(localPath+newPicName);
        productService.addOne(product);
        return "redirect:/admin/toProductList";
    }

    /**
     * 修改商品的信息  数据回显
     * @return
     */
    @RequestMapping("/admin/updateProductView")
    public String updateProductView(Integer id, Model model) {
        Product dbproduct = productService.findProductById(id);
        model.addAttribute("flag","update");
        model.addAttribute("product", dbproduct);
        return "/admin/product/product_edit";
    }

    /**
     * 更新商品信息
     */
    @RequestMapping("/admin/updateProduct")
    public String updateProduct(Product product, BindingResult bindingResult) {
        System.out.println(product.toString());
        productService.updateOne(product);
        return "redirect:/admin/toProductList";
    }

    /**
     * 删除商品
     */
    @GetMapping("/admin/deleteProductById")
    public String deleteProductById(Integer id, RedirectAttributes  redirectAttributes) {
        if(productService.findProductBannerByProductId(id) != null) {
            redirectAttributes.addAttribute("errorInfo","请取消热门关联再进行操作");
            return "redirect:/admin/toProductList";
        }
        productService.deleteById(id);
        return "redirect:/admin/toProductList";
    }

    /**
     * 批量删除商品
     */
    @RequestMapping("/admin/deleteAllProduct")
    public String deleteAll(@RequestParam("id") Integer[] id) {
        productService.deleteAllProduct(id);
        return "redirect:/admin/toProductList";
    }

    /**
     * * 更改商品状态
     */
    @GetMapping("/admin/updateProductStatus")
    public String updateProductStatus(Product product, RedirectAttributes  redirectAttributes){
        if(product.getStatus()==0){
            if(productService.findProductBannerByProductId(product.getId()) != null) {
                redirectAttributes.addAttribute("errorInfo","请取消热门关联再进行操作");
                return "redirect:/admin/toProductList";
            }
        }

        productService.updateProductStatusById(product);
        return "redirect:/admin/toProductList";
    }

    /**
     * 后台展示商品分类
     * @return
     */
    @RequestMapping("/admin/toProductClassifyList")
    public String categoryManage(@RequestParam(required = true, defaultValue = "1") Integer page,Model model) {
        PageHelper.startPage(page, 10);
        //1-查询全部商品类别
        List productKindList = productService.findAllProductKindNameList();
        model.addAttribute("productKindList",productKindList);
        PageInfo<ProductKind> pageInfo = new PageInfo<ProductKind>(productKindList);
        model.addAttribute("page", pageInfo);
        return "/admin/product/productclassify_list";
    }

    /**
     * 添加商品类别
     */
    @RequestMapping("/admin/addClassify")
    public String toAddClassify(ProductKind productKind){
        productKindService.addProductKind(productKind);
        return "redirect:/admin/toProductClassifyList";
    }

    /**
     * 修改商品类别
     */
    @RequestMapping("/admin/updateClassify")
    public String toUpdateClassify(Integer id,String updateKindName){
        ProductKind productKindUpdate = new ProductKind(id,updateKindName);
        productKindService.updateProductKind(productKindUpdate);
        return "redirect:/admin/toProductClassifyList";
    }

    /**
     * 删除商品类别
     */
    @RequestMapping("/admin/deleteKindById")
    public String deleteClassify(Integer kindId){
        ProductKind productKindDel = new ProductKind(kindId);
        productKindService.deleteProductKind(productKindDel);
        return "redirect:/admin/toProductClassifyList";
    }

    /**
     * 批量删除 商品类别
     */
    @RequestMapping("/admin/batchtDeleteProduct")
    public String batchDeleteClassify(@RequestParam("id") Integer[] kindIds){
        productKindService.batchDeletekind(kindIds);
        return "redirect:/admin/toProductClassifyList";
    }

    /**
     * 查询全部分类
     */
    @RequestMapping(value="/admin/productKind/list",produces = "application/json;charset=utf-8")
    @ResponseBody
    public Object productKind(){
        List productKindList= productService.findAllProductKindNameList();
        return ResponseMessageEnum.SUCCESS.appendObjectToString(productKindList);
    }

//---------------------------------------------------------------------------------------------------------------

    @RequestMapping("/admin/toProductBanner")
    public String toProductBanner(Model model,@RequestParam(required = true, defaultValue = "1") Integer page){
        PageHelper.startPage(page,5);
        List<ProductBanner> productBannerList = productService.findAllProductBanner();
        PageInfo<ProductBanner> pageInfo = new PageInfo<>(productBannerList);
        model.addAttribute("page",pageInfo);
        model.addAttribute("productBannerList",productBannerList);
        return "/admin/product/product_banner_list";
    }

    @RequestMapping("/admin/toAddProductBanner")
    public String toAddProductBanner(){
        return "/admin/product/product_banner_edit";
    }

    /**
     *选择上架状态 并且未关联热门的商品
     */
    @GetMapping(value = "/admin/validProduct/list" ,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Object getValidProduct(){
        List<Product> validProductList = new ArrayList<>();
        productService.findAllProductList().
                stream().filter(product -> product.getStatus() == 1).       //过滤上架的商品
                collect(Collectors.toList()).forEach(product ->{
                    if (productService.findProductBannerById(product.getId()) == null){ //过滤未关联的商品
                        validProductList.add(product);
                    }
        });
        return ResponseMessageEnum.SUCCESS.appendObjectToString(validProductList);
    }


    @RequestMapping("/admin/addNewProductBanner")
    public String addNewProductBanner(ProductBanner productBanner){
        productService.addNewProductBanner(productBanner);
        return "redirect:/admin/toProductBanner";
    }
    /**
     * 删除商品类别
     */
    @RequestMapping("/admin/deleteProductBanner")
    public String deleteProductBanner(Integer id){
        productService.deleteProductBanner(id);
        return "redirect:/admin/toProductBanner";
    }

    @RequestMapping("/admin/updateProductBannerStatus")
    public String updateProductBannerStatus(Integer id){
        ProductBanner dbProductBanner = productService.findProductBannerById(id);
        ProductBanner productBanner = new ProductBanner(id);
        if(dbProductBanner.getStatus() == 1){
            productBanner.setStatus(0);
            productService.updateProductBanner(productBanner);
        }else{
            productBanner.setStatus(1);
            productService.updateProductBanner(productBanner);
        }
        return "redirect:/admin/toProductBanner";
    }

    @PostMapping("/admin/checkStatus")
    @ResponseBody
    public Integer checkStatus(Integer productId){
        //针对下架操作 校验是否关联热门
            System.out.println("2");
            ProductBanner dbProductBanner = productService.findProductBannerByProductId(productId);
            if(dbProductBanner == null){
                return ResponseMessageEnum.SUCCESS.getCode();
            }
            return  ResponseMessageEnum.FAIL.getCode();
    }

    public static void main(String[] args) {
      /*  File picture = new File("logo.jpg");
        String suffix = picture.getName().substring(picture.getName().lastIndexOf("."));
        System.out.println(suffix);


        File dir = new File("src/main/webapp/static/pro/upload/8");
        System.out.println(dir.getAbsolutePath());
        if(!dir.exists()){
            dir.mkdir();
        }

        System.out.println(dir.getAbsolutePath()+"创建成功");
*/
    }


}

前台用户操作管理层:

/**
 * @author yy
 *
 */

@Controller
public class UserController {
    @Autowired
    private OrderService orderService;
    @Autowired
    private UserService userService;
    @Autowired
    private EvaService evaService;
    @Autowired
    private LeaveService leaveService;

    /**
     * 去用户中心
     */
    @GetMapping("/toUserCenter")
    public String toUserCenter(Model model,HttpSession session){
        User user = (User) session.getAttribute("user");
        User userInfos = userService.findUserInfo(user.getId());
        model.addAttribute("userInfos",userInfos);
        return "/pages/user/user_center";
    }

    /**
     * 去我的订单
     */
    @RequestMapping("/toUserOrder")
    public String toUserOrder(@RequestParam(required=true,defaultValue="1") Integer page, HttpSession session, Model model){
        User users = (User) session.getAttribute("user");
        User user = userService.findUserInfo(users.getId());
        //PageHelper.startPage(page, pageSize);这段代码表示,程序开始分页了,page默认值是1,pageSize默认是10,意思是从第1页开始,每页显示10条记录。
        PageHelper.startPage(page, 3);
        List<Order> orderList = orderService.findOrderListByUserId(users.getId());
        PageInfo<Order> p = new PageInfo<Order>(orderList);
        model.addAttribute("page", p);
        model.addAttribute("orderList",orderList);
        model.addAttribute("user",user);
        return "/pages/user/user_orderlist";
    }    /**
     * 显示收货地址
     * @param model
     * @return
     */
    @RequestMapping("/userAddress")
    public String userAddress(Model model, HttpSession session) {

        User user = (User) session.getAttribute("user");
        User userInfos = userService.findUserInfo(user.getId());
        model.addAttribute("userInfos",userInfos);
        return "/pages/user/user_address";
    }
    /**
     *
     *更新收货地址
     */
    @RequestMapping("/updateAddress")
    public String updateAddress(User user,Model model){
        userService.updateAddress(user);
        return "redirect:/userAddress";
    }

    /**
     * 显示个人中心信息
     * @param model
     * @return
     */
    @RequestMapping("/userAccount")
    public String userAccount(Model model,HttpSession session){
        User user = (User) session.getAttribute("user");
        User userInfos = userService.findUserInfo(user.getId());
        model.addAttribute("userInfos",userInfos);
        return "/pages/user/user_account";
    }

    /**
     * 跳转修改密码界面
     * @return
     */
    @RequestMapping("/updatePassword")
    public String updatePassword(){
        return "/pages/user/user_password";
    }

    /**
     * 修改密码
     * @param oldPwd 旧密码
     * @param newPwd 新密码
     * @param comfirmPwd 确认密码
     * @param model 数据
     * @return
     */
    @RequestMapping("/savePassword")
    public String  saveAddress(
            String oldPwd, String newPwd, String comfirmPwd,Model model,HttpSession session){
       /* User user = (User) session.getAttribute("user");
        if(user == null){
            return "/login";
        }
        User userInfo = userService.findUserInfo(user.getUserId());
        String dbPwd = userInfo.getPassword();
        if(StringUtils.isEmpty(oldPwd) && StringUtils.isEmpty(newPwd) && StringUtils.isEmpty(comfirmPwd)){
            //输入为空
            model.addAttribute("errorInfo","输入为空!");
            return "/pages/user/user_password";
        }else if(!dbPwd.equals(oldPwd)){
            //旧密码不对
            model.addAttribute("errorInfo","旧密码不对!");
            return "/pages/user/user_password";
        }else if(!newPwd.equals(comfirmPwd)){
            //两次密码输入不一致
            model.addAttribute("errorInfo","两次输入密码不一致!");
            return "/pages/user/user_password";
        }else{
            //输入合法,进入修改密码
            userService.updatePwd(comfirmPwd);*/
            return "redirect:/userAccount";
    }

    /**
     * 跳转修改更换手机号界面
     * @return
     */
    @RequestMapping("/updateTel")
    public String updateTel(){
        return "/pages/user/user_telephone";
    }

    /*
     * 更换手机号
     * @param newTel
     * @return
     */
    @RequestMapping("/saveTelephone")
    public String saveTel(String newTel,Model model,HttpSession session){
      /*  String regexMobile = "^((17[0-9])|(14[0-9])|(13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
        User user = (User) session.getAttribute("user");
        if(user == null){
            return "/login";
        }

        if(!newTel.matches(regexMobile)){
            model.addAttribute("msg","格式不对!");
            return "/pages/user/user_telephone";
        }
        userService.updateTel(newTel,user.getUserId());
        model.addAttribute("msg","修改成功");*/
        return "redirect:/userAccount";
    }

    /**
     * 解绑手机号
     * @return
     */
    @RequestMapping("/deleteTel")
    public String deleteTel(HttpSession session){
       /* User user = (User) session.getAttribute("user");
        userService.deleteTel(user.getUserId());*/
        return "redirect:/userAccount";
    }

    /**
     * 跳转到更换邮箱界面
     * @return
     */
    @RequestMapping("/updateEmail")
    public String updateEmail(){
        return "/pages/user/user_email";
    }

    /**
     * 更换邮箱
     * @param newEmail 新邮箱
     * @return
     */
    @RequestMapping("/saveEmail")
    public String saveEmail(String newEmail,Model model,HttpSession session){
        String regexEmail = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
        User user = (User) session.getAttribute("user");
        if(user == null){
            return "/login";
        }
        if (!newEmail.matches(regexEmail)){
            model.addAttribute("msg","格式错误!");
            return "/pages/user/user_email";
        }
       /* userService.updateEmail(user.getUserId(),newEmail);*/
        return "redirect:/userAccount";
    }

    /**
     * 修改订单状态
     * @param status
     * @param orderId
     * @return
     */
    @RequestMapping("/updateOrderStatus")
    public String updateOrderStatus(Integer status,String orderId){
        orderService.updateOrderStatus(status,orderId);
        return "redirect:/toUserOrder";
    }

    /**
     * 跳转评价页面
     */
    @RequestMapping("/toEvaluate")
    public String toEvaluate(String orderId,Integer status,Model model){
        List<String> productNameList = new ArrayList<>();
        orderService.findProductByOrderId(orderId).forEach((product) -> {
            productNameList.add(product.getProductName());
        });
        model.addAttribute("productNameList",productNameList);
        model.addAttribute("orderId",orderId);
        model.addAttribute("status",status);
        return "/pages/user/evaluate";
    }


    /**
     * 发布评论
     */
    @RequestMapping("/saveEva")
    public String saveEva(String orderId,String content,Integer status){
        evaService.saveEva(orderId,content,status);
        return "redirect:/toEvaList";
    }

    /**
     * 用户评价列表
     * @return
     */
    @RequestMapping("/toEvaList")
    public String toEvaList(@RequestParam(required=true,defaultValue="1") Integer page,Model model){
        PageHelper.startPage(page, 4);
        List<Evaluate> evaList = evaService.findAllEvaList();
        //PageHelper.startPage(page, pageSize);这段代码表示,程序开始分页了,page默认值是1,pageSize默认是10,意思是从第1页开始,每页显示10条记录。
        PageInfo<Evaluate> p=new PageInfo<Evaluate>(evaList);
        model.addAttribute("page", p);
        model.addAttribute("evaList",evaList);
        return "/pages/user/evaluate_list";
    }

    @RequestMapping("/createLeave")
    public String createLeave(String content,HttpSession session){
        User user = (User)session.getAttribute("user");
        leaveService.createLeave(content,user);
        return "redirect:/index";
    }
    @RequestMapping("/aboutUs")
    public String aboutUs(){
        return "/pages/other/about_us";
    }
    @RequestMapping("/userLogout")
    public String userLogout(HttpSession httpSession){
        //将user对象从session域中删除
        httpSession.removeAttribute("user");
        //页面应该跳转到登陆页面
        return "redirect:/index";
    }
}