|
@@ -18,6 +18,7 @@ import java.util.List;
|
|
|
* Created by Admiral on 2018/1/20.
|
|
|
*/
|
|
|
@Controller
|
|
|
+@ResponseBody
|
|
|
@RequestMapping("/ordinary")
|
|
|
public class OrdinaryController {
|
|
|
|
|
@@ -27,82 +28,79 @@ public class OrdinaryController {
|
|
|
@Resource(name = "reservationServiceImpl")
|
|
|
private ReservationService reservationService;
|
|
|
|
|
|
- @RequestMapping(value="/getString", method=RequestMethod.GET)
|
|
|
+ /**
|
|
|
+ * 获取会议室列表
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping(value="/roomList", method=RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public String getString() throws Exception {
|
|
|
- List<Room> list = null;
|
|
|
- list = roomService.findByPaging(1);
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
- String jsonString = mapper.writeValueAsString(list);
|
|
|
- return jsonString;
|
|
|
+ public List<Room> roomList() throws Exception {
|
|
|
+ List<Room> list = roomService.findByPaging(1);
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
- /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<会议室信息管理>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
|
|
|
- // 会议室信息显示
|
|
|
- @RequestMapping("/showRoom")
|
|
|
- public String showRoom(Model model, Integer page) throws Exception {
|
|
|
-
|
|
|
- List<Room> list = null;
|
|
|
- //页码对象
|
|
|
- PagingVO pagingVO = new PagingVO();
|
|
|
- //设置总页数
|
|
|
- pagingVO.setTotalCount(roomService.roomCount());
|
|
|
- if (page == null || page == 0) {
|
|
|
- pagingVO.setToPageNo(1);
|
|
|
- list = roomService.findByPaging(1);
|
|
|
- } else {
|
|
|
- pagingVO.setToPageNo(page);
|
|
|
- list = roomService.findByPaging(page);
|
|
|
- }
|
|
|
-
|
|
|
- model.addAttribute("roomList", list);
|
|
|
- model.addAttribute("pagingVO", pagingVO);
|
|
|
-
|
|
|
- return "/ordinary/showRoom";
|
|
|
+ /**
|
|
|
+ * 根据会议室名称模糊搜索会议室
|
|
|
+ * @param roomName
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/queryRoomByName", method = {RequestMethod.POST,RequestMethod.GET})
|
|
|
+ private List<Room> queryRoomByName(String roomName) throws Exception {
|
|
|
+ List<Room> list = roomService.findByName(roomName);
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
- //搜索会议室
|
|
|
- @RequestMapping(value = "/queryRoom", method = {RequestMethod.POST})
|
|
|
- private String queryRoom(String findByName, Model model) throws Exception {
|
|
|
-
|
|
|
- List<Room> list = roomService.findByName(findByName);
|
|
|
-
|
|
|
- model.addAttribute("roomList", list);
|
|
|
- return "/ordinary/showRoom";
|
|
|
+ /**
|
|
|
+ * 根据会议室id查询会议室详情
|
|
|
+ * @param roomID
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/queryRoomById", method = {RequestMethod.POST,RequestMethod.GET})
|
|
|
+ private Room queryRoomById(Integer roomID) throws Exception {
|
|
|
+ Room room = roomService.findById(roomID);
|
|
|
+ return room;
|
|
|
}
|
|
|
|
|
|
- //查询接下来的15天内所有已被预约的会议室记录
|
|
|
+ /**
|
|
|
+ * 查询所有的会议室预约记录
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
@RequestMapping("/showRecord")
|
|
|
- public String findAllReservation(Model model, Integer page) throws Exception {
|
|
|
+ public List<ReservationVo> findAllReservation() throws Exception {
|
|
|
List<ReservationVo> list = null;
|
|
|
+ list = reservationService.findAllByPaging(1);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
|
|
|
- //页码对象
|
|
|
- PagingVO pagingVO = new PagingVO();
|
|
|
- //设置总页数
|
|
|
- pagingVO.setTotalCount(reservationService.reserveCount());
|
|
|
- if (page == null || page == 0) {
|
|
|
- pagingVO.setToPageNo(1);
|
|
|
- list = reservationService.findAllByPaging(1);
|
|
|
- } else {
|
|
|
- pagingVO.setToPageNo(page);
|
|
|
- list = reservationService.findAllByPaging(page);
|
|
|
- }
|
|
|
-
|
|
|
- model.addAttribute("recordList", list);
|
|
|
- model.addAttribute("pagingVo", pagingVO);
|
|
|
-
|
|
|
- return "/ordinary/showRecord";
|
|
|
+ /**
|
|
|
+ * 根据会议室id查询会议室记录
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping("/showRecordByRoomId")
|
|
|
+ public List<ReservationVo> findAllReservationByRoomId(Integer id) throws Exception {
|
|
|
+ List<ReservationVo> list = null;
|
|
|
+ list = reservationService.findByRoomId(id);
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
//搜索借用人
|
|
|
- @RequestMapping(value = "/queryByUser", method = {RequestMethod.POST})
|
|
|
- private String queryUser(String findByName, Model model) throws Exception {
|
|
|
-
|
|
|
- List<ReservationVo> list = reservationService.queryByUser(findByName);
|
|
|
-
|
|
|
- model.addAttribute("recordList", list);
|
|
|
|
|
|
- return "/ordinary/showRecord";
|
|
|
+ /**
|
|
|
+ * 搜索我组织的会议
|
|
|
+ * @param userName
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/queryByUser")
|
|
|
+ private List<ReservationVo> queryUser(String userName) throws Exception {
|
|
|
+ List<ReservationVo> list = reservationService.queryByUser(userName);
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
//预约会议室页面跳转
|