增加修改和删除功能
This commit is contained in:
@@ -180,7 +180,7 @@ public class LifePathServiceImpl extends ServiceImpl<LifePathMapper, LifePath>
|
||||
@Override
|
||||
public boolean deletePath(String id) {
|
||||
LifePath path = this.getById(id);
|
||||
if (path == null || path.getIsDeleted() == 1) {
|
||||
if (path == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ public class LifePathServiceImpl extends ServiceImpl<LifePathMapper, LifePath>
|
||||
return false;
|
||||
}
|
||||
|
||||
path.setIsDeleted(1);
|
||||
return this.updateById(path);
|
||||
// 使用 MyBatis-Plus 的 removeById 方法,自动处理逻辑删除
|
||||
return this.removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -203,15 +203,10 @@ public class LifePathServiceImpl extends ServiceImpl<LifePathMapper, LifePath>
|
||||
|
||||
LambdaQueryWrapper<LifePath> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LifePath::getUserId, currentUserId)
|
||||
.eq(LifePath::getScriptId, scriptId)
|
||||
.eq(LifePath::getIsDeleted, 0);
|
||||
.eq(LifePath::getScriptId, scriptId);
|
||||
|
||||
List<LifePath> paths = this.list(wrapper);
|
||||
for (LifePath path : paths) {
|
||||
path.setIsDeleted(1);
|
||||
this.updateById(path);
|
||||
}
|
||||
return true;
|
||||
// 使用 MyBatis-Plus 的 remove 方法,自动处理逻辑删除
|
||||
return this.remove(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user