首页>代码>基于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; } }
最近下载更多
wlax99 LV12
11月1日
yayacui LV2
10月28日
lijianMark LV6
9月23日
Peny_ZH LV5
9月22日
ma406805131 LV15
6月15日
thsgli LV8
6月13日
来一杯西瓜冰咩 LV6
5月11日
微信网友_6927932988952576 LV12
3月30日
zolscy LV12
3月24日
a318888331 LV13
3月10日
最近浏览更多
wlax99 LV12
10月31日
shunlun8855 LV1
10月29日
yayacui LV2
10月28日
ckqlxm LV1
10月25日
zwn258000
10月24日
暂无贡献等级
lijianMark LV6
9月23日
Peny_ZH LV5
9月21日
17558420274 LV16
9月15日
微信网友_7044194812350464 LV8
9月13日
abdkfksdkf LV16
8月25日