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

便捷操作

上级 4be084b0
......@@ -28,8 +28,7 @@ import java.util.*;
public class EntityModel extends BaseModel {
private SystemModel system;
public String getEntityName() {
......@@ -342,11 +341,14 @@ public class EntityModel extends BaseModel {
return extParams.getStringValue(key,defaultVal);
}
private boolean hasResetField=false;
public EntityModel(IPSDataEntity dataEntity)
public EntityModel(SystemModel systemModel,IPSDataEntity dataEntity)
{
Assert.notNull(dataEntity,"未找到对应的实体模型:"+dataEntity.getId());
this.opt=dataEntity;
this.system=systemModel;
this.setCodeName(dataEntity.getCodeName());
this.setName(dataEntity.getName());
this.setStorageMode(dataEntity.getStorageMode());
......@@ -355,7 +357,16 @@ public class EntityModel extends BaseModel {
if(dataEntity.getAllPSDEDBConfigs()!=null)
{
dataEntity.getAllPSDEDBConfigs().forEach(item->{
dsTypes.add(item.getDBType().toLowerCase().replace("mysql5","mysql"));
String dbType=item.getDBType().toLowerCase().replace("mysql5","mysql");
if("mysql".equals(dbType))
system.setEnableMysql(true);
else if("oracle".equals(dbType))
system.setEnableOracle(true);
else if("postgresql".equals(dbType))
system.setEnablePostgreSQL(true);
else if("dameng".equals(dbType)||"dm".equals(dbType))
system.setEnableDameng(true);
dsTypes.add(dbType);
if(!this.getTableName().equalsIgnoreCase(item.getTableName()))
this.set("table-"+item.getDBType().toLowerCase().replace("mysql5","mysql"),item.getTableName());
});
......@@ -424,6 +435,9 @@ public class EntityModel extends BaseModel {
String dict=null;
try { dict=defield.getPSCodeList()!=null?defield.getPSCodeList().getCodeName():null; } catch (Exception ex){}
if(defield.isPasteReset())
this.hasResetField=true;
FieldModel fieldModel=new FieldModel(this,defield);
if(defield.getAllPSDEFDTColumns()!=null)
......
......@@ -33,6 +33,10 @@ public class SystemModel extends BaseModel {
public SystemModel(IPSSystem system)
{
this.opt=system;
getEntitiesMap();
system.getAllPSSystemModules().forEach(item->{
});
}
public IPSSystem getSystem()
......@@ -55,12 +59,29 @@ public class SystemModel extends BaseModel {
return getSystem().getCodeName().toLowerCase();
}
private boolean enableDS=false;
private boolean enableES=false;
private boolean enableMQ=false;
private boolean enableOAuth2=false;
private boolean enableGlobalTransaction=false;
private boolean enableMysql=false;
private boolean enableOracle=false;
private boolean enableDameng=false;
private boolean enablePostgreSQL=false;
private boolean enableDyna=false;
private Map<String,EntityModel> entitiesMap;
public synchronized Map<String, EntityModel> getEntitiesMap() {
if(entitiesMap==null) {
entitiesMap = new LinkedHashMap<>();
getSystem().getAllPSDataEntities().forEach(dataEntity -> {
entitiesMap.put(dataEntity.getCodeName(),new EntityModel(dataEntity));
getSystem().getAllPSDataEntities().forEach(entity -> {
if((entity.getStorageMode()==1 || entity.getStorageMode()==2) && "DEFAULT".equals(entity.getDSLink()))
enableDS=true;
if("elasticsearch".equalsIgnoreCase(entity.getUserTag()))
enableES=true;
if(!ObjectUtils.isEmpty(entity.getAllPSDEDataSyncs()))
enableMQ=true;
entitiesMap.put(entity.getCodeName(),new EntityModel(this,entity));
});
}
return entitiesMap;
......
......@@ -98,6 +98,30 @@
<artifactId>jobs-spring-boot-starter</artifactId>
</dependency>
{{#system.enableGlobalTransaction}}
<!-- 阿里seata分布式事务 -->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
{{/system.enableGlobalTransaction}}
</dependencies>
......
package {{packageName}}.{{module}}.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import {{packageName}}.util.domain.EntityBase;
import {{packageName}}.util.annotation.DEField;
import {{packageName}}.util.enums.DEPredefinedFieldType;
import {{packageName}}.util.enums.DEFieldDefaultValueType;
import {{packageName}}.util.helper.DataObject;
import {{packageName}}.util.enums.DupCheck;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import {{packageName}}.util.annotation.Audit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import {{packageName}}.util.domain.EntityMP;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "{{entity.tableName}}", resultMap = "{{entity.codeName}}ResultMap")
@ApiModel("{{entity.logicName}}")
public class {{entity.codeName}} extends EntityMP implements Serializable
{
{{#entity.fields}}
private {{type.java}} {{codeName.camelCase}};
{{/entity.fields}}
}
\ No newline at end of file
package {{packageName}}.{{module}}.domain;
// {{entity.dataAccCtrlArch}}
public class {{entity.codeName}}
{
{{#pascalcase}}{{entity.codeName}}{{/pascalcase}}
{{#camelcase}}{{entity.codeName}}{{/camelcase}}
{{#snakecase}}{{entity.codeName}}{{/snakecase}}
{{#snakecase}}SNAKECASE{{/snakecase}}
{{#snakecase}}snakeCase{{/snakecase}}
{{#snakecase}}snake_case{{/snakecase}}
{{#camelcase}}camelCase{{/camelcase}}
{{#camelcase}}Camel_case{{/camelcase}}
{{#camelcase}}CAMELCase{{/camelcase}}
{{#camelcase}}CAMELCASE{{/camelcase}}
{{#pascalcase}}camel_case{{/pascalcase}}
}
\ No newline at end of file
......@@ -83,8 +83,16 @@
<!-- 阿里seata分布式事务 -->
<alibaba-seata.version>1.3.0</alibaba-seata.version>
{{#system.enableOracle}}
<oracle.version>19.8.0.0</oracle.version>
{{/system.enableOracle}}
{{#system.enablePostgreSQL}}
<postgresql.version>42.2.6</postgresql.version>
{{/system.enablePostgreSQL}}
{{#system.enableMQ}}
<rocketmq.version>4.7.0</rocketmq.version>
{{/system.enableMQ}}
<flowable-modeler.version>6.4.2</flowable-modeler.version>
</properties>
......@@ -333,6 +341,37 @@
<version>${eureka-client.version}</version>
</dependency>
{{#system.enableDS}}
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
</dependency>
{{/system.enableDS}}
{{#system.enableES}}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
{{/system.enableES}}
{{#system.enableMQ}}
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
{{/system.enableMQ}}
{{#system.enableGlobalTransaction}}
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.6.RELEASE</version>
</dependency>
{{/system.enableGlobalTransaction}}
{{#system.enableOracle}}
<!-- Oracle驱动包 -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
......@@ -344,18 +383,22 @@
<artifactId>orai18n</artifactId>
<version>${oracle.version}</version>
</dependency>
{{/system.enableOracle}}
{{#system.enablePostgreSQL}}
<!-- PostgreSQL驱动包 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
{{/system.enablePostgreSQL}}
{{#system.enableMysql}}
<!-- MySQL驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
{{/system.enableMysql}}
</dependencies>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册