提交 59b72871 编写于 作者: ibiz4j's avatar ibiz4j

java core

上级 ae31d2f9
......@@ -10,9 +10,7 @@ import net.ibizsys.model.database.IPSDEFDTColumn;
import net.ibizsys.model.dataentity.IPSDataEntity;
import net.ibizsys.model.dataentity.defield.IPSDEField;
import net.ibizsys.model.dataentity.defield.IPSLinkDEField;
import net.ibizsys.model.dataentity.der.IPSDER1N;
import net.ibizsys.model.dataentity.der.IPSDERBase;
import net.ibizsys.model.dataentity.der.IPSDERInherit;
import net.ibizsys.model.dataentity.der.*;
import net.ibizsys.model.dataentity.ds.IPSDEDataQueryCodeCond;
import net.ibizsys.model.dataentity.ds.IPSDEDataSetGroupParam;
import net.ibizsys.model.dataentity.ds.PSDEDataSetGroupParamImpl;
......@@ -190,6 +188,8 @@ public class EntityModel extends BaseModel {
nesteds.forEach(item-> {
this.addRelEntity(item.getEntityCodeName(),item.getRelEntity());
});
if(this.indexRelation!=null)
this.addRelEntity(this.indexRelation.getEntityCodeName(),this.indexRelation.getRelEntity());
}
if(relEntitiesMap!=null)
return relEntitiesMap.values();
......@@ -278,12 +278,18 @@ public class EntityModel extends BaseModel {
public FieldModel getKeyField() {
if(fields!=null&&keyField==null)
for(FieldModel fieldModel:fields)
if(fields!=null&&keyField==null) {
for(FieldModel fieldModel:fields){
if(fieldModel.isKeyDEField()) {
keyField=fieldModel;
return keyField;
break;
}
}
if((!keyField.isPhisicalDEField())&&getUnionKeyFields().size()==1)
{
keyField=unionKeyFields.get(0);
}
}
return keyField;
}
......@@ -393,39 +399,55 @@ public class EntityModel extends BaseModel {
}
private RelationshipModel indexRelation;
public boolean isIndexSubDE()
{
if(this.getDataEntity().getMinorPSDERs()==null)
if(this.getIndexRelation()!=null)
return true;
return false;
}
public boolean isLogicInherit()
{
if(this.getIndexRelation()==null)
return false;
for(IPSDERBase MinorPSDER:this.getDataEntity().getMinorPSDERs())
IPSDERBase MinorPSDER = this.getIndexRelation().getDer();
if("DERINHERIT".equals(MinorPSDER.getDERType()) && MinorPSDER instanceof IPSDERInherit)
{
if("DERINHERIT".equals(MinorPSDER.getDERType())||"DERINDEX".equals(MinorPSDER.getDERType())&& MinorPSDER.getMajorPSDataEntity().getVirtualMode()!=3 && MinorPSDER.getMajorPSDataEntity().getIndexTypePSDEField()!=null)
{
return true;
}
return ((IPSDERInherit)MinorPSDER).isLogicInherit();
}
return false;
}
public boolean isEnableES()
{
return "elasticsearch".equalsIgnoreCase(this.getDataEntity().getUserTag());
}
public boolean isLogicInherit()
public boolean isHasPSDERsMapping()
{
if(this.getDataEntity().getMinorPSDERs()==null)
return false;
for(IPSDERBase MinorPSDER:this.getDataEntity().getMinorPSDERs())
if(this.getReferences()!=null)
{
if("DERINHERIT".equals(MinorPSDER.getDERType()) && MinorPSDER instanceof IPSDERInherit)
for(RelationshipModel rel:this.getReferences())
{
return ((IPSDERInherit)MinorPSDER).isLogicInherit();
if(((PSDER1NImpl)rel.getDer()).getPSDER1NDEFieldMaps()==null)
continue;
if(rel.getRelEntity().getStorage().equals("NONE"))
continue;
for(IPSDER1NDEFieldMap derField : ((PSDER1NImpl)rel.getDer()).getPSDER1NDEFieldMaps())
{
if(derField.getMapType().equals("COUNT") || derField.getMapType().equals("SUM")
|| derField.getMapType().equals("AVG") || derField.getMapType().equals("MAX") || derField.getMapType().equals("MIN"))
return true;
}
}
}
return false;
}
public boolean isEnableES()
{
return "elasticsearch".equalsIgnoreCase(this.getDataEntity().getUserTag());
}
public boolean isHasDupCheck()
{
if(this.getDefaultDataQuery()==null)
......@@ -582,15 +604,58 @@ public class EntityModel extends BaseModel {
if(der instanceof IPSDER1N)
{
IPSDER1N der1n=(IPSDER1N)der;
String relfieldname=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("name").asText();
String refFieldName=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("name").asText();
String refCodeName=refFieldName;
if(der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("codeName")!=null)
refCodeName=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("codeName").asText();
LookupModel lookupModel=new LookupModel().setRelationid(der.getId())
.setFieldname(der1n.getPickupDEFName()).setReffieldname(relfieldname);
.setFieldname(der1n.getPickupDEFName()).setCodeName(der1n.getPSPickupDEField().getCodeName()).setReffieldname(refFieldName).setRefCodeName(refCodeName);
rel.addLookup(lookupModel);
}
else if (der instanceof IPSDERIndex || der instanceof IPSDERInherit)
{
if(der.getMajorPSDataEntity().getKeyPSDEField()!=null)
{
LookupModel lookupModel = new LookupModel().setRelationid(der.getId())
.setFieldname(this.getKeyField().getName()).setCodeName(this.getKeyField().getCodeName())
.setReffieldname(der.getMajorPSDataEntity().getKeyPSDEField().getName()).setRefCodeName(der.getMajorPSDataEntity().getKeyPSDEField().getCodeName());
rel.addLookup(lookupModel);
}
if(der.getMajorPSDataEntity().getMajorPSDEField()!=null)
{
LookupModel lookupModel = new LookupModel().setRelationid(der.getId())
.setFieldname(this.getDataEntity().getMajorPSDEField().getName()).setCodeName(this.getDataEntity().getMajorPSDEField().getCodeName())
.setReffieldname(der.getMajorPSDataEntity().getMajorPSDEField().getName()).setRefCodeName(der.getMajorPSDataEntity().getMajorPSDEField().getCodeName());
rel.addLookup(lookupModel);
}
List<IPSDERIndexDEFieldMap> map = ((IPSDERIndex) der).getPSDERIndexDEFieldMaps();
if(!ObjectUtils.isEmpty(map))
{
map.forEach(item->{
LookupModel lookupModel=new LookupModel().setRelationid(der.getId())
.setFieldname(item.getMinorPSDEField().getName()).setCodeName(item.getMinorPSDEField().getCodeName())
.setReffieldname(item.getMajorPSDEField().getName()).setRefCodeName(item.getMajorPSDEField().getCodeName());
rel.addLookup(lookupModel);
});
}
}
this.addReference(rel);
if("DERINHERIT".equals(der.getDERType()))
{
rel.setRelationType("inherit");
this.setIndexRelation(rel);
}
else if("DERINDEX".equals(der.getDERType())&& der.getMajorPSDataEntity().getVirtualMode()!=3
&& der.getMajorPSDataEntity().getIndexTypePSDEField()!=null)
{
rel.setRelationType("index");
this.setIndexRelation(rel);
}
else {
rel.setRelationType("reference");
this.addReference(rel);
}
}
}
......@@ -634,10 +699,13 @@ public class EntityModel extends BaseModel {
}
rel.setFkFieldCodeName(der1n.getPSPickupDEField().getCodeName());
String relfieldname=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("name").asText();
String refFieldName=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("name").asText();
String refCodeName=refFieldName;
if(der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("codeName")!=null)
refCodeName=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("codeName").asText();
LookupModel lookupModel=new LookupModel().setRelationid(der.getId())
.setFieldname(der1n.getPickupDEFName()).setReffieldname(relfieldname);
.setFieldname(der1n.getPickupDEFName()).setCodeName(der1n.getPSPickupDEField().getCodeName()).setReffieldname(refFieldName).setRefCodeName(refCodeName);
rel.addLookup(lookupModel);
this.addNested(rel);
......
......@@ -32,11 +32,15 @@ public class LookupModel implements Serializable {
*/
private String fieldname;
private String codeName;
/**
* 引用属性名称
*/
private String reffieldname;
private String refCodeName;
......
......@@ -11,7 +11,9 @@ import net.ibizsys.model.dataentity.der.IPSDERBase;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Getter
@Setter
......@@ -108,13 +110,13 @@ public class RelationshipModel extends BaseModel{
}
private List<LookupModel> lookup;
private Map<String,LookupModel> lookup;
public RelationshipModel addLookup(LookupModel obj)
{
if(lookup==null)
lookup=new ArrayList<>();
lookup.add(obj);
lookup=new LinkedHashMap<>();
lookup.put(obj.getFieldname()+obj.getReffieldname(),obj);
return this;
}
......
......@@ -75,7 +75,7 @@ public class DELogicAspect {
Object arg = args[0];
String action = point.getSignature().getName();
EntityBase entity = null;
if ("remove".equalsIgnoreCase(action) || "get".equalsIgnoreCase(action)) {
if (("remove".equalsIgnoreCase(action) || "get".equalsIgnoreCase(action)) && (!(arg instanceof EntityBase))) {
entity = getEntity(service.getClass());
if(!ObjectUtils.isEmpty(entity)) {
String id = DEFieldCacheMap.getDEKeyField(entity.getClass());
......
......@@ -40,7 +40,7 @@ public class DupCheckAspect {
*/
@AfterReturning(value = "(execution(* {{packageName}}.core.*.service.*{{entity.codeName}}*.create*(..))||execution(* {{packageName}}.core.*.service.*{{entity.codeName}}*.update*(..))||execution(* {{packageName}}.core.*.service.*{{entity.codeName}}*.save*(..)) ) && !execution(* {{packageName}}.core.es.service.*.create*(..)) && !execution(* {{packageName}}.core.es.service.*.update*(..)) && !execution(* {{packageName}}.core.es.service.*.save*(..)) ")
public void check{{pascalCase entity.codeName}}(JoinPoint point) {
check(point, "search{{pascalCase entity.defaultDataQuery}}");
check(point, "search{{pascalCase entity.defaultDataQuery.codeName}}");
}
{{/if}}
{{/each}}
......
......@@ -105,7 +105,7 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
{{else}}
@TableField(exist = false)
{{/if}}
private List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{camelCase codeName}};
protected List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{camelCase codeName}};
{{/each}}
{{#each entity.fields}}
......
......@@ -35,6 +35,13 @@ public interface {{entity.codeName}}Mapper extends BaseMapper<{{entity.codeName}
{{/enableEntityCache}}
{{entity.codeName}} selectById(Serializable id);
{{#enableEntityCache}}
@Cacheable(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
{{/enableEntityCache}}
{{entity.codeName}} selectEntity({{entity.codeName}} entity);
List<{{entity.codeName}}> selectEntities(@Param("list") List<{{entity.codeName}}> list);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
......
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
<#comment>索引从实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#comment>判断当前实体是否为索引子实体或继承子实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER.getDERType()?? && MinorPSDER.getMajorPSDataEntity()??>
<#comment>继承关系、索引关系 (包含分组属性)</#comment>
<#if MinorPSDER.getDERType()=="DERINHERIT" || (MinorPSDER.getDERType()=="DERINDEX" ) && MinorPSDER.getMajorPSDataEntity().getIndexTypePSDEField()??>
<#assign isIndexSubDE=true>
<#assign indexPSDER=MinorPSDER>
<#break>
</#if>
</#if>
</#list>
</#if>
<#if isIndexSubDE && indexPSDER??>
<#comment>索引主实体</#comment>
<#assign majorIndexDE=indexPSDER.getMajorPSDataEntity()>
<#assign majorIndexDECodeName=indexPSDER.getMajorPSDataEntity().codeName>
<#assign majorIndexDECodeNameCamel = srfr7templcaseformat(majorIndexDECodeName)?cap_first>
<#assign majorIndexDEKeyFieldCodeName=srfr7templcaseformat(majorIndexDE.getKeyPSDEField().codeName)>
<#assign majorIndexDEMajorTextFieldCodeName=srfr7templcaseformat(majorIndexDE.getMajorPSDEField().codeName)>
<#assign MinorIndexDECodeName=de.codeName>
<#assign MinorIndexDECodeNameCamel = srfr7templcaseformat(MinorIndexDECodeName)?cap_first>
<#assign MinorIndexDEKeyFieldCodeName=srfr7templcaseformat(de.getKeyPSDEField().codeName)>
<#assign MinorIndexDEMajorTextFieldCodeName=srfr7templcaseformat(de.getMajorPSDEField().codeName)>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.mapping;
{{#if entity.indexSubDE}}
package {{packageName}}.core.{{entity.module}}.mapping;
import org.mapstruct.*;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.codeName};
import ${pub.getPKGCodeName()}.core.${majorIndexDE.getPSSystemModule().getCodeName()?lower_case}.domain.${majorIndexDE.codeName};
import {{packageName}}.core.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.core.{{entity.indexRelation.module}}.domain.{{entity.indexRelation.relEntity.codeName}};
import java.util.List;
@Mapper(componentModel = "spring", uses = {})
public interface ${de.codeName}InheritMapping {
public interface {{entity.codeName}}InheritMapping {
@Mappings({
@Mapping(source ="${MinorIndexDEKeyFieldCodeName}",target = "${majorIndexDEKeyFieldCodeName}"),
@Mapping(source ="${MinorIndexDEMajorTextFieldCodeName}",target = "${majorIndexDEMajorTextFieldCodeName}"),
@Mapping(target ="focusNull",ignore = true),
<#if indexPSDER.getPSDERIndexDEFieldMaps?? && indexPSDER.getPSDERIndexDEFieldMaps()??>
<#list indexPSDER.getPSDERIndexDEFieldMaps() as indexFieldmapping>
<#comment>排除主键及主文本属性</#comment>
<#if indexFieldmapping.getMajorPSDEField()?? && indexFieldmapping.getMinorPSDEField()??>
<#assign majorDEField=indexFieldmapping.getMajorPSDEField()>
<#assign MinorDEField=indexFieldmapping.getMinorPSDEField()>
<#if majorDEField.isKeyDEField()==false && MinorDEField.isKeyDEField()==false && majorDEField.isMajorDEField()==false && MinorDEField.isMajorDEField()==false>
<#if !P.exists(MinorDEField.codeName,majorDEField.codeName)>
@Mapping(source ="${srfr7templcaseformat(MinorDEField.codeName)}",target = "${srfr7templcaseformat(majorDEField.codeName)}"),
</#if>
</#if>
</#if>
</#list>
</#if>
{{#each entity.indexRelation.lookup as |lookup|}}
@Mapping(source ="{{camelCase lookup.codeName}}",target = "{{camelCase lookup.refCodeName}}"),
{{/each}}
})
${majorIndexDECodeName} to${majorIndexDECodeNameCamel}(${MinorIndexDECodeName} minorEntity);
{{entity.indexRelation.relEntity.codeName}} to{{pascalCase entity.indexRelation.relEntity.codeName}}({{entity.codeName}} {{camelCase entity.codeName}});
@Mappings({
@Mapping(source ="${majorIndexDEKeyFieldCodeName}" ,target = "${MinorIndexDEKeyFieldCodeName}"),
@Mapping(source ="${majorIndexDEMajorTextFieldCodeName}" ,target = "${MinorIndexDEMajorTextFieldCodeName}"),
@Mapping(target ="focusNull",ignore = true),
<#if indexPSDER.getPSDERIndexDEFieldMaps()??>
<#list indexPSDER.getPSDERIndexDEFieldMaps() as indexFieldmapping>
<#comment>排除主键及主文本属性</#comment>
<#if indexFieldmapping.getMajorPSDEField()?? && indexFieldmapping.getMinorPSDEField()??>
<#assign majorDEField=indexFieldmapping.getMajorPSDEField()>
<#assign MinorDEField=indexFieldmapping.getMinorPSDEField()>
<#if majorDEField.isKeyDEField()==false && MinorDEField.isKeyDEField()==false && majorDEField.isMajorDEField()==false && MinorDEField.isMajorDEField()==false>
<#if !P.exists(majorDEField.codeName,MinorDEField.codeName)>
@Mapping(source ="${srfr7templcaseformat(majorDEField.codeName)}",target = "${srfr7templcaseformat(MinorDEField.codeName)}"),
</#if>
</#if>
</#if>
</#list>
</#if>
{{#each entity.indexRelation.lookup as |lookup|}}
@Mapping(source ="{{camelCase lookup.refCodeName}}",target = "{{camelCase lookup.codeName}}"),
{{/each}}
})
${MinorIndexDECodeName} to${MinorIndexDECodeNameCamel}(${majorIndexDECodeName} majorEntity);
{{entity.codeName}} to{{pascalCase entity.codeName}}({{entity.indexRelation.relEntity.codeName}} {{camelCase entity.indexRelation.relEntity.codeName}});
List<${majorIndexDECodeName}> to${majorIndexDECodeNameCamel}(List<${MinorIndexDECodeName}> minorEntities);
List<{{entity.indexRelation.relEntity.codeName}}> to{{pascalCase entity.indexRelation.relEntity.codeName}}(List<{{entity.codeName}}> list);
List<${MinorIndexDECodeName}> to${MinorIndexDECodeNameCamel}(List<${majorIndexDECodeName}> majorEntities);
List<{{entity.codeName}}> to{{pascalCase entity.codeName}}(List<{{entity.indexRelation.relEntity.codeName}}> list);
}
</#if>
</#if>
\ No newline at end of file
{{/if}}
\ No newline at end of file
......@@ -26,21 +26,16 @@ import {{packageName}}.core.{{module}}.filter.{{entity.codeName}}SearchContext;
{{/dsName}}
public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}}> {
{{entity.codeName}} get({{entity.keyField.type.java}} key);
default {{entity.codeName}} get({{entity.codeName}} et) {
CachedBeanCopier.copy(get(et.get{{pascalCase entity.keyField.codeName}}()), et);
return et;
{{entity.codeName}} get({{entity.codeName}} et);
default {{entity.codeName}} get({{entity.keyField.type.java}} key) {
return get(new {{entity.codeName}}().set{{pascalCase entity.keyField.codeName}}(key));
}
List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> ids);
default List<{{entity.codeName}}> getByEntities(Collection<{{entity.codeName}}> entities) {
List ids =new ArrayList();
entities.forEach(et -> {
Serializable id=et.get{{pascalCase entity.keyField.codeName}}();
if(!ObjectUtils.isEmpty(id))
ids.add(id);
});
return getByIds(ids);
default List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> ids) {
List<{{entity.codeName}}> entities =new ArrayList();
ids.forEach(key -> entities.add(new {{entity.codeName}}().set{{pascalCase entity.keyField.codeName}}(key)));
return getByEntities(entities);
}
List<{{entity.codeName}}> getByEntities(List<{{entity.codeName}}> entities);
{{entity.codeName}} getDraft({{entity.codeName}} et);
......@@ -64,10 +59,11 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{/enableEntityCache}}
boolean saveBatch(List<{{entity.codeName}}> list);
boolean remove({{entity.keyField.type.java}} key);
default boolean remove({{entity.codeName}} et) {
return remove(et.get{{pascalCase entity.keyField.codeName}}());
default boolean remove({{entity.keyField.type.java}} key) {
return remove(new {{entity.codeName}}().set{{pascalCase entity.keyField.codeName}}(key));
}
boolean remove({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
......@@ -92,6 +88,10 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean resetBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}},List<{{entity.codeName}}> list);
{{/entity.references}}
......
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign eurekaUrl = "http://127.0.0.1:8762/eureka/" >
<#comment>前端应用微服务平台配置</#comment>
<#if sys.getAllPSDevSlnMSDepApps()??>
<#list sys.getAllPSDevSlnMSDepApps() as depApp>
<#if depApp.getPSDCMSPlatform()??>
<#assign appPlatform=depApp.getPSDCMSPlatform()>
<#if appPlatform.getUserParam("eureka","http://127.0.0.1:8762/eureka/")??>
<#assign eurekaUrl = appPlatform.getUserParam("eureka","http://127.0.0.1:8762/eureka/")>
</#if>
<#break>
</#if>
</#list>
</#if>
<#comment>服务接口微服务平台配置</#comment>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDCMSPlatform()?? >
<#assign sysApiPlatform=depSysApi.getPSDCMSPlatform()>
<#if sysApiPlatform.getUserParam("eureka","http://127.0.0.1:8762/eureka/")??>
<#assign eurekaUrl = sysApiPlatform.getUserParam("eureka","http://127.0.0.1:8762/eureka/")>
</#if>
<#break>
</#if>
</#list>
</#if>
#eureka配置中心
spring:
cloud:
nacos:
discovery:
enabled: false
eureka:
client:
enabled: true
serviceUrl:
defaultZone: ${eurekaUrl}
#eureka配置中心
spring:
cloud:
nacos:
discovery:
enabled: false
eureka:
client:
enabled: true
serviceUrl:
defaultZone: http://127.0.0.1:8762/eureka/
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign nacosUrl = "127.0.0.1:8848" >
<#comment>前端应用微服务平台配置</#comment>
<#if sys.getAllPSDevSlnMSDepApps()??>
<#list sys.getAllPSDevSlnMSDepApps() as depApp>
<#if depApp.getPSDCMSPlatform()??>
<#assign appPlatform=depApp.getPSDCMSPlatform()>
<#if appPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = appPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#break>
</#if>
</#list>
</#if>
<#comment>服务接口微服务平台配置</#comment>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDCMSPlatform()?? >
<#assign sysApiPlatform=depSysApi.getPSDCMSPlatform()>
<#if sysApiPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = sysApiPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#break>
</#if>
</#list>
</#if>
#nacos配置中心
spring:
cloud:
nacos:
discovery:
server-addr: ${nacosUrl}
enabled: true
eureka:
client:
enabled: false
#nacos配置中心
spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
enabled: true
eureka:
client:
enabled: false
\ No newline at end of file
#缓存、数据源
spring:
cache:
redis:
time-to-live: 3600
caffeine:
spec: initialCapacity=5,maximumSize=500,expireAfterWrite=3600s
redis:
host: 127.0.0.1
port: 6379
password:
database: 0
lettuce:
pool:
max-active: 32
max-wait: 300ms
max-idle: 16
min-idle: 8
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
{{#if (or system.enableMongo system.enableES)}}
data:
{{/if}}
{{#if system.enableMongo}}
mongodb:
uri: mongodb://admin:admin@127.0.0.1:27017/{{projectName}}
{{/if}}
{{#if system.enableES}}
elasticsearch:
cluster-name: es-cluster
cluster-nodes: 127.0.0.1:9300
repositories:
enabled: true
{{/if}}
datasource:
username: root
password: root
url: jdbc:mysql://127.0.0.1:3306/{{projectName}}?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true&serverTimezone=GMT%2B8
driver-class-name: com.mysql.jdbc.Driver
isSyncDBSchema: false
defaultSchema: {{projectName}}
{{#if system.enableDS}}
conf: classpath:liquibase/master.xml
filters: stat,wall,log4j2
#配置初始化大小/最小/最大
initial-size: 1
min-idle: 1
max-active: 20
#获取连接等待超时时间
max-wait: 60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis: 60000
#一个连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
pool-prepared-statements: false
max-pool-prepared-statement-per-connection-size: 20
{{else}}
dynamic:
druid: #以下是全局默认值,可以全局更改
filters: stat,log4j2
#配置初始化大小/最小/最大
initial-size: 1
min-idle: 1
max-active: 20
#获取连接等待超时时间
max-wait: 60000
#间隔多久进行一次检测,检测需要关闭的空闲连接
time-between-eviction-runs-millis: 60000
#一个连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
#打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
pool-prepared-statements: false
max-pool-prepared-statement-per-connection-size: 20
datasource:
master:
username: ${spring.datasource.username}
password: ${spring.datasource.password}
url: ${spring.datasource.url}
driver-class-name: ${spring.datasource.driver-class-name}
conf: classpath:liquibase/master.xml
isSyncDBSchema: ${spring.datasource.isSyncDBSchema}
defaultSchema: ${spring.datasource.defaultSchema}
db2:
username: ${spring.datasource.username}
password: ${spring.datasource.password}
url: ${spring.datasource.url}
driver-class-name: ${spring.datasource.driver-class-name}
conf: classpath:liquibase/master.xml
isSyncDBSchema: ${spring.datasource.isSyncDBSchema}
defaultSchema: ${spring.datasource.defaultSchema}
{{/if}}
#Mybatis-plus配置
mybatis-plus:
global-config:
refresh-mapper: true
db-config:
# 全局逻辑已删除默认值
logic-delete-value: 0
# 全局逻辑未删除默认值
logic-not-delete-value: 1
mapper-locations: classpath*:/mapper/*/*/*.xml
configuration:
jdbc-type-for-null: 'null'
map-underscore-to-camel-case: false
#阿里sentinel熔断器
feign:
httpclient:
enabled: true
sentinel:
enabled: true
compression:
request:
enabled: true
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
min-response-size: 10240
response:
enabled: true
{{#if system.enableES}}
management:
health:
elasticsearch:
enabled: false
{{/if}}
{{#if system.enableGlobalTransaction}}
seata:
enabled: true #是否开启全局事务
application-id: {{projectName}} #服务标识
tx-service-group: {{projectName}}group #事务组
service:
vgroup-mapping:
{{projectName}}group: default #指定事务组对应的Tc Server集群
registry:
type: nacos #注册中心
nacos:
application: seata-server #Tc Server服务标识
server-addr: 127.0.0.1:8848 #注册中心地址
group: DEFAULT_GROUP #服务组
namespace: #服务命名空间
userName: #用户名
password: #密码
{{/if}}
{{#if system.enableMQ}}
rocketmq:
producer:
namesrvAddr: 127.0.0.1:9876
isOnOff: 'off'
groupName: default
topic: default
consumer:
namesrvAddr: 127.0.0.1:9876
isOnOff: 'off'
groupName: default
topic: default
{{/if}}
#Log配置
logging:
level:
cn.ibizlab: debug
{{packageName}}: debug
org.springframework.boot.autoconfigure: ERROR
#zuul网关超时设置
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
#系统是否开启权限验证、是否开启缓存
#缓存级别:无缓存(无配置项)、一级缓存(L1)、二级缓存(L2)
ibiz:
enablePermissionValid: true
cacheLevel: L1 #(L1)一级本地caffeine缓存;(L2)caffeine缓存+Redis缓存
{{#eq system.saaSMode() 4}}
saas:
column: SRFDCID
sys-tables: ACT_RU_TASK,act_re_procdef,databasechangelog,databasechangeloglock{{#each system.entities as |entity|}}{{#if (and (eq entity.storage "SQL") (entity.saaSMode 0))}},{{entity.tableName}}{{/if}}{{/each}}
{{/eq}}
### jobs
jobs:
#admin-address: http://127.0.0.1:40005
app-name: ibznotify
app-port: 9999
#app-ip: 127.0.0.1
### 启用Gzip压缩
server:
compression:
enabled: true
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
min-response-size: 10240
......@@ -35,14 +35,70 @@
{{else}}
where
{{/if}}
t1.{{entity.keyField.columnName}}=#{id}
{{else}}
select t1.* from ( <include refid="view" /> ) t1
where {{entity.keyField.columnName}}=#{id}
where
{{/if}}
{{else}}
select t1.* from {{entity.viewName}} t1 where {{entity.keyField.columnName}}=#{id}
select t1.* from {{entity.viewName}} t1
where
{{#if entity.logicValid}}
{{#if entity.logicValidField.type.number}}
{{entity.logicValidField.columnName}} = {{entity.validLogicValue}}
{{else}}
{{entity.logicValidField.columnName}} = '{{entity.validLogicValue}}'
{{/if}}
and
{{/if}}
{{/if}}
t1.{{entity.keyField.columnName}}=#{id}
</select>
<select id="selectEntity" parameterType="{{packageName}}.core.{{module}}.domain.{{entity.codeName}}" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.viewDataQuery}}
<include refid="view" />
{{#if entity.viewDataQuery.where}}
and
{{else}}
where
{{/if}}
{{else}}
select t1.* from {{entity.viewName}} t1
where
{{#if entity.logicValid}}
{{#if entity.logicValidField.type.number}}
{{entity.logicValidField.columnName}} = {{entity.validLogicValue}}
{{else}}
{{entity.logicValidField.columnName}} = '{{entity.validLogicValue}}'
{{/if}}
and
{{/if}}
{{/if}}
({{#each entity.keyFields as |field|}}{{#unless @first}} and {{/unless}}{{field.columnName}} = #{ {{camelCase field.codeName}} }{{/each}})
</select>
<select id="selectEntities" parameterType="java.util.List" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.viewDataQuery}}
<include refid="view" />
{{#if entity.viewDataQuery.where}}
and
{{else}}
where
{{/if}}
{{else}}
select t1.* from {{entity.viewName}} t1
where
{{#if entity.logicValid}}
{{#if entity.logicValidField.type.number}}
{{entity.logicValidField.columnName}} = {{entity.validLogicValue}}
{{else}}
{{entity.logicValidField.columnName}} = '{{entity.validLogicValue}}'
{{/if}}
and
{{/if}}
{{/if}}
({{#each entity.keyFields as |field|}}{{#unless @first}},{{/unless}}{{field.columnName}}{{/each}})
in (<foreach collection="list" item="item" index="index" separator=","> ({{#each entity.keyFields as |field|}}{{#unless @first}},{{/unless}}#{ item.{{camelCase field.codeName}} }{{/each}}) </foreach>)
</select>
{{#each entity.dataQueries}}
......@@ -83,7 +139,7 @@
{{else}}
select t1.* from {{#if entity.viewName}}{{entity.viewName}}{{else}}{{entity.tableName}}{{/if}} t1 where
{{/if}}
{{reference.fkField.columnName}} = #{{{camelCase reference.fkField.codeName}}}
{{reference.fkField.columnName}} = #{ {{camelCase reference.fkField.codeName}} }
</select>
{{/each}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册