首页>代码>基于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; } }
最近下载更多
来一杯西瓜冰咩 LV3
前天
微信网友_6927932988952576 LV12
3月30日
zolscy LV12
3月24日
a318888331 LV13
3月10日
wanglinddad LV55
3月7日
微信网友_6888487558615040 LV6
3月1日
罗清晨 LV12
2月28日
打烊1234 LV2
1月31日
taoshen95 LV14
1月26日
亦是此间少年 LV3
1月16日