首页>代码>基于springboot的员工宿舍管理系统>/src/main/java/com/lian/demo/controller/baoxiuController.java
package com.lian.demo.controller;

import com.lian.demo.pojo.baoxiu;
import com.lian.demo.service.baoxiuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class baoxiuController {
    @Autowired
    private baoxiuService baoxiuService;
    @RequestMapping("/addbaoxiu")
    public String addBaoXiu(baoxiu baoxiu){
        baoxiuService.addBaoXiu(baoxiu);
        return "add-baoxiu";
    }
    @RequestMapping("/queryBaoXiu")
    public ModelAndView queryBaoXiu(){
        List<baoxiu> baoxiuList= baoxiuService.queryBaoXiu();
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("baoxiu",baoxiuList);
        modelAndView.setViewName("baoxius");
        return modelAndView;
    }
    @RequestMapping(value = "/deleteBaoXiu/{id}")
    public String deleteBaoXiu(@PathVariable("id") int id){
        baoxiuService.deleteBaoxiu(id);
        return "redirect:/queryBaoXiu";
    }
    @RequestMapping(value = "/toEditBaoxiu/{id}")
    public String toEditBaoxiu(@PathVariable("id") int id, Model model){
        baoxiu baoxiu=baoxiuService.findById(id);
        model.addAttribute("baoxiuList",baoxiu);
        return "edit-baoxiu";
    }
    @RequestMapping(value = "/editBaoxiu")
    private String editbaoxiu(baoxiu baoxiu){
        baoxiuService.editBaoxiu(baoxiu);
        return "redirect:/queryBaoXiu";
    }
}
最近下载更多
Luck_ZDM  LV11 4月12日
together love  LV2 3月26日
wsl566666  LV2 2月20日
3311545828  LV3 1月19日
南波万  LV1 1月17日
YhXyHx523  LV6 2023年12月24日
wuge123  LV8 2023年12月21日
gecongkai  LV8 2023年12月21日
yuanshun  LV6 2023年12月17日
故里逢春  LV2 2023年12月15日
最近浏览更多
一个小学码  LV4 4月16日
Luck_ZDM  LV11 4月12日
阿昌先生  LV13 3月27日
together love  LV2 3月24日
15103432984  LV2 3月16日
entity123456 3月15日
暂无贡献等级
西瓜哥哥  LV4 3月5日
escape1023 3月4日
暂无贡献等级
lyhlyh  LV10 2月20日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友