提交 f4b459bf 编写于 作者: zhouweidong's avatar zhouweidong

合并分支 'dev' 到 'master'

Dev

查看合并请求 !33
# **iBiz4j Spring R7 Template ChangeLog**
## [v2020.10.28]
- 修复虚拟联合主键模板错误
- 修复serviceApi实体数据导入外键值检查报错问题
- 补充静态代码表
- 支持实体关系中主实体删除(同步删除、限制删除、置空)等操作
## [v2020.10.17]
- 支持es查询加速:开启查询加速的实体,在完成标准实体存储之外,还会将一份数据存入es中,用于后续在es中进行检索。
- 兼容虚拟主键、多个联合键值属性类型不统一的问题。
......@@ -8,7 +15,6 @@
- 修复程序异常时,L1缓存值为空的问题。
## [v2020.09.22]
- 处理逻辑:支持处理逻辑中启动工作流
- **实体属性:模板全局属性javaType调整(请用户自行确认并同步调整USR代码)**
- 虚拟主键:支持虚拟主键,虚拟主键由联合键值构成,新建、更新、删除等操作均通过联合键值实现
......
......@@ -69,7 +69,7 @@ zuul:
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
config:
path: /config/**
path: /configs/**
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
......
......@@ -79,7 +79,7 @@ zuul:
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
config:
path: /config/**
path: /configs/**
serviceId: ${r'${ibiz.ref.service.uaa:ibzuaa-api}'}
stripPrefix: false
<#if sys.getCodeName()!='ibzou' && sys.getCodeName()!='ibzrt'>
......
......@@ -287,8 +287,8 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
<#comment>联合主键</#comment>
<#assign keyField = item.getKeyPSDEField()>
<#if item.getUnionKeyValuePSDEFields()??>
<#assign privateCodeName = srfcaseformat(keyField.getCodeName(),'l_u2lC') >
<#assign publicCodeName = privateCodeName?cap_first >
<#assign prvateCodeName = srfcaseformat(keyField.getCodeName(),'l_u2lC') >
<#assign publicCodeName = prvateCodeName?cap_first >
<#if keyField.isPhisicalDEField()==false>
<#comment>虚拟联合主键</#comment>
<#assign unionKeySize=0>
......@@ -334,10 +334,10 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
* 获取 [${keyField.getLogicName()}]
*/
public ${srfr7javatype(keyField.getStdDataType())} get${publicCodeName}(){
if(ObjectUtils.isEmpty(${privateCodeName})){
${privateCodeName}=(${srfr7javatype(keyField.stdDataType)})getDefaultKey(true);
if(ObjectUtils.isEmpty(${prvateCodeName})){
${prvateCodeName}=(${srfr7javatype(keyField.stdDataType)})getDefaultKey(true);
}
return ${privateCodeName};
return ${prvateCodeName};
}
@Override
......
......@@ -176,11 +176,25 @@ public interface I${item.codeName}Service{
<#if de.getDefaultPSDEDataSet()??>
<#assign deDefaultDataSet=de.getDefaultPSDEDataSet()>
<#if deDefaultDataSet.getPSDEDataQueries()??>
List<${item.getCodeName()}> selectBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(${srfr7javatype(MajorField.stdDataType)} ${MajorkeyField.codeName?lower_case}) ;
List<${item.getCodeName()}> selectBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(${srfr7javatype(MajorField.stdDataType)} ${MajorkeyField.codeName?lower_case});
<#comment>主实体关联实体行为</#comment>
<#if MinorPSDER.getRemoveActionType()??>
<#if MinorPSDER.getRemoveActionType()?c=='3'><#comment>限制删除</#comment>
List<${item.getCodeName()}> selectBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(Collection<${srfr7javatype(MajorField.stdDataType)}> ids);
<#elseif MinorPSDER.getRemoveActionType()?c=='2'><#comment>置空</#comment>
void resetBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(${srfr7javatype(MajorField.stdDataType)} ${MajorkeyField.codeName?lower_case});
void resetBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(Collection<${srfr7javatype(MajorField.stdDataType)}> ids);
<#elseif MinorPSDER.getRemoveActionType()?c=='1'><#comment>同时删除</#comment>
<#if item.isEnableEntityCache()==true>
@CacheEvict(value="${item.codeName?lower_case}",allEntries=true)
</#if>
void removeBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(Collection<${srfr7javatype(MajorField.stdDataType)}> ids);
</#if>
</#if>
<#if item.isEnableEntityCache()==true>
@CacheEvict(value="${item.codeName?lower_case}",allEntries=true)
</#if>
void removeBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(${srfr7javatype(MajorField.stdDataType)} ${MajorkeyField.codeName?lower_case}) ;
void removeBy${srfcaseformat(MajorField.codeName,'l_u2lC')?cap_first}(${srfr7javatype(MajorField.stdDataType)} ${MajorkeyField.codeName?lower_case});
<#assign nested=MinorPSDER.isNestedRS()>
<#if nested == false && MinorPSDER.getMinorPSDataEntity().getAllPSDEServiceAPIs()??>
<#list MinorPSDER.getMinorPSDataEntity().getAllPSDEServiceAPIs() as api>
......
......@@ -3,7 +3,12 @@ TARGET=PSSYSTEM
</#ibiztemplate>
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
<changeSet author="Think (generated)" id="1591012776347-1">
<changeSet author="Think (generated)" id="1592547336292-1">
<preConditions onFail="MARK_RAN" >
<not >
<tableExists tableName="IBZCFG" />
</not>
</preConditions>
<createTable remarks="配置" tableName="IBZCFG">
<column name="CFGID" remarks="配置标识" type="VARCHAR(100)">
<constraints primaryKey="true"/>
......
......@@ -28,7 +28,7 @@ TARGET=PSSYSTEM
<#assign deName=de.getName()?lower_case>
<#comment>输出表结构</#comment>
<#if !P.exists("table_",de.getTableName(),"") && bPubDb==true>
<changeSet author="${dbinst.getUserName()}" id="tab-${deName}-${deVersion}-${sequenceNumber}">
<changeSet author="<#if dbinst?? && dbinst.getUserName()??>${dbinst.getUserName()}<#else>root</#if>" id="tab-${deName}-${deVersion}-${sequenceNumber}">
<createTable tableName="${de.getTableName()}">
<#list de.getAllPSDEFields() as defield>
<#if defield.isPhisicalDEField()==true><#comment>物理属性</#comment>
......@@ -48,7 +48,7 @@ TARGET=PSSYSTEM
<#assign dataType="DECIMAL(38,2)"><#comment>数据类型转换varchar-->decimal</#comment>
</#if>
<#comment>由于liquibase不支持修改mysql的remarks,修改remarks会导致启动报错,所以mysql数据库暂时不发remarks</#comment>
<column name="${defield.getName()}" remarks="<#if (dbinst.getDBType()!='MYSQL5')>${defield.getLogicName()}</#if>" type="${dataType}">
<column name="${defield.getName()}" remarks="<#if dbinst?? && (dbinst.getDBType()!='MYSQL5')>${defield.getLogicName()}</#if>" type="${dataType}">
<#if defield.isKeyDEField()==true>
<#comment>oracle中约束名长度不能大于30</#comment>
<#assign constraintName="PK_"+de.getName()+"_"+defield.getName()>
......@@ -92,7 +92,7 @@ TARGET=PSSYSTEM
<#assign fkConstraintName=fkConstraintName?substring(0,30)>
</#if>
<#if !P.exists("fk_",fkConstraintName,"") && bPubDb==true>
<changeSet author="${dbinst.getUserName()}" id="fk-${deName}-${deVersion}-${sequenceNumber}">
<changeSet author="<#if dbinst?? && dbinst.getUserName()??>${dbinst.getUserName()}<#else>root</#if>" id="fk-${deName}-${deVersion}-${sequenceNumber}">
<addForeignKeyConstraint baseColumnNames="${fk.getPSPickupDEField().getName()}" baseTableName="${de.getTableName()}" constraintName="${fkConstraintName}" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="${fk.getMajorPSDataEntity().getKeyPSDEField().getName()}" referencedTableName="${fk.getMajorPSDataEntity().getTableName()}" validate="true"/>
</changeSet>
</#if>
......
......@@ -27,7 +27,7 @@ TARGET=PSSYSTEM
<#assign deName=de.getName()?lower_case>
<#if !P.exists("view_",de.getViewName(),"") && bPubDb == true>
<!--输出实体[${de.getName()}]视图结构信息 runOnChange="true" 当视图发生变更时,通过liquibase强刷prod的视图,实现视图的同步-->
<changeSet author="${dbinst.getUserName()}" id="view-${deName}-${deVersion}-${sequenceNumber}" runOnChange="true">
<changeSet author="<#if dbinst?? && dbinst.getUserName()??>${dbinst.getUserName()}<#else>root</#if>" id="view-${deName}-${deVersion}-${sequenceNumber}" runOnChange="true">
<createView fullDefinition="false" replaceIfExists="true" viewName="${de.getViewName()}">
<#if de.getAllPSDEDataQueries?? && de.getAllPSDEDataQueries()??>
<#assign resultDataQuery = de.getAllPSDEDataQueries()>
......
......@@ -45,7 +45,9 @@ TARGET=PSSYSTEM
<#if defield.getPrecision()?c!='0'>
"data_preci":${defield.getPrecision()?c},
</#if>
<#--"expression":"",-->
<#if defield.getDefaultPSDEFDTColumn()?? && defield.getDefaultPSDEFDTColumn().isFormula()==true>
"expression":"${defield.getDefaultPSDEFDTColumn().getFormulaFormat()}",
</#if>
<#if defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
"predefined":"${defield.getPredefinedType()}",
</#if>
......@@ -53,6 +55,9 @@ TARGET=PSSYSTEM
<#if defield.getUnionKeyValue()?? && defield.getUnionKeyValue()!=''>
"union_key":"${defield.getUnionKeyValue()}",
</#if>
<#if defield.getOrderValue?? && defield.getOrderValue()??>
"show_order":${defield.getOrderValue()?c},
</#if>
"major_field":<#if defield.isMajorDEField()==true>1<#else>0</#if>
}<#if defield_has_next>,</#if>
</#list>
......
......@@ -73,7 +73,10 @@ public class ESAspect
return;
}
Object arg=args[0];
if(arg instanceof EntityBase || arg instanceof List){
if ("remove".equals(action) || "removeBatch".equals(action)){
executeESMethod(exService,action,arg);
}
else if(arg instanceof EntityBase || arg instanceof List){
EvaluationContext exMappingCtx = new StandardEvaluationContext();
exMappingCtx.setVariable("service",service);
Expression esMappingExp = parser.parseExpression("#service.getESMapping()");
......@@ -89,9 +92,6 @@ public class ESAspect
arg=esDomainExp.getValue(exDomainCtx);
executeESMethod(exService,action,arg);
}
else if ("remove".equals(action) || "removeBatch".equals(action)){
executeESMethod(exService,action,arg);
}
} catch (Exception e) {
log.error("同步[{}]实体全文检索数据失败,{}",deName,e);
}
......
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign hasCodeList=false>
<#if sys.getAllPSCodeLists()??>
<#list sys.getAllPSCodeLists() as codeList>
<#if codeList.getCodeListType()=='STATIC'>
<#assign hasCodeList=true>
<#break >
</#if>
</#list>
</#if>
<#if hasCodeList>
package ${pub.getPKGCodeName()}.util.dict;
import lombok.Getter;
public class StaticDict {
<#if sys.getAllPSCodeLists()??>
<#list sys.getAllPSCodeLists() as codeList>
<#assign hasCodeItem=calcHasCodeItem(codeList)>
<#if codeList.getCodeListType()=='STATIC' && hasCodeItem>
<#assign codeListName=codeList.codeName>
<#comment>数值代码表int,其余为String</#comment>
<#if codeList.isCodeItemValueNumber()>
<#assign valueType="int">
<#else>
<#assign valueType="String">
</#if>
/**
* 代码表[${codeList.name}]
*/
@Getter
public enum ${codeListName} {
<#if codeList.getAllPSCodeItems()??>
<#list codeList.getAllPSCodeItems() as codeItem>
<#assign codeItemValue=codeItem.getValue()>
<#assign codeItemText=codeItem.getText()>
${codeItem.codeName?upper_case}(<#if valueType=='int'>${codeItemValue}<#else>"${codeItemValue}"</#if>,"${codeItemText}")<#if codeItem_has_next>,<#else>;</#if>
</#list>
</#if>
private ${valueType} value;
private String text;
private String valueSeparator="<#if codeList.getValueSeparator()??>${codeList.getValueSeparator()}</#if>";
private String textSeparator="<#if codeList.getTextSeparator()??>${codeList.getTextSeparator()}</#if>";
private String emptyText="<#if codeList.getEmptyText()?? && codeList.getEmptyText()!='未定义'>${codeList.getEmptyText()}</#if>";
${codeListName}(${valueType} value , String text) {
this.value=value;
this.text = text;
}
}
</#if>
</#list>
</#if>
}
</#if>
<#comment>替换代码表中的特殊字符</#comment>
<#function replaceCodeItemValue codeItemValue>
<#assign result=codeItemValue?replace("[^\\w]+","_","r")>
<#return result>
</#function>
<#comment>判断是否含有代码项</#comment>
<#function calcHasCodeItem codeList>
<#assign hasCodeItem=false>
<#if codeList.getAllPSCodeItems()??>
<#list codeList.getAllPSCodeItems() as codeItem>
<#assign hasCodeItem=true>
<#break>
</#list>
</#if>
<#return hasCodeItem>
</#function>
\ No newline at end of file
......@@ -348,7 +348,7 @@ seata:
pool-prepared-statements: false
max-pool-prepared-statement-per-connection-size: 20
isSyncDBSchema: false
defaultSchema: ${dbUserName}
defaultSchema: <#if dbUserName=='root'>${sys.name}<#else>${dbUserName}</#if>
conf: classpath:liquibase/master.xml
</#macro>
......@@ -382,7 +382,7 @@ seata:
driver-class-name: ${dbDriver}
conf: classpath:liquibase/master.xml
isSyncDBSchema: false
defaultSchema: ${dbUserName}
defaultSchema: <#if dbUserName=='root'>${sys.name}<#else>${dbUserName}</#if>
<#list sys.getAllPSDataEntities() as entity>
<#if (entity.getStorageMode()==1 || entity.getStorageMode()==2) && entity.getDSLink()!='DEFAULT'>
<#assign dbLink=entity.getDSLink()?lower_case>
......@@ -394,7 +394,7 @@ seata:
driver-class-name: ${dbDriver}
conf: classpath:liquibase/master.xml
isSyncDBSchema: false
defaultSchema: ${dbUserName}
defaultSchema: <#if dbUserName=='root'>${sys.name}<#else>${dbUserName}</#if>
</#if>
</#if>
</#list>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册