提交 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}}
......
......@@ -12,6 +12,8 @@ import java.util.Objects;
import java.util.Optional;
import java.math.BigInteger;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.security.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
......@@ -20,23 +22,25 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.Assert;
import org.springframework.beans.factory.annotation.Value;
import cn.ibizlab.util.errors.BadRequestAlertException;
<#system.enableGlobalTransaction>
{{#system.enableGlobalTransaction}}
import io.seata.spring.annotation.GlobalTransactional;
</system.enableGlobalTransaction>
{{/system.enableGlobalTransaction}}
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Lazy;
import {{packageName}}.core.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.core.{{entity.module}}.filter.{{entity.codeName}}SearchContext;
import {{packageName}}.core.{{entity.module}}.service.I{{entity.codeName}}Service;
import {{packageName}}.core.{{entity.module}}.mapper.${item.getCodeName()}Mapper;
import {{packageName}}.core.{{entity.module}}.mapper.{{entity.codeName}}Mapper;
import cn.ibizlab.util.helper.CachedBeanCopier;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
......@@ -45,34 +49,61 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
*/
@Slf4j
@Service("{{entity.codeName}}ServiceImpl")
public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeName}}> implements I{{entity.codeName}}Service {
public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeName}}Mapper,{{entity.codeName}}> implements I{{entity.codeName}}Service {
protected I{{entity.codeName}}Service {{camelCase entity.codeName}}Service = SpringContextHolder.getBean(this.getClass());
{{#entity.relEntities}}
{{#neq storage "NONE"}}
@Autowired
@Lazy
protected {{packageName}}.core.{{codeName}}.service.I{{codeName}}Service {{camelCase codeName}}Service;
protected {{packageName}}.core.{{module}}.service.I{{codeName}}Service {{camelCase codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
{{#if entity.indexSubDE}}
@Autowired
@Lazy
protected {{packageName}}.core.{{module}}.mapping.{{entity.codeName}}InheritMapping {{camelCase codeName}}InheritMapping;
{{/if}}
protected int batchSize = 500;
public {{entity.codeName}} get({{entity.keyField.type.java}} key) {
{{entity.codeName}} et = getById(key);
Assert.notNull(et,"数据不存在,{{entity.logicName}}:"+key);
public {{entity.codeName}} get({{entity.codeName}} et) {
{{entity.codeName}} rt = this.baseMapper.selectEntity(et);
Assert.notNull(rt,"数据不存在,{{entity.logicName}}:"+et.get{{pascalCase entity.keyField.codeName}}());
CachedBeanCopier.copy(rt, et);
{{#entity.nesteds}}
{{#unless listCode}}
{{#unless columnName}}
//设置 [{{entityLogicName}}]
et.set{{pascalCase codeName}}({{camelCase entityCodeName}}Service.selectBy{{pascalCase fkField.codeName}}(key));
et.set{{pascalCase codeName}}({{camelCase entityCodeName}}Service.selectBy{{pascalCase fkField.codeName}}(et.get{{pascalCase entity.keyField.codeName}}()));
{{/unless}}
{{/unless}}
{{/entity.nesteds}}
return et;
}
public List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> ids) {
return this.listByIds(ids);
public List<{{entity.codeName}}> getByEntities(List<{{entity.codeName}}> entities) {
return this.baseMapper.selectEntities(entities);
}
{{entity.codeName}} getDraft({{entity.codeName}} et);
{{#entity.hasReferences}}
public void fillParentData({{entity.codeName}} et) {
}
{{/entity.hasReferences}}
boolean checkKey({{entity.codeName}} et);
public {{entity.codeName}} getDraft({{entity.codeName}} et) {
{{#entity.hasReferences}}
fillParentData(et);
{{/entity.hasReferences}}
return et;
}
public boolean checkKey({{entity.codeName}} et) {
return this.count(Wrappers.lambdaQuery(et))>0;
}
@Override
{{#eq entity.actions.create.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.create.transactionMode "DEFAULT"}}@Transactional{{/eq}}
......@@ -81,7 +112,14 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
fillParentData(et);
{{/entity.hasReferences}}
{{#entity.isIndexSubDE}}
createIndexMajorEntityData(et);
if(ObjectUtils.isEmpty(et.get{{pascalCase entity.keyField.codeName}}()))
et.set{{pascalCase entity.keyField.codeName}}((entity.keyField.type.java)})et.getDefaultKey(true));
{{packageName}}.core.{{entity.indexRelation.module}}.domain.{{entity.indexRelation.entityCodeName}} {{camelCase entity.indexRelation.entityCodeName}} = {{entity.codeName}}InheritMapping.to{{pascalCase entity.indexRelation.entityCodeName}}(et);
{{#if entity.indexRelation.indexTypePSDEField}}
{{camelCase entity.indexRelation.entityCodeName}}.set("{{lowerCase entity.indexRelation.indexTypePSDEField.codeName}}","{{entity.indexRelation.typeValue}}");
{{/if}}
{{camelCase entity.indexRelation.entityCodeName}}Service.create({{camelCase entity.indexRelation.entityCodeName}});
{{/entity.isIndexSubDE}}
{{#if entity.isLogicInheritDE}}
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("{{lowerCase entity.keyField.name}}", et.get{{pascalCase keyField.codeName}}())))
......@@ -93,56 +131,241 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#each entity.nesteds}}
{{#unless listCode}}
{{#unless columnName}}
{{camelCase entityCodeName}}Service.saveBy{{pascalCase fkField.codeName}}(key,et.{{camelCase codeName}});
{{camelCase entityCodeName}}Service.saveBy{{pascalCase fkField.codeName}}(et.get{{pascalCase entity.keyField.codeName}}(),et.get{{pascalCase codeName}}());
{{/unless}}
{{/unless}}
{{/each}}
get(et);
{{#if entity.hasPSDERsMapping}}
updateParentData(et);
{{/if}}
return true;
}
{{#eq entity.actions.create.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.create.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean createBatch(List<{{entity.codeName}}> list) {
{{#if (or entity.actions.create.psDEActionLogics entity.isIndexSubDE)}}
for ({{entity.codeName}} et : list) {
{{#if entity.unionKeyMode}}
{{camelCase entity.codeName}}Service.save(et);
{{else}}
{{camelCase entity.codeName}}Service.create(et);
{{/if}}
}
{{else}}
{{#entity.hasReferences}}
list.forEach(et->fillParentData(et));
{{/entity.hasReferences}}
{{#if entity.unionKeyMode}}
this.saveOrUpdateBatch(list,batchSize);
{{else}}
this.saveBatch(list, batchSize);
{{/if}}
{{#if entity.hasPSDERsMapping}}
updateParentDataBatch(list);
{{/if}}
{{/if}}
return true;
}
{{#eq entity.actions.update.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.update.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean update({{entity.codeName}} et) {
{{#entity.hasReferences}}
fillParentData(et);
{{/entity.hasReferences}}
{{#entity.isIndexSubDE}}
{{packageName}}.core.{{entity.indexRelation.module}}.domain.{{entity.indexRelation.entityCodeName}} {{camelCase entity.indexRelation.entityCodeName}} = {{entity.codeName}}InheritMapping.to{{pascalCase entity.indexRelation.entityCodeName}}(et);
{{#if entity.indexRelation.indexTypePSDEField}}
{{camelCase entity.indexRelation.entityCodeName}}.set("{{lowerCase entity.indexRelation.indexTypePSDEField.codeName}}","{{entity.indexRelation.typeValue}}");
{{/if}}
{{camelCase entity.indexRelation.entityCodeName}}Service.save({{camelCase entity.indexRelation.entityCodeName}});
{{/entity.isIndexSubDE}}
if(!update(et, (Wrapper) et.getUpdateWrapper(true)
{{#each entity.keyFields as |field|}}
.eq("{{lowerCase field.name}}", et.get{{pascalCase field.codeName}}())
{{/each}}
)) {
return false;
}
{{#each entity.nesteds}}
{{#unless listCode}}
{{#unless columnName}}
{{camelCase entityCodeName}}Service.saveBy{{pascalCase fkField.codeName}}(et.get{{pascalCase entity.keyField.codeName}}(),et.get{{pascalCase codeName}}());
{{/unless}}
{{/unless}}
{{/each}}
get(et);
{{#if entity.hasPSDERsMapping}}
updateParentData(et);
{{/if}}
return true;
}
boolean update({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean updateBatch(List<{{entity.codeName}}> list);
{{#eq entity.actions.update.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.update.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean updateBatch(List<{{entity.codeName}}> list) {
{{#if (or entity.actions.update.psDEActionLogics entity.isIndexSubDE (not entity.keyField.phisicalDEField))}}
for ({{entity.codeName}} et : list) {
{{camelCase entity.codeName}}Service.update(et);
}
{{else}}
{{#entity.hasReferences}}
list.forEach(et->fillParentData(et));
{{/entity.hasReferences}}
updateBatchById(list, batchSize);
{{#if entity.hasPSDERsMapping}}
updateParentDataBatch(list);
{{/if}}
{{/if}}
return true;
}
boolean save({{entity.codeName}} et);
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean saveBatch(List<{{entity.codeName}}> list);
{{#eq entity.actions.save.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.save.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean save({{entity.codeName}} et) {
if(checkKey(et))
return {{camelCase entity.codeName}}Service.update(et);
else
return {{camelCase entity.codeName}}Service.create(et);
}
boolean remove({{entity.keyField.type.java}} key);
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBatch(Collection<{{entity.keyField.type.java}}> ids);
{{#eq entity.actions.save.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.save.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean saveBatch(List<{{entity.codeName}}> list) {
List<{{entity.codeName}}> rt=this.getByEntities(list);
Set<Serializable> keys=new HashSet<>();
rt.forEach(et->{
Serializable key = et.get{{pascalCase entity.keyField.codeName}}();
if(!ObjectUtils.isEmpty(key))
keys.add(key);
});
List<{{entity.codeName}}> create=new ArrayList<>();
List<{{entity.codeName}}> update=new ArrayList<>();
list.forEach(et-> {
Serializable key = et.get{{pascalCase entity.keyField.codeName}}();
if(keys.contains(key))
update.add(et);
else
create.add(et);
});
List rtList=new ArrayList<>();
if(update.size()>0 && (!{{camelCase entity.codeName}}Service.updateBatch(update)))
return false;
if(create.size()>0 && (!{{camelCase entity.codeName}}Service.createBatch(create)))
return false;
return true;
}
{{#entity.actions}}
{{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et);
boolean {{camelCase codeName}}Batch(List<{{entity.codeName}}> list);
{{#eq entity.actions.remove.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.remove.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean remove({{entity.codeName}} et) {
{{entity.keyField.type.java}} key = et.get{{pascalCase entity.keyField.codeName}}();
{{#if entity.hasPSDERsMapping}}
get(et);
{{/if}}
{{#entity.nesteds}}
{{#unless listCode}}
{{#unless columnName}}
{{#eq removeActionType 1}}
{{camelCase entityCodeName}}Service.removeBy{{pascalCase fkField.codeName}}(key);
{{/eq}}
{{#eq removeActionType 2}}
{{camelCase entityCodeName}}Service.resetBy{{pascalCase fkField.codeName}}(key);
{{/eq}}
{{#eq removeActionType 3}}
if(!ObjectUtils.isEmpty({{camelCase entityCodeName}}Service.removeBy{{pascalCase fkField.codeName}}(key))
throw new BadRequestAlertException("删除数据失败,当前数据存在关系实体[{{camelCase entityCodeName}}]数据,无法删除!","","");
{{/eq}}
{{/unless}}
{{/unless}}
{{/entity.nesteds}}
{{#entity.isIndexSubDE}}
{{camelCase entity.indexRelation.entityCodeName}}Service.remove({{entity.codeName}}InheritMapping.to{{pascalCase entity.indexRelation.entityCodeName}}(et));
{{/entity.actions}}
{{/entity.isIndexSubDE}}
if(!remove(new QueryWrapper<{{entity.codeName}}>()
{{#each entity.keyFields as |field|}}
.eq("{{lowerCase field.name}}", et.get{{pascalCase field.codeName}}())
{{/each}}
)) {
return false;
}
{{#if entity.hasPSDERsMapping}}
updateParentData(et);
{{/if}}
return true ;
}
{{#eq entity.actions.remove.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.remove.transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean removeBatch(Collection<{{entity.keyField.type.java}}> ids) {
{{#if (or entity.actions.update.psDEActionLogics entity.isIndexSubDE (not entity.keyField.phisicalDEField) entity.hasPSDERsMapping)}}
for ({{entity.keyField.type.java}} et : ids)
{{camelCase entity.codeName}}Service.remove(et);
{{else}}
removeByIds(ids);
{{/if}}
return true;
}
{{#entity.extActions}}
{{#eq transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq transactionMode "DEFAULT"}}@Transactional{{/eq}}
public {{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et) {
return et;
}
{{#eq transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq transactionMode "DEFAULT"}}@Transactional{{/eq}}
public boolean {{camelCase codeName}}Batch(List<{{entity.codeName}}> list) {
return true;
}
{{/entity.extActions}}
{{#entity.dataSets}}
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}({{entity.codeName}}SearchContext context);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}({{entity.codeName}}SearchContext context);
public Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}({{entity.codeName}}SearchContext context) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> pages=baseMapper.search{{pascalCase codeName}}(context.getPages(),context,context.getSelectCond());
return new PageImpl<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
public List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}({{entity.codeName}}SearchContext context) {
return baseMapper.list{{pascalCase codeName}}(context,context.getSelectCond());
}
{{/entity.dataSets}}
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
boolean removeBy{{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);
public List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}}) {
return baseMapper.selectBy{{pascalCase fkField.codeName}}({{camelCase fkField.codeName}});
}
public boolean removeBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}}) {
return this.remove(new QueryWrapper<{{entity.codeName}}>().eq("{{lowerCase fkField.name}}",{{camelCase fkField.codeName}}));
}
public boolean resetBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}}) {
return this.update(new UpdateWrapper<{{entity.codeName}}>().set("{{lowerCase fkField.name}}",null).eq("{{lowerCase fkField.name}}",{{camelCase fkField.codeName}}));
}
public boolean saveBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}},List<{{entity.codeName}}> list) {
if(list==null)
return true;
Set<{{entity.keyField.type.java}}> delIds=new HashSet<{{entity.keyField.type.java}}>();
List<{{entity.codeName}}> _update=new ArrayList<{{entity.codeName}}>();
List<{{entity.codeName}}> _create=new ArrayList<{{entity.codeName}}>();
for({{entity.codeName}} before:selectBy{{pascalCase fkField.codeName}}({{camelCase fkField.codeName}})){
delIds.add(before.get{{pascalCase entity.keyField.codeName}}());
}
for({{entity.codeName}} sub:list) {
sub.set{{pascalCase fkField.codeName}}({{camelCase fkField.codeName}});
if(ObjectUtils.isEmpty(sub.get{{pascalCase entity.keyField.codeName}}()))
sub.set{{pascalCase entity.keyField.codeName}}(({{entity.keyField.type.java}})sub.getDefaultKey(true));
if(delIds.contains(sub.get{{pascalCase entity.keyField.codeName}}())) {
delIds.remove(sub.get{{pascalCase entity.keyField.codeName}}());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0 && (!{{camelCase entity.codeName}}Service.updateBatch(_update)))
return false;
if(_create.size()>0 && (!{{camelCase entity.codeName}}Service.createBatch(_create)))
return false;
if(delIds.size()>0 && (!{{camelCase entity.codeName}}Service.removeBatch(delIds)))
return false;
return true;
}
{{/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
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#comment>通用配置文件</#comment>
<#assign redisHost = "127.0.0.1" >
<#assign redisPort = "6379" >
<#assign redisDataBase = "0" >
<#assign dbUserName="root">
<#assign dbPassWord="root">
<#assign dbUrl="jdbc:mysql://127.0.0.1:3306/"+sys.name+"?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true">
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign bDynamicDS=false>
<#assign bmogo=false>
<#assign mongodbUri="mongodb://"+sys.name+":"+sys.name+"@127.0.0.1:27017/"+sys.name>
<#assign hasMQProducer=false>
<#assign hasMQConsumer=false>
<#if sys.getAllPSDataEntities()??>
<#list sys.getAllPSDataEntities() as de>
<#if de.getStorageMode()?? && de.getStorageMode()==2>
<#assign bmogo=true>
<#break >
</#if>
</#list>
</#if>
<#list sys.getAllPSDataEntities() as entity>
<#if (entity.getStorageMode()==1 || entity.getStorageMode()==2) && entity.getDSLink()!='DEFAULT'>
<#assign bDynamicDS=true>
<#break>
</#if>
</#list>
<#assign hasESEntity=false>
<#list sys.getAllPSDataEntities() as dataEntity>
<#if dataEntity.getUserTag()?? && dataEntity.getUserTag()=='elasticsearch'>
<#assign hasESEntity=true>
<#break>
</#if>
</#list>
<#assign TcServerCluster="default">
<#assign seataServerName="seata-server">
<#assign nacosAddress="localhost">
<#assign nacosGroup="DEFAULT_GROUP">
<#assign nacosNamespace="">
<#assign nacosUserName="">
<#assign nacosPassWord="">
<#comment>前端应用微服务平台配置</#comment>
<#if sys.getAllPSDevSlnMSDepApps()??>
<#list sys.getAllPSDevSlnMSDepApps() as depApp>
<#if depApp.getPSDCMSPlatform()??>
<#assign appPlatform=depApp.getPSDCMSPlatform()>
<#if appPlatform.getUserParam("spring.redis.host","127.0.0.1")??>
<#assign redisHost = appPlatform.getUserParam("spring.redis.host","127.0.0.1")>
</#if>
<#if appPlatform.getUserParam("spring.redis.port","6379")??>
<#assign redisPort = appPlatform.getUserParam("spring.redis.port","6379")>
</#if>
<#if appPlatform.getUserParam("spring.redis.database","0")??>
<#assign redisDataBase = appPlatform.getUserParam("spring.redis.database","0")>
</#if>
<#if appPlatform.getUserParam("spring.data.mongodb.uri",mongodbUri)??>
<#assign mongodbUri = appPlatform.getUserParam("spring.data.mongodb.uri",mongodbUri)>
</#if>
<#if appPlatform.getUserParam("seata.service.vgroup-mapping."+sys.getName()+"group",TcServerCluster)??>
<#assign TcServerCluster = appPlatform.getUserParam("seata.service.vgroup-mapping."+sys.getName()+"group",TcServerCluster)>
</#if>
<#if appPlatform.getUserParam("seata.registry.nacos.application",seataServerName)??>
<#assign seataServerName = appPlatform.getUserParam("seata.registry.nacos.application",seataServerName)>
</#if>
<#if appPlatform.getUserParam("seata.registry.nacos.server-addr",nacosAddress)??>
<#assign nacosAddress = appPlatform.getUserParam("seata.registry.nacos.server-addr",nacosAddress)>
</#if>
<#if appPlatform.getUserParam("seata.registry.nacos.group",nacosGroup)??>
<#assign nacosGroup = appPlatform.getUserParam("seata.registry.nacos.group",nacosGroup)>
</#if>
<#if appPlatform.getUserParam("seata.registry.nacos.namespace",nacosNamespace)??>
<#assign nacosNamespace = appPlatform.getUserParam("seata.registry.nacos.namespace",nacosNamespace)>
</#if>
<#if appPlatform.getUserParam("seata.registry.nacos.userName",nacosUserName)??>
<#assign nacosUserName = appPlatform.getUserParam("seata.registry.nacos.userName",nacosUserName)>
</#if>
<#if appPlatform.getUserParam("seata.registry.nacos.password",nacosPassWord)??>
<#assign nacosPassWord = appPlatform.getUserParam("seata.registry.nacos.password",nacosPassWord)>
</#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("spring.redis.host","127.0.0.1")??>
<#assign redisHost = sysApiPlatform.getUserParam("spring.redis.host","127.0.0.1")>
</#if>
<#if sysApiPlatform.getUserParam("spring.redis.port","6379")??>
<#assign redisPort = sysApiPlatform.getUserParam("spring.redis.port","6379")>
</#if>
<#if sysApiPlatform.getUserParam("spring.redis.database","0")??>
<#assign redisDataBase = sysApiPlatform.getUserParam("spring.redis.database","0")>
</#if>
<#if sysApiPlatform.getUserParam("spring.data.mongodb.uri",mongodbUri)??>
<#assign mongodbUri = sysApiPlatform.getUserParam("spring.data.mongodb.uri",mongodbUri)>
</#if>
<#if sysApiPlatform.getUserParam("seata.service.vgroup-mapping."+sys.getName()+"group",TcServerCluster)??>
<#assign TcServerCluster = sysApiPlatform.getUserParam("seata.service.vgroup-mapping."+sys.getName()+"group",TcServerCluster)>
</#if>
<#if sysApiPlatform.getUserParam("seata.registry.nacos.application",seataServerName)??>
<#assign seataServerName = sysApiPlatform.getUserParam("seata.registry.nacos.application",seataServerName)>
</#if>
<#if sysApiPlatform.getUserParam("seata.registry.nacos.server-addr",nacosAddress)??>
<#assign nacosAddress = sysApiPlatform.getUserParam("seata.registry.nacos.server-addr",nacosAddress)>
</#if>
<#if sysApiPlatform.getUserParam("seata.registry.nacos.group",nacosGroup)??>
<#assign nacosGroup = sysApiPlatform.getUserParam("seata.registry.nacos.group",nacosGroup)>
</#if>
<#if sysApiPlatform.getUserParam("seata.registry.nacos.namespace",nacosNamespace)??>
<#assign nacosNamespace = sysApiPlatform.getUserParam("seata.registry.nacos.namespace",nacosNamespace)>
</#if>
<#if sysApiPlatform.getUserParam("seata.registry.nacos.userName",nacosUserName)??>
<#assign nacosUserName = sysApiPlatform.getUserParam("seata.registry.nacos.userName",nacosUserName)>
</#if>
<#if sysApiPlatform.getUserParam("seata.registry.nacos.password",nacosPassWord)??>
<#assign nacosPassWord = sysApiPlatform.getUserParam("seata.registry.nacos.password",nacosPassWord)>
</#if>
<#break>
</#if>
</#list>
</#if>
<#comment>一键发布数据库配置</#comment>
<#if sysrun.getPSDBDevInst()??>
<#assign sysRunDBInst = sysrun.getPSDBDevInst()>
<#assign dbUserName=sysRunDBInst.getUserName()>
<#assign dbPassWord=sysRunDBInst.getPassword()>
<#assign dbUrl=sysRunDBInst.getConnUrl()>
<#if (sysRunDBInst.getDBType()=='MYSQL5')>
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dbUrl=dbUrl+"&allowMultiQueries=true">
<#elseif (sysRunDBInst.getDBType()=='DB2')>
<#assign dbDriver="com.ibm.db2.jcc.DB2Driver">
<#elseif (sysRunDBInst.getDBType()=='ORACLE')>
<#assign dbDriver="oracle.jdbc.driver.OracleDriver">
<#elseif (sysRunDBInst.getDBType()=='SQLSERVER')>
<#assign dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<#elseif (sysRunDBInst.getDBType()=='POSTGRESQL')>
<#assign dbDriver="org.postgresql.Driver">
<#elseif (sysRunDBInst.getDBType()=='PPAS')>
<#assign dbDriver="com.edb.Driver">
</#if>
</#if>
<#comment>部署-前端应用数据库配置</#comment>
<#if sys.getAllPSDevSlnMSDepApps()??>
<#list sys.getAllPSDevSlnMSDepApps() as depApp>
<#if depApp.getPSDBDevInst()??>
<#assign appDBInst=depApp.getPSDBDevInst()>
<#assign dbUserName=appDBInst.getUserName()>
<#assign dbPassWord=appDBInst.getPassword()>
<#assign dbUrl=appDBInst.getConnUrl()>
<#if (appDBInst.getDBType()=='MYSQL5')>
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dbUrl=dbUrl+"&allowMultiQueries=true">
<#elseif (appDBInst.getDBType()=='DB2')>
<#assign dbDriver="com.ibm.db2.jcc.DB2Driver">
<#elseif (appDBInst.getDBType()=='ORACLE')>
<#assign dbDriver="oracle.jdbc.driver.OracleDriver">
<#elseif (appDBInst.getDBType()=='SQLSERVER')>
<#assign dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<#elseif (appDBInst.getDBType()=='POSTGRESQL')>
<#assign dbDriver="org.postgresql.Driver">
<#elseif (appDBInst.getDBType()=='PPAS')>
<#assign dbDriver="com.edb.Driver">
</#if>
<#break>
</#if>
</#list>
</#if>
<#comment>部署-服务接口数据库配置</#comment>
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDBDevInst()??>
<#assign sysApiDBInst=depSysApi.getPSDBDevInst()>
<#assign dbUserName=sysApiDBInst.getUserName()>
<#assign dbPassWord=sysApiDBInst.getPassword()>
<#assign dbUrl=sysApiDBInst.getConnUrl()>
<#if (sysApiDBInst.getDBType()=='MYSQL5')>
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dbUrl=dbUrl+"&allowMultiQueries=true&serverTimezone=GMT%2B8">
<#elseif (sysApiDBInst.getDBType()=='DB2')>
<#assign dbDriver="com.ibm.db2.jcc.DB2Driver">
<#elseif (sysApiDBInst.getDBType()=='ORACLE')>
<#assign dbDriver="oracle.jdbc.driver.OracleDriver">
<#elseif (sysApiDBInst.getDBType()=='SQLSERVER')>
<#assign dbDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<#elseif (sysApiDBInst.getDBType()=='POSTGRESQL')>
<#assign dbDriver="org.postgresql.Driver">
<#elseif (sysApiDBInst.getDBType()=='PPAS')>
<#assign dbDriver="com.edb.Driver">
</#if>
<#break>
</#if>
</#list>
</#if>
#缓存、数据源
spring:
cache:
redis:
time-to-live: 3600
caffeine:
spec: initialCapacity=5,maximumSize=500,expireAfterWrite=3600s
redis:
host: ${redisHost}
port: ${redisPort}
password:
database: ${redisDataBase}
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 bmogo || hasESEntity>
data:
<#if bmogo>
mongodb:
uri: ${mongodbUri}
</#if>
<#if hasESEntity>
elasticsearch:
cluster-name: es-cluster
cluster-nodes: 127.0.0.1:9300
repositories:
enabled: true
</#if>
<#if hasESEntity>
management:
health:
elasticsearch:
enabled: false
</#if>
</#if>
<#if bDynamicDS>
<@dynamicDatasourceConfig/>
<#else>
<@singleDatasourceConfig/>
</#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
#Log配置
logging:
level:
${pub.getPKGCodeName()}: debug
org.springframework.boot.autoconfigure: ERROR
#zuul网关超时设置
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
<#assign enableDataAcc="false">
#系统是否开启权限验证、是否开启缓存
#缓存级别:无缓存(无配置项)、一级缓存(L1)、二级缓存(L2)
ibiz:
<#if sys.getPSSystemSetting()?? && sys.getPSSystemSetting().getDataAccCtrlArch()?? && sys.getPSSystemSetting().getDataAccCtrlArch()==1>
<#assign enableDataAcc="true">
</#if>
enablePermissionValid: ${enableDataAcc}
cacheLevel: L1 #(L1)一级本地caffeine缓存;(L2)caffeine缓存+Redis缓存
<#if sys.getSaaSMode()==4>
saas:
column: SRFDCID
sys-tables: ACT_RU_TASK,act_re_procdef,databasechangelog,databasechangeloglock<#list sys.getAllPSDataEntities() as entity><#if entity.getStorageMode()==1 && entity.getSaaSMode()==0>,${entity.getTableName()}</#if></#list>
</#if>
### jobs
jobs:
#admin-address: http://127.0.0.1:40005
app-name: ${sys.getName()}
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
<#if pub.isEnableGlobalTransaction?? && pub.isEnableGlobalTransaction()?? && pub.isEnableGlobalTransaction()==true>
seata:
enabled: true #是否开启全局事务
application-id: ${sys.getName()} #服务标识
tx-service-group: ${sys.getName()}group #事务组
service:
vgroup-mapping:
${sys.getName()}group: ${TcServerCluster} #指定事务组对应的Tc Server集群
registry:
type: nacos #注册中心
nacos:
application: ${seataServerName} #Tc Server服务标识
server-addr: ${nacosAddress} #注册中心地址
group: ${nacosGroup} #服务组
namespace: ${nacosNamespace} #服务命名空间
userName: "${nacosUserName}" #用户名
password: "${nacosPassWord}" #密码
</#if>
<#assign producerMQServer="127.0.0.1:9876">
<#assign consumerMQServer="127.0.0.1:9876">
<#assign producerisOnOff="off">
<#assign consumerisOnOff="off">
<#assign producerGroupName="default">
<#assign consumerGroupName="default">
<#assign producerTopic="default">
<#assign consumerTopic="default">
<#if sys.getAllPSDevSlnMSDepAPIs()??>
<#list sys.getAllPSDevSlnMSDepAPIs() as depSysApi>
<#if depSysApi.getPSDCMSPlatform()?? >
<#if depSysApi.getUserParam("rocketmq.producer.namesrvAddr","")?? && depSysApi.getUserParam("rocketmq.producer.namesrvAddr","")!=''>
<#assign hasMQProducer=true>
<#assign producerMQServer=depSysApi.getUserParam("rocketmq.producer.namesrvAddr","")>
<#if depSysApi.getUserParam("rocketmq.producer.isOnOff","")?? && depSysApi.getUserParam("rocketmq.producer.isOnOff","")!=''>
<#assign producerMQServer=depSysApi.getUserParam("rocketmq.producer.isOnOff","")>
</#if>
<#if depSysApi.getUserParam("rocketmq.producer.groupName","")?? && depSysApi.getUserParam("rocketmq.producer.groupName","")!=''>
<#assign producerGroupName=depSysApi.getUserParam("rocketmq.producer.groupName","")>
</#if>
<#if depSysApi.getUserParam("rocketmq.producer.topic","")?? && depSysApi.getUserParam("rocketmq.producer.topic","")!=''>
<#assign producerTopic=depSysApi.getUserParam("rocketmq.producer.topic","")>
</#if>
</#if>
<#if depSysApi.getUserParam("rocketmq.consumer.namesrvAddr","")?? && depSysApi.getUserParam("rocketmq.consumer.namesrvAddr","")!=''>
<#assign hasMQConsumer=true>
<#assign consumerMQServer=depSysApi.getUserParam("rocketmq.consumer.namesrvAddr","")>
<#if depSysApi.getUserParam("rocketmq.consumer.isOnOff","")?? && depSysApi.getUserParam("rocketmq.consumer.isOnOff","")!=''>
<#assign consumerisOnOff=depSysApi.getUserParam("rocketmq.consumer.isOnOff","")>
</#if>
<#if depSysApi.getUserParam("rocketmq.consumer.groupName","")?? && depSysApi.getUserParam("rocketmq.consumer.groupName","")!=''>
<#assign consumerGroupName=depSysApi.getUserParam("rocketmq.consumer.groupName","")>
</#if>
<#if depSysApi.getUserParam("rocketmq.consumer.topic","")?? && depSysApi.getUserParam("rocketmq.consumer.topic","")!=''>
<#assign consumerTopic=depSysApi.getUserParam("rocketmq.consumer.topic","")>
</#if>
</#if>
</#if>
</#list>
</#if>
<#if hasMQProducer ||hasMQConsumer>
rocketmq:
<#if hasMQProducer>
producer:
namesrvAddr: ${producerMQServer}
isOnOff: 'on'
groupName: ${producerGroupName}
topic: ${producerTopic}
</#if>
<#if hasMQConsumer>
consumer:
namesrvAddr: ${consumerMQServer}
isOnOff: 'on'
groupName: ${consumerGroupName}
topic: ${consumerTopic}
</#if>
</#if>
<#macro singleDatasourceConfig>
datasource:
username: ${dbUserName}
password: '${dbPassWord}'
url: ${dbUrl}
driver-class-name: ${dbDriver}
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
isSyncDBSchema: false
defaultSchema: <#if dbUserName=='root'>${sys.name}<#else>${dbUserName}</#if>
conf: classpath:liquibase/master.xml
</#macro>
<#macro dynamicDatasourceConfig>
datasource:
username: ${dbUserName}
password: '${dbPassWord}'
url: ${dbUrl}
driver-class-name: ${dbDriver}
isSyncDBSchema: false
defaultSchema: <#if dbUserName=='root'>${sys.name}<#else>${dbUserName}</#if>
dynamic:
druid: #以下是全局默认值,可以全局更改
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
datasource:
master:
username: ${r'${spring.datasource.username}'}
password: ${r'${spring.datasource.password}'}
url: ${r'${spring.datasource.url}'}
driver-class-name: ${r'${spring.datasource.driver-class-name}'}
conf: classpath:liquibase/master.xml
isSyncDBSchema: ${r'${spring.datasource.isSyncDBSchema}'}
defaultSchema: ${r'${spring.datasource.defaultSchema}'}
<#list sys.getAllPSDataEntities() as entity>
<#if (entity.getStorageMode()==1 || entity.getStorageMode()==2) && entity.getDSLink()!='DEFAULT'>
<#assign dbLink=entity.getDSLink()?lower_case>
<#if !P.exists('dynamicDatasource',dbLink)>
${dbLink}:
username: ${r'${spring.datasource.username}'}
password: ${r'${spring.datasource.password}'}
url: ${r'${spring.datasource.url}'}
driver-class-name: ${r'${spring.datasource.driver-class-name}'}
conf: classpath:liquibase/master.xml
isSyncDBSchema: ${r'${spring.datasource.isSyncDBSchema}'}
defaultSchema: ${r'${spring.datasource.defaultSchema}'}
</#if>
</#if>
</#list>
</#macro>
#缓存、数据源
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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册