|
|
@ -1,7 +1,11 @@ |
|
|
|
package com.iflytop.nuclear.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.iflytop.nuclear.model.Account; |
|
|
|
import com.iflytop.nuclear.model.NuclearCoreConfig; |
|
|
|
import com.iflytop.nuclear.model.Task; |
|
|
|
import com.iflytop.nuclear.service.NuclearCoreConfigService; |
|
|
|
import com.iflytop.nuclear.service.TaskService; |
|
|
|
import com.iflytop.nuclear.utils.JwtTokenUtils; |
|
|
|
import com.iflytop.nuclear.utils.ResponseData; |
|
|
@ -30,6 +34,8 @@ public class TaskController { |
|
|
|
@Autowired |
|
|
|
TaskService taskService; |
|
|
|
@Autowired |
|
|
|
NuclearCoreConfigService nuclearCoreConfigService; |
|
|
|
@Autowired |
|
|
|
HttpServletRequest request; |
|
|
|
|
|
|
|
@PostMapping("/create") |
|
|
@ -42,7 +48,7 @@ public class TaskController { |
|
|
|
return ResponseData.success(jsonObject); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("list") |
|
|
|
@GetMapping("/list") |
|
|
|
public ResponseData getTaskListByUserId() { |
|
|
|
String token = request.getHeader("Authorization"); |
|
|
|
if (token.length() > 0){ |
|
|
@ -56,4 +62,24 @@ public class TaskController { |
|
|
|
} |
|
|
|
return ResponseData.fail("用户登陆信息错误"); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/delete/{id}") |
|
|
|
public ResponseData deleteTask(@PathVariable(name = "id") int id) { |
|
|
|
boolean b = taskService.removeById(id); |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("result", b); |
|
|
|
return ResponseData.success(jo); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/delete/excel/{id}") |
|
|
|
public ResponseData deleteTaskExcel(@PathVariable(name = "id") int id) { |
|
|
|
QueryWrapper<NuclearCoreConfig> nuclearCoreConfigQueryWrapper = new QueryWrapper<>(); |
|
|
|
nuclearCoreConfigQueryWrapper.eq("task_id", id); |
|
|
|
boolean remove = nuclearCoreConfigService.remove(nuclearCoreConfigQueryWrapper); |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("result", remove); |
|
|
|
return ResponseData.success(jo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |