|
@@ -9,6 +9,8 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
@Service
|
|
@Service
|
|
public class ArchiveProjectConfigServiceImpl extends BaseServiceImpl<ArchiveProjectConfigMapper, ArchiveProjectConfig> implements IArchiveProjectConfigService {
|
|
public class ArchiveProjectConfigServiceImpl extends BaseServiceImpl<ArchiveProjectConfigMapper, ArchiveProjectConfig> implements IArchiveProjectConfigService {
|
|
|
|
|
|
@@ -20,17 +22,18 @@ public class ArchiveProjectConfigServiceImpl extends BaseServiceImpl<ArchiveProj
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public ArchiveProjectConfig getByProjectIdOrNew(Long projectId) {
|
|
public ArchiveProjectConfig getByProjectIdOrNew(Long projectId) {
|
|
- ArchiveProjectConfig config = baseMapper.selectOne(new LambdaQueryWrapper<ArchiveProjectConfig>().eq(ArchiveProjectConfig::getTenantId, SecureUtil.getTenantId()).eq(ArchiveProjectConfig::getProjectId, projectId));
|
|
|
|
- if (config == null) {
|
|
|
|
|
|
+ List<ArchiveProjectConfig> configs = baseMapper.selectList(new LambdaQueryWrapper<ArchiveProjectConfig>().eq(ArchiveProjectConfig::getTenantId, SecureUtil.getTenantId()).eq(ArchiveProjectConfig::getProjectId, projectId));
|
|
|
|
+ if (configs == null || configs.size() == 0) {
|
|
// 创建新对象
|
|
// 创建新对象
|
|
- config = new ArchiveProjectConfig();
|
|
|
|
|
|
+ ArchiveProjectConfig config = new ArchiveProjectConfig();
|
|
config.setTenantId(AuthUtil.getTenantId());
|
|
config.setTenantId(AuthUtil.getTenantId());
|
|
config.setProjectId(projectId);
|
|
config.setProjectId(projectId);
|
|
config.setFactorType("1,2,3,4,5"); // 设置默认值
|
|
config.setFactorType("1,2,3,4,5"); // 设置默认值
|
|
config.setProjectType(3);
|
|
config.setProjectType(3);
|
|
this.save(config); // 保存到数据库
|
|
this.save(config); // 保存到数据库
|
|
|
|
+ return config;
|
|
}
|
|
}
|
|
- return config;
|
|
|
|
|
|
+ return configs.get(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|