35 lines
967 B
Java
35 lines
967 B
Java
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);
|
|
}
|
|
} |