|
@@ -1,32 +1,112 @@
|
|
package com.ruoyi.sim.controller;
|
|
package com.ruoyi.sim.controller;
|
|
|
|
|
|
-import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
-import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
-import com.ruoyi.sim.domain.Major;
|
|
|
|
-import com.ruoyi.sim.service.IMajorService;
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
|
+import com.ruoyi.sim.domain.Task;
|
|
|
|
+import com.ruoyi.sim.service.ITaskService;
|
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-
|
|
|
|
-@Api("TaskController")
|
|
|
|
|
|
+/**
|
|
|
|
+ * 任务Controller
|
|
|
|
+ *
|
|
|
|
+ * @author tom
|
|
|
|
+ * @date 2024-12-13
|
|
|
|
+ */
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/sim/task")
|
|
@RequestMapping("/sim/task")
|
|
|
|
+@Api("任务Controller")
|
|
public class TaskController extends BaseController {
|
|
public class TaskController extends BaseController {
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private IMajorService majorService;
|
|
|
|
|
|
+ private ITaskService taskService;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询任务列表
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- @PreAuthorize("@ss.hasPermi('sim:task:list')")
|
|
|
|
- public TableDataInfo list(Major major) {
|
|
|
|
|
|
+ public TableDataInfo list(Task task) {
|
|
startPage();
|
|
startPage();
|
|
- List<Major> list = majorService.selectMajorList(major);
|
|
|
|
|
|
+ List<Task> list = taskService.selectTaskList(task);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导出任务列表
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:export')")
|
|
|
|
+ @Log(title = "任务", businessType = BusinessType.EXPORT)
|
|
|
|
+ // @PostMapping("/export")
|
|
|
|
+ public void export(HttpServletResponse response, Task task) {
|
|
|
|
+ List<Task> list = taskService.selectTaskList(task);
|
|
|
|
+ ExcelUtil<Task> util = new ExcelUtil<Task>(Task.class);
|
|
|
|
+ util.exportExcel(response, list, "任务数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取任务详细信息
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:query')")
|
|
|
|
+ @GetMapping(value = "/{taskId}")
|
|
|
|
+ public AjaxResult getInfo(@PathVariable("taskId") Long taskId) {
|
|
|
|
+ return success(taskService.selectTaskByTaskId(taskId));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 新增任务
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:add')")
|
|
|
|
+ @Log(title = "任务", businessType = BusinessType.INSERT)
|
|
|
|
+ @PostMapping
|
|
|
|
+ public AjaxResult add(@RequestBody Task task) {
|
|
|
|
+ return toAjax(taskService.insertTask(task));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 修改任务
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:edit')")
|
|
|
|
+ @Log(title = "任务", businessType = BusinessType.UPDATE)
|
|
|
|
+ @PutMapping
|
|
|
|
+ public AjaxResult edit(@RequestBody Task task) {
|
|
|
|
+ return toAjax(taskService.updateTask(task));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除任务
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:remove')")
|
|
|
|
+ @Log(title = "任务", businessType = BusinessType.DELETE)
|
|
|
|
+ @DeleteMapping("/{taskIds}")
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] taskIds) {
|
|
|
|
+ return toAjax(taskService.deleteTaskByTaskIds(taskIds));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // -------------------------------- tom add --------------------------------
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ // @PreAuthorize("@ss.hasPermi('sim:task:query')")
|
|
|
|
+ @GetMapping("/getInfoForAdd/{simType}")
|
|
|
|
+ @ApiOperation("获取空白的任务详细信息,为了新建任务")
|
|
|
|
+ public AjaxResult getInfoForAdd(@PathVariable("simType") String simType) {
|
|
|
|
+ return success(taskService.selectNewTaskViaSimType(simType));
|
|
|
|
+ }
|
|
}
|
|
}
|