首页>代码>基于SpringBoot+thymeleaf实现的大学生自习室座位预定系统>/seat-subscribe-sys/src/main/java/com/cxs/controller/CollegeController.java
package com.cxs.controller;

import com.cxs.dto.AdminAddRoomDTO;
import com.cxs.enums.OpenTypeEnum;
import com.cxs.model.Admin;
import com.cxs.model.Classroom;
import com.cxs.model.College;
import com.cxs.model.Seat;
import com.cxs.service.AdminService;
import com.cxs.service.ClassroomService;
import com.cxs.service.CollegeService;
import com.cxs.service.SeatOrderService;
import com.cxs.service.SeatService;
import com.cxs.vo.AdminLoginVO;
import com.cxs.vo.ClassroomVO;
import com.cxs.vo.Result;
import com.cxs.vo.SeatOrderVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*
 * @Project:seat-subscribe-sys
 * @Author:cxs
 * @Motto:放下杂念,只为迎接明天更好的自己
 * */
@Controller
@RequestMapping("/college")
public class CollegeController {

    @Autowired
    private AdminService adminService;

    @Autowired
    private ClassroomService classroomService;

    @Autowired
    private SeatService seatService;

    @Autowired
    private SeatOrderService seatOrderService;

    @Autowired
    private CollegeService collegeService;


    @RequestMapping("/toCollegeList")
    public String toCollegeList(HttpSession session, Model model) {
        List<College> list = collegeService.list(null);
        model.addAttribute("list", list);
        return "admin/collegeList";
    }

    @RequestMapping("/toAddCollege")
    public String toAddCollege(HttpSession session, Model model) {
        return "admin/addCollege";
    }

    @RequestMapping("/toEditCollege")
    public String toEditCollege(Integer id, HttpSession session, Model model) {
        College byId = collegeService.getById(id);
        model.addAttribute("data", byId);
        return "admin/editCollege";
    }

    @RequestMapping("/addCollege")
    @ResponseBody
    public Result addCollege(College college, HttpSession session, Model model) {
        Result result = new Result(200, "OK");
        boolean save = collegeService.save(college);
        if (!save) {
            result.setCode(-1);
            result.setMsg("添加失败");
        }
        return result;
    }

    @RequestMapping("/updateCollege")
    @ResponseBody
    public Result updateCollege(College college, HttpSession session, Model model) {
        Result result = new Result(200, "OK");
        boolean save = collegeService.updateById(college);
        if (!save) {
            result.setCode(-1);
            result.setMsg("修改失败");
        }
        return result;
    }

    @RequestMapping("/deleteCollege")
    @ResponseBody
    public Result deleteCollege(College college, HttpSession session, Model model) {
        Result result = new Result(200, "OK");
        boolean save = collegeService.removeById(college.getId());
        if (!save) {
            result.setCode(-1);
            result.setMsg("删除失败");
        }
        return result;
    }

    @RequestMapping("/getCollegeList")
    @ResponseBody
    public Result getCollegeList(HttpSession session, Model model) {
        Result result = new Result(200, "OK");
        List<College> list = collegeService.list(null);
        result.setData(list);
        return result;
    }

}
最近下载更多
zolscy  LV12 3月24日
a318888331  LV13 3月10日
wanglinddad  LV55 3月7日
罗清晨  LV12 2月28日
打烊1234  LV2 1月31日
taoshen95  LV14 1月26日
亦是此间少年  LV3 1月16日
最近浏览更多
330588 前天
暂无贡献等级
yhsohh123 4月29日
暂无贡献等级
hmf1989 4月26日
暂无贡献等级
Charismatic 4月14日
暂无贡献等级
yhe107  LV3 4月7日
诺一啊啊啊啊啊  LV3 4月7日
fff2003  LV6 4月4日
zolscy  LV12 3月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友