优化规则文件,优化文件删除日志记录

This commit is contained in:
2026-05-20 16:02:13 +08:00
parent 3ad5a74b74
commit af1d0eb74b
2 changed files with 8 additions and 5 deletions

View File

@@ -117,7 +117,7 @@ xtools-app-{module}-biz/
#### 3.1 注解使用规范
- 控制器类使用`@RestController`注解
- 服务实现类使用`@Service``@Primary`注解
- 服务实现类使用`@Service`注解实现API接口时需添加`@Primary`注解
- BaseService类使用`@Component`注解
- Mapper接口使用`@Mapper`注解
- 转换器接口使用`@Mapper(componentModel = "spring")`注解MapStruct
@@ -129,7 +129,7 @@ xtools-app-{module}-biz/
#### 3.2 继承关系规范
- BaseService类继承`ServiceImpl<Mapper, Entity>`MyBatis Plus使用`@Component`注解
- ServiceImpl类实现Service接口注入BaseService和Convert进行业务操作
- ServiceImpl类实现Service接口注入BaseService和Convert进行业务操作实现API接口时需添加`@Primary`注解
- Controller类通过构造器注入Service接口
- API接口定义为Java interface方法返回`Result<T>`
- 实体类继承`BaseEntity`(来自`xtools.boot.api.model.entity.BaseEntity`
@@ -179,7 +179,7 @@ xtools-app-{module}-biz/
- 主键策略统一使用`IdType.ASSIGN_ID`
#### 4.4 Mapper规范
- Mapper接口继承`BaseMapper<Entity>`MyBatis Plus
- Mapper接口按需继承`BaseMapper<Entity>`MyBatis Plus并非所有Mapper都需要继承
- 使用`@Mapper`注解
- 复杂查询使用MyBatis XML映射文件放置在`resources/mapper/`目录下
- XML中使用`LambdaQueryWrapper`或动态SQL`<where>``<if>``<foreach>`
@@ -272,10 +272,10 @@ xtools-app-{module}-biz/
#### 8.2 代码生成检查清单
- [ ] 实体类继承`BaseEntity`,使用`IdType.ASSIGN_ID`主键策略
- [ ] Mapper继承`BaseMapper<Entity>`,使用`@Mapper`注解
- [ ] 需要CRUD操作的Mapper继承`BaseMapper<Entity>`,使用`@Mapper`注解
- [ ] BaseService继承`ServiceImpl<Mapper, Entity>`,使用`@Component`注解
- [ ] Service接口定义返回`Result<T>`的完整CRUD方法
- [ ] ServiceImpl使用`@Service``@Primary``@RequiredArgsConstructor`注解
- [ ] ServiceImpl使用`@Service``@RequiredArgsConstructor`注解实现API接口时需添加`@Primary`注解
- [ ] Convert使用`@Mapper(componentModel = "spring")`注解
- [ ] Controller使用`@RestController``@Tag``@Operation`注解
- [ ] 所有DTO字段添加`@Schema`注解

View File

@@ -30,6 +30,7 @@ import xtools.boot.api.model.dto.req.IdListReq;
import xtools.boot.db.mybatisplus.utils.QueryUtils;
import xtools.boot.log.LogBus;
import xtools.boot.log.enums.LogBusBaseType;
import xtools.boot.log.holder.LogTrackHolder;
import xtools.boot.storage.base.config.StorageConfig;
import xtools.boot.storage.base.service.StorageService;
import xtools.boot.task.TaskBus;
@@ -361,6 +362,7 @@ public class SysFileServiceImpl implements SysFileService, BaseParams {
}
String type = storageConfig.getType();
Set<Long> ids = new HashSet<>(list.size());
LogTrackHolder.saveLog(false);
for (SysFile item : list) {
if (!Objects.equals(type, item.getStorageType())) {
continue;
@@ -373,6 +375,7 @@ public class SysFileServiceImpl implements SysFileService, BaseParams {
}
ids.add(item.getId());
}
LogTrackHolder.saveLog(true);
return sysFileBaseService.getBaseMapper().deleteByIds(ids);
}