逻辑删除文件时,同时删除文件关系

This commit is contained in:
s2042968 2025-02-14 09:40:35 +08:00
parent 731b920547
commit 4faab3d89b
2 changed files with 13 additions and 5 deletions

View File

@ -26,6 +26,7 @@ import com.electromagnetic.industry.software.common.util.*;
import com.electromagnetic.industry.software.manage.mapper.EdFileInfoMapper;
import com.electromagnetic.industry.software.manage.mapper.UserMapper;
import com.electromagnetic.industry.software.manage.pojo.models.EdFileInfo;
import com.electromagnetic.industry.software.manage.pojo.models.EdFileRelation;
import com.electromagnetic.industry.software.manage.pojo.models.User;
import com.electromagnetic.industry.software.manage.pojo.other.FileInfoVO;
import com.electromagnetic.industry.software.manage.pojo.other.UploadRecordDTO;
@ -71,7 +72,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
private PermissionService permissionService;
@Resource
private UserMapper userMapper;
@Resource
private EdFileRelationServiceImpl edFileRelationService;
private String downloadDataDir = "";
private String uploadDataDir = "";
@ -211,6 +213,12 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
.set(EdFileInfo::getEffectFlag, false)
.set(EdFileInfo::getAllDeleted, true)
.eq(EdFileInfo::getFileId, fileInfo.getFileId()));
// 删除文件时同时删除其关联关系
edFileRelationService.remove(Wrappers.lambdaQuery(EdFileRelation.class)
.eq(EdFileRelation::getId1, id)
.or()
.eq(EdFileRelation::getId2, id));
return ElectromagneticResultUtil.success(true);
}

View File

@ -1,9 +1,9 @@
#required
spring.application.name=electromagnetic-data
spring.datasource.typd=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql://139.224.43.89:3306/em_data?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true
spring.datasource.username=comac
spring.datasource.password=2024*Comac
spring.datasource.url=jdbc:mysql://139.196.179.195:3306/em_user_test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true&rewriteBatchedStatements=true
spring.datasource.username=em_user_test
spring.datasource.password=Szsd#2O25$test
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
mybatis-plus.mapper-locations=classpath:sqlmapper/*.xml
@ -14,7 +14,7 @@ pagehelper.helperDialect=mysql
pagehelper.reasonable=false
server.port=12395
file.security.passwd=adknfhkj87654knd
#windows文件存储目录,用于测试
#windows文件存储目录,用于测试
data.windows.path=D:/tmp/eleData/project/
data.linux.path=/szsd/data/eleData/project/
data.upload.windows.tmp.path=D:/tmp/eleData/upload/