chore: 清理冗余注释,保留字段/业务含义注释
This commit is contained in:
@@ -20,10 +20,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
* 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Service实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@@ -34,7 +32,6 @@ public class TasksServiceImpl extends ServiceImpl<TasksMapper, TaskEntity>
|
||||
|
||||
@Override
|
||||
public Page<TaskInfo> taskList(Integer pageNum, Integer pageSize) {
|
||||
// 拦截器自动注入 created_by 条件,只返回当前用户的任务
|
||||
Page<TaskEntity> page = tasksMapper.selectPage(new Page<TaskEntity>(pageNum, pageSize),
|
||||
Wrappers.lambdaQuery(TaskEntity.class)
|
||||
.orderByDesc(TaskEntity::getCalculatedPriority));
|
||||
@@ -46,7 +43,6 @@ public class TasksServiceImpl extends ServiceImpl<TasksMapper, TaskEntity>
|
||||
public String addTask(TaskRequest taskRequest) throws ErrorParameterException {
|
||||
TaskEntity task = TaskConvert.MAPPER.taskRequestToTaskEntity(taskRequest);
|
||||
|
||||
// 拦截器自动注入 created_by,重复校验仅限当前用户
|
||||
if (this.exists(Wrappers.lambdaQuery(TaskEntity.class)
|
||||
.eq(TaskEntity::getTaskName, task.getTaskName()))) {
|
||||
throw new ErrorParameterException(String.format("任务名[%s]重复", task.getTaskName()));
|
||||
@@ -61,14 +57,12 @@ public class TasksServiceImpl extends ServiceImpl<TasksMapper, TaskEntity>
|
||||
|
||||
@Override
|
||||
public TaskInfoResponse getTask(String taskId) {
|
||||
// 拦截器自动校验归属,查到的一定是当前用户的任务
|
||||
TaskEntity taskEntity = this.getById(taskId);
|
||||
return TaskConvert.MAPPER.taskEntityToTaskInfoResponse(taskEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask(String taskId, TaskRequest updatedTask) {
|
||||
// getById 已被拦截器保护,其他用户的任务查不到
|
||||
TaskEntity existingTask = this.getById(taskId);
|
||||
if (existingTask == null) {
|
||||
throw new IllegalArgumentException("任务不存在: " + taskId);
|
||||
@@ -86,7 +80,6 @@ public class TasksServiceImpl extends ServiceImpl<TasksMapper, TaskEntity>
|
||||
|
||||
@Override
|
||||
public void deleteTask(String taskId) {
|
||||
// getById 已被拦截器保护,其他用户的任务查不到
|
||||
TaskEntity existingTask = this.getById(taskId);
|
||||
if (existingTask == null) {
|
||||
throw new IllegalArgumentException("任务不存在: " + taskId);
|
||||
|
||||
Reference in New Issue
Block a user