添加了项目初始化模块的方法
This commit is contained in:
parent
54ab37e8a0
commit
5ba93d87f1
@ -40,7 +40,8 @@ public class ApplicationController {
|
|||||||
* 新增应用
|
* 新增应用
|
||||||
*/
|
*/
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public ResponseResult save(@RequestBody Application application) {return ResponseResult.successData(applicationService.save(application));
|
public ResponseResult save(@RequestBody Application application) {
|
||||||
|
return ResponseResult.successData(applicationService.createApplication(application));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @since 2025-03-24
|
* @since 2025-03-24
|
||||||
*/
|
*/
|
||||||
public interface IApplicationService extends IService<Application> {
|
public interface IApplicationService extends IService<Application> {
|
||||||
|
public boolean createApplication(Application application);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,10 @@ import io.gisbi.application.baseinfo.domain.Application;
|
|||||||
import io.gisbi.application.baseinfo.mapper.ApplicationMapper;
|
import io.gisbi.application.baseinfo.mapper.ApplicationMapper;
|
||||||
import io.gisbi.application.baseinfo.service.IApplicationService;
|
import io.gisbi.application.baseinfo.service.IApplicationService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import io.gisbi.application.module.service.IModuleService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -16,5 +19,13 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Application> implements IApplicationService {
|
public class ApplicationServiceImpl extends ServiceImpl<ApplicationMapper, Application> implements IApplicationService {
|
||||||
|
@Resource
|
||||||
|
private IModuleService moduleService;
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean createApplication(Application application) {
|
||||||
|
this.save(application);
|
||||||
|
moduleService.initAppModules(application.getId());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,4 +155,18 @@ public class Module implements Serializable {
|
|||||||
* 备用3
|
* 备用3
|
||||||
*/
|
*/
|
||||||
private String custom3;
|
private String custom3;
|
||||||
|
|
||||||
|
public Module(String appId,String name,String pid,Integer level,String nodeType,String type,Integer status,Integer sort,LocalDateTime createTime,String createBy){
|
||||||
|
|
||||||
|
this.appId = appId;
|
||||||
|
this.name = name;
|
||||||
|
this.pid = pid;
|
||||||
|
this.level = level;
|
||||||
|
this.nodeType = nodeType;
|
||||||
|
this.type = type;
|
||||||
|
this.status = status;
|
||||||
|
this.sort = sort;
|
||||||
|
this.createTime = createTime;
|
||||||
|
this.createBy = createBy;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,10 @@ public interface IModuleService extends IService<Module> {
|
|||||||
*/
|
*/
|
||||||
boolean existsChildrenByPid(String appId,String pid);
|
boolean existsChildrenByPid(String appId,String pid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增项目时,初始化创建项目模块
|
||||||
|
* @param appId 项目ID
|
||||||
|
* @return 存在返回true
|
||||||
|
*/
|
||||||
|
boolean initAppModules(String appId);
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,13 @@ import io.gisbi.application.module.domain.Module;
|
|||||||
import io.gisbi.application.module.mapper.ModuleMapper;
|
import io.gisbi.application.module.mapper.ModuleMapper;
|
||||||
import io.gisbi.application.module.service.IModuleService;
|
import io.gisbi.application.module.service.IModuleService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import io.gisbi.engine.utils.DateUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 应用_系统模块 服务实现类
|
* 应用_系统模块 服务实现类
|
||||||
@ -24,4 +29,35 @@ public class ModuleServiceImpl extends ServiceImpl<ModuleMapper, Module> impleme
|
|||||||
return this.count(new LambdaQueryWrapper<Module>()
|
return this.count(new LambdaQueryWrapper<Module>()
|
||||||
.eq(Module::getAppId, appId).eq(Module::getPid, pid)) > 0;
|
.eq(Module::getAppId, appId).eq(Module::getPid, pid)) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean initAppModules(String appId) {
|
||||||
|
// 01:登录页面 02:主框架页面 03:GIS大屏页面 04:二级弹窗页面 05:数据填报页面 06:文档资源页面 09:自定义页面
|
||||||
|
List<Module> list=new ArrayList<>();
|
||||||
|
list.add(createInitModule(appId,"登录页面","01",1));
|
||||||
|
list.add(createInitModule(appId,"主框架页面","02",2));
|
||||||
|
list.add(createInitModule(appId,"GIS大屏页面","03",3));
|
||||||
|
list.add(createInitModule(appId,"二级弹窗页面","04",4));
|
||||||
|
list.add(createInitModule(appId,"数据填报页面","05",5));
|
||||||
|
list.add(createInitModule(appId,"文档资源页面","06",6));
|
||||||
|
list.add(createInitModule(appId,"自定义页面","09",9));
|
||||||
|
boolean isok=this.saveBatch(list);
|
||||||
|
return isok;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Module createInitModule(String appId,String name,String type,Integer sort){
|
||||||
|
Module initModule=new Module(
|
||||||
|
appId,
|
||||||
|
name,
|
||||||
|
"00",
|
||||||
|
1,
|
||||||
|
"01",
|
||||||
|
type,
|
||||||
|
0,
|
||||||
|
sort,
|
||||||
|
LocalDateTime.now(),
|
||||||
|
"初始化"
|
||||||
|
);
|
||||||
|
return initModule;
|
||||||
|
}
|
||||||
}
|
}
|
@ -35,14 +35,11 @@ public class SwaggerConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
public OpenAPI customOpenAPI() {
|
public OpenAPI customOpenAPI() {
|
||||||
Contact contact = new Contact();
|
Contact contact = new Contact();
|
||||||
contact.setName("DataEase");
|
contact.setName("GIS-BI");
|
||||||
contact.setUrl("https://www.fit2cloud.com/dataease/index.html");
|
|
||||||
contact.setEmail("dataease@fit2cloud.com");
|
|
||||||
return new OpenAPI()
|
return new OpenAPI()
|
||||||
.info(new Info()
|
.info(new Info()
|
||||||
.title("DataEaseAPI")
|
.title("GIS-BIAPI")
|
||||||
.description("人人可用的开源 BI 工具")
|
.description("gis-bi工具")
|
||||||
.termsOfService("https://dataease.io")
|
|
||||||
.contact(contact)
|
.contact(contact)
|
||||||
.version(version));
|
.version(version));
|
||||||
}
|
}
|
||||||
@ -92,5 +89,13 @@ public class SwaggerConfig {
|
|||||||
return GroupedOpenApi.builder().group("8-xpacksync").displayName("同步管理").packagesToScan("io.dataease.xpack.sync.task").build();
|
return GroupedOpenApi.builder().group("8-xpacksync").displayName("同步管理").packagesToScan("io.dataease.xpack.sync.task").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public GroupedOpenApi applicationApi() {
|
||||||
|
return GroupedOpenApi.builder()
|
||||||
|
.group("9-application")
|
||||||
|
.displayName("应用管理")
|
||||||
|
.packagesToScan("io.gisbi.application**")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user