|  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Api(tags = "教室管理") | 
|---|
|  |  |  | @Api(tags = "教室管理") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(value = "admin/classroom") | 
|---|
|  |  |  | public class ClassRoomController { | 
|---|
|  |  |  | //日志 | 
|---|
|  |  |  | //日志 | 
|---|
|  |  |  | private final Logger log = LogManager.getLogger(ClassRoomController.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 分页查询中,默认记录条数和页数 | 
|---|
|  |  |  | // 分页查询中,默认记录条数和页数 | 
|---|
|  |  |  | private static final int DEFAULT_PAGE_SIZE = 10; | 
|---|
|  |  |  | private static final int DEFAULT_PAGE_NUM = 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | private CommonDAO commonDAO; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 课表列表 | 
|---|
|  |  |  | * 课表列表 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "获取教室列表") | 
|---|
|  |  |  | @ApiOperation(value = "获取教室列表") | 
|---|
|  |  |  | @RequestMapping(value = "list", method = RequestMethod.GET) | 
|---|
|  |  |  | public @ResponseBody Result list(String keyword,Short status,Integer pageSize,Integer pageNum) { | 
|---|
|  |  |  | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; | 
|---|
|  |  |  | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //总考试数量 | 
|---|
|  |  |  | //总考试数量 | 
|---|
|  |  |  | int totalCount = classRoomService.listCount(keyword, status); | 
|---|
|  |  |  | Pager pager = new Pager(pageSize,pageNum); | 
|---|
|  |  |  | pager.setTotalCount(totalCount); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 保存 | 
|---|
|  |  |  | * 保存 | 
|---|
|  |  |  | * @param classRoom | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "保存教室") | 
|---|
|  |  |  | @ApiOperation(value = "保存教室") | 
|---|
|  |  |  | @RequestMapping(value = "/save", method = RequestMethod.POST) | 
|---|
|  |  |  | public @ResponseBody Result save(@RequestBody ClassRoom classRoom) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(checkIsDumplicate(classRoom.getRoomId(),classRoom.getName(),classRoom.getAddress())){ | 
|---|
|  |  |  | return new Result(false, "添加失败!重复的教室信息"); | 
|---|
|  |  |  | return new Result(false, "添加失败!重复的教室信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (StringUtils.isEmpty(classRoom.getRoomId())) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除 | 
|---|
|  |  |  | * 删除 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param examIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "删除教室", httpMethod = "GET") | 
|---|
|  |  |  | @ApiImplicitParam(name = "roomIds", value = "教室ID字符串", required = true, dataType = "String", paramType = "body") | 
|---|
|  |  |  | @ApiOperation(value = "删除教室", httpMethod = "GET") | 
|---|
|  |  |  | @ApiImplicitParam(name = "roomIds", value = "教室ID字符串", required = true, dataType = "String", paramType = "body") | 
|---|
|  |  |  | @RequestMapping(value = "delete", method = RequestMethod.GET) | 
|---|
|  |  |  | public @ResponseBody Result delete(String roomIds) { | 
|---|
|  |  |  | Result result = new Result(true); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 发布教室 | 
|---|
|  |  |  | * 发布教室 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param scheduleIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "发布教室", httpMethod = "GET") | 
|---|
|  |  |  | @ApiOperation(value = "发布教室", httpMethod = "GET") | 
|---|
|  |  |  | @RequestMapping(value = "/publish", method = RequestMethod.GET) | 
|---|
|  |  |  | public @ResponseBody Result publish(String roomIds) { | 
|---|
|  |  |  | if (StringUtils.isEmpty(roomIds)) { | 
|---|
|  |  |  | return new Result(false, "参数错误"); | 
|---|
|  |  |  | return new Result(false, "参数错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.classRoomService.doRelease(roomIds.split(",")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 撤回发布的教室 | 
|---|
|  |  |  | * 撤回发布的教室 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param scheduleIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "撤回教室", httpMethod = "GET") | 
|---|
|  |  |  | @ApiOperation(value = "撤回教室", httpMethod = "GET") | 
|---|
|  |  |  | @RequestMapping(value = "/cancel", method = RequestMethod.GET) | 
|---|
|  |  |  | public @ResponseBody Result cancel(String roomIds) { | 
|---|
|  |  |  | if (StringUtils.isEmpty(roomIds)) { | 
|---|
|  |  |  | return new Result(false, "参数错误"); | 
|---|
|  |  |  | return new Result(false, "参数错误"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return this.classRoomService.doCancel(roomIds.split(",")); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 详情页面数据 | 
|---|
|  |  |  | * 详情页面数据 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param examId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "详情页面数据") | 
|---|
|  |  |  | @ApiOperation(value = "详情页面数据") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(name="roomId", dataType="String", paramType="query", value="教室ID", required=true), | 
|---|
|  |  |  | @ApiImplicitParam(name="roomId", dataType="String", paramType="query", value="教室ID", required=true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @RequestMapping(value = "/detail", method = RequestMethod.GET) | 
|---|
|  |  |  | public @ResponseBody Result detail(String roomId) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | *查询所有教室的ID和名称 | 
|---|
|  |  |  | *查询所有教室的ID和名称 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param scheduleIds | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiOperation(value = "可选择教室ID和名称") | 
|---|
|  |  |  | @ApiOperation(value = "可选择教室ID和名称") | 
|---|
|  |  |  | @RequestMapping(value = "/allRoomIdAndNames", method = RequestMethod.GET) | 
|---|
|  |  |  | public @ResponseBody Result listClassRoomIdAndNames() { | 
|---|
|  |  |  | List<Map<String,Object>> listResult =  this.classRoomService.queryAllRoomIdAndNames(); | 
|---|