add: 目标crud

This commit is contained in:
kkunkka
2025-10-10 11:40:34 +08:00
parent 9e20d0f5f8
commit f86462bb24
8 changed files with 139 additions and 5 deletions

View File

@@ -1,10 +1,35 @@
package com.dota.nexus.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dota.nexus.entity.Goal;
import com.dota.nexus.entity.GoalEnum;
import com.dota.nexus.mapper.GoalMapper;
import com.dota.nexus.service.GoalService;
import org.springframework.stereotype.Service;
@Service
public class GoalServiceImpl extends ServiceImpl<GoalMapper, Goal> implements GoalService {
@Override
public void doneGoal(Integer id) {
updateStatus(id, GoalEnum.DONE);
}
@Override
public void doingGoal(Integer id) {
updateStatus(id, GoalEnum.DOING);
}
@Override
public void cancelGoal(Integer id) {
updateStatus(id, GoalEnum.CANCEL);
}
private void updateStatus(Integer id, GoalEnum status) {
var update = new LambdaUpdateWrapper<Goal>();
update.eq(Goal::getId, id);
update.set(Goal::getStatus, status);
this.baseMapper.update(update);
}
}