提交 f8ac6c7d 编写于 作者: sq3536's avatar sq3536

重新实现deployId

上级 c1743083
......@@ -156,7 +156,7 @@
<dependency>
<groupId>net.ibizsys.plugin</groupId>
<artifactId>ibiz-model</artifactId>
<version>8.1.0.132</version>
<version>8.1.0.181</version>
<exclusions>
<exclusion>
<artifactId>slf4j-simple</artifactId>
......
package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.StringAdvUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
......@@ -303,6 +304,15 @@ public class CtrlModel extends BaseModel{
return false;
}
public String getApiModelName()
{
if(appEntity!=null&&appEntity.getEntity()!=null) {
return StringAdvUtils.pascalcase(appEntity.getEntity().getCodeName())+StringAdvUtils.pascalcase(getCodeName());
}
return StringAdvUtils.pascalcase(getCodeName());
}
private List<VoFieldModel> voItems;
public List<VoFieldModel> getVoItems()
......
......@@ -49,14 +49,22 @@ public class SystemModel extends BaseModel {
this.setName(system.getName());
this.setProjectName(this.pub.getCodeName().toLowerCase());
this.setProjectDesc(StringAdvUtils.pascalcase(this.pub.getCodeName().toLowerCase()));
this.setMemo(StringUtils.isEmpty(pub.getMemo())?pub.getName():pub.getMemo());
this.setPackageName(this.pub.getPKGCodeName());
this.setModelFolder((StringUtils.isEmpty(this.pub.getModelFolder())?"model":this.pub.getModelFolder()));
} else {
this.setCodeName(system.getCodeName());
this.setName(system.getName());
this.setProjectName(system.getCodeName().toLowerCase());
this.setProjectDesc(system.getName());
this.setMemo(StringUtils.isEmpty(system.getLogicName())?system.getName():system.getLogicName());
this.setPackageName(system.getCodeName().toLowerCase());
this.setModelFolder("model");
}
if(StringUtils.isEmpty(system.getDeploySysId())||system.getDeploySysId().length()>16)
this.setDeploySysId(this.getName());
else
this.setDeploySysId(system.getDeploySysId());
getEntitiesMap();
getSubServiceApiMap();
}
......@@ -73,6 +81,12 @@ public class SystemModel extends BaseModel {
private String modelFolderPath;
private String memo;
private String deploySysId;
private String modelFolder;
private boolean enableDS = false;
private boolean enableES = false;
private boolean enableMongo = false;
......@@ -183,13 +197,22 @@ public class SystemModel extends BaseModel {
private Map<String, AppModel> appsMap;
private AppModel defaultApp;
private ApiModel defaultApi;
public synchronized Map<String, AppModel> getAppsMap() {
if (appsMap == null) {
appsMap = new LinkedHashMap<>();
if (getSystem().getAllPSApps() != null) {
getSystem().getAllPSApps().forEach(item -> {
appsMap.put(item.getCodeName(), new AppModel(item).setSystem(this));
AppModel appModel=new AppModel(item).setSystem(this);
if(item.getDefaultFlag())
defaultApp=appModel;
appsMap.put(item.getCodeName(),appModel);
});
if(defaultApp==null)
defaultApp=appsMap.values().iterator().next();
}
}
return appsMap;
......@@ -206,8 +229,12 @@ public class SystemModel extends BaseModel {
try {
apisMap = new LinkedHashMap<>();
getSystem().getAllPSSysServiceAPIs().forEach(api -> {
apisMap.put(api.getCodeName(), new ApiModel(api).setSystem(this));
ApiModel apiModel=new ApiModel(api).setSystem(this);
defaultApi=apiModel;
apisMap.put(api.getCodeName(), apiModel);
});
if(defaultApi==null)
defaultApi=apisMap.values().iterator().next();
} catch (Exception e) {
}
......@@ -221,7 +248,7 @@ public class SystemModel extends BaseModel {
if(apiProfileId==null)
{
if(!ObjectUtils.isEmpty(getApisMap())){
apiProfileId=apisMap.values().iterator().next().getCodeName();
apiProfileId=getDefaultApi().getCodeName();
}
}
return apiProfileId;
......
......@@ -11,7 +11,7 @@ import cn.ibizlab.util.annotation.SwaggerDisplayEnum;
/**
* 字典:{{dict.name}}
*/
@SwaggerDisplayEnum
@SwaggerDisplayEnum{{#eq dict.valueType "Integer"}}(type = Integer.class){{/eq}}
@ApiModel(value = "字典:{{dict.name}}", description = "{{dict.codeName}}")
public enum {{pascalCase dict.codeName}}Dict {
......
......@@ -29,7 +29,7 @@ import {{packageName}}.api.{{apps}}.dict.*;
* {{ctrl.appEntity.entity.logicName}}AddDTO对象[{{ctrl.codeName}}]{{replace ctrl.logicName "表单" ""}}
*/
@Data
@ApiModel(value = "{{ctrl.appEntity.entity.logicName}}AddDTO对象-{{pascalCase ctrl.codeName}}AddDto]-{{replace ctrl.logicName "表单" ""}}", description = "{{ctrl.appEntity.entity.codeName}}-{{ctrl.codeName}}-Add")
@ApiModel(value = "{{ctrl.apiModelName}}AddDto", description = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}AddDto-{{replace ctrl.logicName "表单" ""}}")
public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeName}}BaseDto {
private static final long serialVersionUID = 1L;
......
......@@ -29,7 +29,7 @@ import {{packageName}}.api.{{apps}}.dict.*;
* {{ctrl.appEntity.entity.logicName}}BaseDTO对象[{{ctrl.codeName}}]{{replace ctrl.logicName "表单" ""}}
*/
@Data
@ApiModel(value = "{{ctrl.appEntity.entity.logicName}}BaseDTO对象-{{pascalCase ctrl.codeName}}BaseDto-{{replace ctrl.logicName "表单" ""}}", description = "{{ctrl.appEntity.entity.codeName}}-{{ctrl.codeName}}-Base")
@ApiModel(value = "{{ctrl.apiModelName}}BaseDto", description = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}BaseDto-{{replace ctrl.logicName "表单" ""}}")
public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -44,6 +44,9 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
@DateTimeFormat(pattern = "{{format}}")
{{/timeType}}
{{#if dict}}
@JsonFormat(shape = JsonFormat.Shape.{{#if singleSelect}}{{#eq type.java "String"}}STRING{{/eq}}{{#eq type.java "Integer"}}NUMBER{{/eq}}{{else}}STRING{{/if}})
{{/if}}
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
......
......@@ -29,7 +29,7 @@ import {{packageName}}.api.{{apps}}.dict.*;
* {{ctrl.appEntity.entity.logicName}}DTO对象[{{ctrl.codeName}}]{{replace ctrl.logicName "表单" ""}}
*/
@Data
@ApiModel(value = "{{ctrl.appEntity.entity.logicName}}DTO对象-{{pascalCase ctrl.codeName}}Dto-{{replace ctrl.logicName "表单" ""}}", description = "{{ctrl.appEntity.entity.codeName}}-{{ctrl.codeName}}")
@ApiModel(value = "{{ctrl.apiModelName}}Dto", description = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}Dto-{{replace ctrl.logicName "表单" ""}}")
public class {{pascalCase ctrl.codeName}}Dto extends {{pascalCase ctrl.codeName}}BaseDto {
private static final long serialVersionUID = 1L;
......
......@@ -29,7 +29,7 @@ import {{packageName}}.api.{{apps}}.dict.*;
* {{ctrl.appEntity.entity.logicName}}UpdateDTO对象[{{ctrl.codeName}}]{{replace ctrl.logicName "表单" ""}}
*/
@Data
@ApiModel(value = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}UpdateDto-{{replace ctrl.logicName "表单" ""}}", description = "{{ctrl.appEntity.entity.codeName}}-{{ctrl.codeName}}-Update")
@ApiModel(value = "{{ctrl.apiModelName}}UpdateDto", description = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}UpdateDto-{{replace ctrl.logicName "表单" ""}}")
public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.codeName}}BaseDto {
private static final long serialVersionUID = 1L;
......
......@@ -7,7 +7,7 @@
<groupId>{{packageName}}</groupId>
<version>{{system.pub.versionString}}</version>
<name>{{projectDesc}}</name>
<description>{{#if system.pub.memo}}{{system.pub.memo}}{{else}}{{system.pub.name}}{{/if}}</description>
<description>{{system.memo}}</description>
<packaging>pom</packaging>
<parent>
......
......@@ -11,7 +11,7 @@
<artifactId>{{projectName}}-core</artifactId>
<name>{{projectDesc}} Code</name>
<description>{{projectDesc}} Core,模板生成代码,再次发布会覆盖,建议不要直接修改,修改请在{{projectName}}-provider项目中重写</description>
<description>{{system.memo}} Core,模板生成代码,再次发布会覆盖,建议不要直接修改,修改请在{{projectName}}-provider项目中继承或覆盖重写</description>
<dependencies>
<dependency>
......
......@@ -14,7 +14,7 @@ public class SystemRuntimeBase extends BootSystemRuntime implements ISystemRunti
@Override
public String getName() {
return "{{system.pub.name}}";
return "{{system.deploySysId}}";
}
@Override
......
......@@ -12,6 +12,7 @@
<groupId>{{packageName}}</groupId>
<artifactId>{{projectName}}-provider</artifactId>
<version>{{system.pub.versionString}}</version>
<description>{{system.memo}} Provider</description>
<dependencies>
<dependency>
......@@ -26,40 +27,6 @@
</properties>
<profiles>
<profile>
<id>boot</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>{{projectName}}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>{{packageName}}.IBizRuntimeApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>{{lowerCase system.apiProfileId}}</id>
<build>
......@@ -73,7 +40,6 @@
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
......@@ -177,7 +143,32 @@
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>{{projectName}}-provider</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>{{packageName}}.IBizRuntimeApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-plugin</artifactId>
......@@ -187,7 +178,7 @@
../
</output>
<inputSpec>
../{{projectName}}-core/src/main/resources/model/{{replace packageName "." "/"}}
../{{system.modelFolder}}
</inputSpec>
<templateDirs>
${basedir}/src/main/resources/templ
......
......@@ -36,12 +36,12 @@ ibiz:
serviceurl: ${zookeeper.address:127.0.0.1:2181}
cache:
serviceurl: ${spring.redis.host:127.0.0.1}:${spring.redis.port:6379}
{{lowerCase system.pub.name}}:
{{lowerCase system.deploySysId}}:
runtimeClassName: {{packageName}}.runtime.SystemRuntime
settings:
sysdbscheme:
default:
datasource: {{lowerCase system.pub.name}}__default
datasource: {{lowerCase system.deploySysId}}__default
dbtype: ${spring.datasource.dbtype:MYSQL}
{{#if system.subServiceApiModules}}
subsysserviceapi:
......@@ -54,7 +54,7 @@ ibiz:
{{/each}}
{{/if}}
servicehub:
id: {{lowerCase system.pub.name}}
id: {{lowerCase system.deploySysId}}
register-naming-service: true
publish-config: true
enableAppGateway: true
......@@ -64,7 +64,7 @@ ibiz:
fileFolder: ${ibiz.filePath:/app/file/}
loadDeploySystems:
- gateway
- {{lowerCase system.pub.name}}
- {{lowerCase system.deploySysId}}
systemSettings:
cloudclientutil:
serviceurl: lb://ebsx-oldapi
......
......@@ -7,7 +7,7 @@
<groupId>{{packageName}}</groupId>
<version>{{system.pub.versionString}}</version>
<name>{{projectDesc}}</name>
<description></description>
<description>{{system.memo}}</description>
<packaging>pom</packaging>
<parent>
......
......@@ -11,7 +11,7 @@
<artifactId>{{projectName}}-core</artifactId>
<name>{{projectDesc}} Core</name>
<description>{{projectDesc}} Core</description>
<description>{{system.memo}} Core,模板生成代码,再次发布会覆盖,建议不要直接修改,修改请在{{projectName}}-boot项目中继承或覆盖重写</description>
<dependencies>
......
.__ ___. .__ .____ ___.
|__|\_ |__ |__|________| | _____ \_ |__
| | | __ \ | |\___ /| | \__ \ | __ \
| | | \_\ \| | / / | |___ / __ \_| \_\ \
|__| |___ /|__|/_____ \|_______ \(____ /|___ /
\/ \/ \/ \/ \/
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册