1. 配置数据库日志输出 2. 任务更新API与测试类 3. 任务删除API与测试类
This commit is contained in:
@@ -6,6 +6,8 @@ import com.guo.learningprogresstracker.dto.response.TasksListInfoResponse;
|
||||
import com.guo.learningprogresstracker.entity.TaskEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.rmi.ServerException;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Service
|
||||
@@ -20,4 +22,6 @@ public interface TasksService extends IService<TaskEntity> {
|
||||
TaskInfoResponse getTask(String taskId);
|
||||
|
||||
void updateTask(String taskId, TaskRequest updatedTask);
|
||||
|
||||
void deleteTask(String taskId) throws ServerException;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,11 @@ import com.guo.learningprogresstracker.mapper.TasksMapper;
|
||||
import com.guo.learningprogresstracker.utils.CalculatedPriorityTool;
|
||||
import com.guo.learningprogresstracker.utils.GenerateNumTool;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.rmi.ServerException;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Service实现
|
||||
@@ -22,6 +25,7 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class TasksServiceImpl extends ServiceImpl<TasksMapper, TaskEntity>
|
||||
implements TasksService{
|
||||
|
||||
@@ -58,6 +62,14 @@ public class TasksServiceImpl extends ServiceImpl<TasksMapper, TaskEntity>
|
||||
this.updateById(taskEntity);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTask(String taskId) throws ServerException {
|
||||
boolean b = this.removeById(taskId);
|
||||
if(!b){
|
||||
throw new ServerException("未能正常删除任务");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user