50 lines
1.5 KiB
Java
50 lines
1.5 KiB
Java
package com.sdut.labex.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.sdut.labex.service.TableService;
|
|
import com.sdut.labex.utils.ResVo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
/**
|
|
* File: TableController
|
|
* Created: 2023/6/15
|
|
* Author: springforest
|
|
* Description:
|
|
*/
|
|
@Slf4j
|
|
@RestController
|
|
@CrossOrigin
|
|
public class TableController {
|
|
@Resource
|
|
private TableService tableService;
|
|
|
|
@PostMapping("/getUnusedTable")
|
|
public ResVo getUnusedTable(@RequestBody JSONObject jsonObject) {
|
|
String roomName = jsonObject.getString("roomName");
|
|
String date = jsonObject.getString("date");
|
|
if (roomName.equals("")) {
|
|
roomName = "9教207";
|
|
}
|
|
return tableService.getUnUsedTable(roomName, date);
|
|
}
|
|
|
|
@PostMapping("/uploadTable")
|
|
public ResVo uploadTable(MultipartFile file, @RequestPart("date") String date, @RequestPart("room") String room) {
|
|
return tableService.uploadTable(file, date, room);
|
|
}
|
|
|
|
@PostMapping("/getUsedTable")
|
|
public ResVo getUsedTable(@RequestBody JSONObject jsonObject) {
|
|
String roomName = jsonObject.getString("roomName");
|
|
String date = jsonObject.getString("date");
|
|
if (roomName.equals("")) {
|
|
roomName = "9教207";
|
|
}
|
|
return tableService.getUsedTable(roomName, date);
|
|
}
|
|
}
|