修改了项目删除方法。
This commit is contained in:
parent
6a4dac9a49
commit
09e9a041b1
@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IApplicationService extends IService<Application> {
|
||||
public boolean createApplication(Application application);
|
||||
public boolean removeById(String id);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.gisbi.application.baseinfo.mapper.ApplicationMapper;
|
||||
import io.gisbi.application.baseinfo.service.IApplicationService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.gisbi.application.module.service.IModuleService;
|
||||
import io.gisbi.utils.AuthUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -63,6 +64,7 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
|
||||
application.setType("01"); // 数据分析类项目
|
||||
application.setStatus("01"); // 初始创建
|
||||
application.setCreatedate(now);
|
||||
application.setLastmodifier(AuthUtils.getUser().getUserId().toString());
|
||||
application.setLastmodifydate(now);
|
||||
|
||||
// 保存应用并初始化模块
|
||||
@ -74,4 +76,14 @@ public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Appli
|
||||
throw new RuntimeException("创建应用失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean removeById(String id) {
|
||||
if (id == null || id.trim().isEmpty()) {
|
||||
this.removeById(id);
|
||||
moduleService.deleteAppModules(id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -26,4 +26,10 @@ public interface IModuleService extends IService<Module> {
|
||||
* @return 存在返回true
|
||||
*/
|
||||
boolean initAppModules(String appId);
|
||||
/**
|
||||
* 删除项目时,删除项目模块
|
||||
* @param appId 项目ID
|
||||
* @return 存在返回true
|
||||
*/
|
||||
boolean deleteAppModules(String appId);
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ public class ModuleServiceImpl extends ServiceImpl<ModuleMapper, Module> impleme
|
||||
return isok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Module createInitModule(String appId,String name,String type,Integer sort){
|
||||
Module initModule=new Module(
|
||||
appId,
|
||||
@ -61,4 +63,12 @@ public class ModuleServiceImpl extends ServiceImpl<ModuleMapper, Module> impleme
|
||||
);
|
||||
return initModule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteAppModules(String appId) {
|
||||
if(this.remove(new LambdaQueryWrapper<Module>().eq(Module::getAppId,appId))){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user