Showing
2 changed files
with
11 additions
and
11 deletions
| @@ -45,7 +45,7 @@ public class BackupMaterialController { | @@ -45,7 +45,7 @@ public class BackupMaterialController { | ||
| 45 | * @author W5669 | 45 | * @author W5669 |
| 46 | * @date 2025/7/24 | 46 | * @date 2025/7/24 |
| 47 | * @param backupFile | 47 | * @param backupFile |
| 48 | - * @param backupUploadVo | 48 | + * @param materialUploadVo |
| 49 | * @return ResultBean | 49 | * @return ResultBean |
| 50 | */ | 50 | */ |
| 51 | @PostMapping("add") | 51 | @PostMapping("add") |
| @@ -54,11 +54,9 @@ public class BackupMaterialController { | @@ -54,11 +54,9 @@ public class BackupMaterialController { | ||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| 57 | - * @description 素材库新增 | 57 | + * @description 素材删除 |
| 58 | * @author W5669 | 58 | * @author W5669 |
| 59 | * @date 2025/8/19 | 59 | * @date 2025/8/19 |
| 60 | - * @param backupFile | ||
| 61 | - * @param backupUploadVo | ||
| 62 | * @return ResultBean | 60 | * @return ResultBean |
| 63 | */ | 61 | */ |
| 64 | @PostMapping("delete") | 62 | @PostMapping("delete") |
| @@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse; | @@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse; | ||
| 8 | import cn.hutool.json.JSONUtil; | 8 | import cn.hutool.json.JSONUtil; |
| 9 | import com.alibaba.fastjson.JSON; | 9 | import com.alibaba.fastjson.JSON; |
| 10 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 10 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 11 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||
| 11 | import com.baomidou.mybatisplus.core.metadata.IPage; | 12 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| 12 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 13 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 13 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 14 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| @@ -74,10 +75,9 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper, | @@ -74,10 +75,9 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper, | ||
| 74 | Integer page = backupMaterialDto.getPage(); | 75 | Integer page = backupMaterialDto.getPage(); |
| 75 | Integer size = backupMaterialDto.getSize(); | 76 | Integer size = backupMaterialDto.getSize(); |
| 76 | 77 | ||
| 77 | - | ||
| 78 | - | ||
| 79 | LambdaQueryWrapper<BackupMaterial> queryWrapper = new LambdaQueryWrapper<>(); | 78 | LambdaQueryWrapper<BackupMaterial> queryWrapper = new LambdaQueryWrapper<>(); |
| 80 | 79 | ||
| 80 | + queryWrapper.eq(BackupMaterial::getDel, 0); | ||
| 81 | if (ObjectUtil.isNotEmpty(backupMaterialDto.getId())){ | 81 | if (ObjectUtil.isNotEmpty(backupMaterialDto.getId())){ |
| 82 | queryWrapper.eq(BackupMaterial::getId,backupMaterialDto.getId()); | 82 | queryWrapper.eq(BackupMaterial::getId,backupMaterialDto.getId()); |
| 83 | } | 83 | } |
| @@ -366,11 +366,13 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper, | @@ -366,11 +366,13 @@ public class BackupMaterialServiceImpl extends ServiceImpl<BackupMaterialMapper, | ||
| 366 | 366 | ||
| 367 | @Override | 367 | @Override |
| 368 | public ResultBean batchDelete(Long[] ids) { | 368 | public ResultBean batchDelete(Long[] ids) { |
| 369 | - LambdaQueryWrapper<BackupMaterial> wrapper = new LambdaQueryWrapper<>(); | ||
| 370 | - wrapper.in(BackupMaterial::getId,ids); | ||
| 371 | - int i = backupMaterialMapper.delete(wrapper); | ||
| 372 | - log.info("删除素材库记录条数:{}", i); | ||
| 373 | - return i > 0 ? ResultBean.ok() : ResultBean.error(); | 369 | + // 创建更新条件构造器 |
| 370 | + LambdaUpdateWrapper<BackupMaterial> updateWrapper = new LambdaUpdateWrapper<>(); | ||
| 371 | + updateWrapper.in(BackupMaterial::getId, ids); | ||
| 372 | + updateWrapper.set(BackupMaterial::getDel, 1); | ||
| 373 | + int rows = backupMaterialMapper.update(null, updateWrapper); | ||
| 374 | + log.info("删除素材库记录条数:{}", rows); | ||
| 375 | + return rows > 0 ? ResultBean.ok() : ResultBean.error(); | ||
| 374 | } | 376 | } |
| 375 | 377 | ||
| 376 | } | 378 | } |
-
Please register or login to post a comment