Files
Nexus-api/src/main/java/com/dota/nexus/service/impl/GoalServiceImpl.java

35 lines
967 B
Java
Raw Normal View History

2025-10-08 09:50:13 +08:00
package com.dota.nexus.service.impl;
2025-10-10 11:40:34 +08:00
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
2025-10-08 09:50:13 +08:00
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dota.nexus.entity.Goal;
2025-10-10 11:40:34 +08:00
import com.dota.nexus.entity.GoalEnum;
2025-10-08 09:50:13 +08:00
import com.dota.nexus.mapper.GoalMapper;
import com.dota.nexus.service.GoalService;
2025-10-10 11:40:34 +08:00
import org.springframework.stereotype.Service;
2025-10-08 09:50:13 +08:00
2025-10-10 11:40:34 +08:00
@Service
2025-10-08 09:50:13 +08:00
public class GoalServiceImpl extends ServiceImpl<GoalMapper, Goal> implements GoalService {
2025-10-10 11:40:34 +08:00
@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);
}
2025-10-08 09:50:13 +08:00
}