提交 84c5753c 编写于 作者: xignzi006's avatar xignzi006

update:r8模板

上级 8aaf05fe
*volumes
*target
.settings
*node_modules
*bin
*.project
*.classpath
*.factorypath
.history
.idea
**.iml
*.jar
*.log
.DS_Store
**.ibizlab-generator-ignore
**.DS_Store
**@macro/**
\ No newline at end of file
type: PSSYSTEM
psdevsln: {{system.getPSDevSlnId}}
psdevslnsys: {{system.getPubSystemId}}
psdevslnsysname: {{system.getLogicName}}
{{#if system.pSSVNInstRepo}}
git-remote: {{system.pSSVNInstRepo.gitPath}}
{{else}}
# 需自行补充 git-remote 参数,值为 git 地址
{{/if}}
\ No newline at end of file
<#if pub.getPSDeployCenter()?? && sysrun.getRunMode()??>
<#if pub.getPSDeployCenter().getCIType()?? && (pub.getPSDeployCenter().getCIType()=="JENKINS") >
<#if sysrun.getRunMode() == "STARTMSAPI">
<#assign depapi = sysrun.getPSDevSlnMSDepAPI()>
<#assign configId = depapi.getId()>
<#assign config = "api"+depapi.getName()>
<#assign depnode = sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()>
<#assign depplatform = sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatform()>
<#elseif sysrun.getRunMode() == "STARTMSAPP">
<#assign depapp = sysrun.getPSDevSlnMSDepApp()>
<#assign configId = depapp.getId()>
<#assign config = "app"+depapp.getName()>
<#assign depnode = sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatformNode()>
<#assign depplatform = sysrun.getPSDevSlnMSDepApp().getPSDCMSPlatform()>
</#if>
<#if sys.getPSSVNInstRepo().getGitBranch()?? && sys.getPSSVNInstRepo().getGitBranch()!="">
<#assign branch=sys.getPSSVNInstRepo().getGitBranch()>
<#else>
<#assign branch='master'>
</#if>
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description>${sys.codeName}</description>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.model.ParametersDefinitionProperty>
<parameterDefinitions>
<hudson.model.StringParameterDefinition>
<name>para1</name>
<description></description>
<defaultValue>para1</defaultValue>
<trim>false</trim>
</hudson.model.StringParameterDefinition>
<hudson.model.StringParameterDefinition>
<name>para2</name>
<description></description>
<defaultValue>para2</defaultValue>
<trim>false</trim>
</hudson.model.StringParameterDefinition>
</parameterDefinitions>
</hudson.model.ParametersDefinitionProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>
BUILD_ID=DONTKILLME
source /etc/profile
rm -rf ${sys.codeName?lower_case}
git clone -b ${branch} $para2 ${sys.codeName?lower_case}/
export NODE_OPTIONS=--max-old-space-size=4096
cd ${sys.codeName?lower_case}/
<#if sysrun.getRunMode() == "STARTMSAPP">
<#if pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="SWARM") >
mkdir -p /var/lib/jenkins/appcache/${depapp.getId()}
cd app_${pub.getPSApplication().getPKGCodeName()}/app
yarn
ln -s /var/lib/jenkins/appcache/${depapp.getId()} node_modules/.cache
yarn build
cd ..
yarn
yarn build
rm -rf app
tar -zcvf docker/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.tar.gz --exclude=docker * > /dev/null
cd docker
docker build -t registry.cn-shanghai.aliyuncs.com/ibizsys/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}:latest .
docker push registry.cn-shanghai.aliyuncs.com/ibizsys/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}:latest
docker -H $para1 stack deploy --compose-file=swarm.yaml ${depplatform.getName()} --with-registry-auth
<#elseif pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="K8S") >
cd app_${pub.getPSApplication().getPKGCodeName()}/app
yarn
yarn build
cd ..
yarn
yarn build
rm -rf app
tar -zcvf docker/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.tar.gz * > /dev/null
cd docker
docker build -t registry.cn-shanghai.aliyuncs.com/ibizsys/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}:latest .
docker push registry.cn-shanghai.aliyuncs.com/ibizsys/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}:latest
set +e
kubectl --kubeconfig ~/shanghai-demo-01 delete -f k8s.yaml -n ${depplatform.getName()?lower_case}
set -e
kubectl --kubeconfig ~/shanghai-demo-01 create -f k8s.yaml -n ${depplatform.getName()?lower_case}
<#else>
echo &apos;echo &quot;$para1&quot;&apos; &gt; apppasswd.sh
chmod -R 777 *
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;mkdir -p ${depnode.getWorkshopPath()}/${configId}&quot;
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; scp -r {{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.jar ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()}:${depnode.getWorkshopPath()}/${configId}
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;ps -ef | grep &apos;${depnode.getWorkshopPath()}/${configId}&apos;| tr -s &apos; &apos;|cut -d&apos; &apos; -f2,8,9 | grep -v grep | grep &apos;jar&apos; | cut -d&apos; &apos; -f1|xargs --no-run-if-empty kill -9&quot;
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;source /etc/profile;source ~/.bash_profile; nohup java -jar -Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=128m ${depnode.getWorkshopPath()}/${configId}/{{projectName}}-app-${pub.getPSApplication().getPKGCodeName()?lower_case}.jar &gt;&gt;${depnode.getWorkshopPath()}/${configId}/${sys.codeName?lower_case}_${config?lower_case}-`date --date=&apos;0 days ago&apos; +%Y-%m-%d`.log 2&gt;&amp;1 &amp;&quot;
</#if>
</#if>
<#if sysrun.getRunMode() == "STARTMSAPI">
mvn clean package -P${pub.getPSSysServiceAPI().getCodeName()?lower_case}
mvn install -P${pub.getPSSysServiceAPI().getCodeName()?lower_case}
<#if pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="SWARM") >
cd {{projectName}}-provider
<#if depapi.getUserParam("multiplatform","")?? && depapi.getUserParam("multiplatform","")=="true">
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} exec:exec@prepare
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} exec:exec@buildpush
<#else>
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:build
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:push
</#if>
docker -H $para1 stack deploy --compose-file=src/main/docker/{{projectName}}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.yaml ${depplatform.getName()} --with-registry-auth
<#elseif pub.getPSDeployCenter().getCDType()?? && (pub.getPSDeployCenter().getCDType()=="K8S") >
cd {{projectName}}-provider
<#if depapi.getUserParam("multiplatform","")?? && depapi.getUserParam("multiplatform","")=="true">
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} exec:exec@prepare
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} exec:exec@buildpush
<#else>
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:build
mvn -P${pub.getPSSysServiceAPI().getCodeName()?lower_case} docker:push
</#if>
set +e
kubectl --kubeconfig ~/shanghai-demo-01 delete -f src/main/docker/{{projectName}}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}-k8s.yaml -n ${depplatform.getName()?lower_case}
set -e
kubectl --kubeconfig ~/shanghai-demo-01 create -f src/main/docker/{{projectName}}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}-k8s.yaml -n ${depplatform.getName()?lower_case}
<#else>
echo &apos;echo &quot;$para1&quot;&apos; &gt; apppasswd.sh
chmod -R 777 *
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;mkdir -p ${depnode.getWorkshopPath()}/${configId}&quot;
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; scp -r {{projectName}}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.jar ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()}:${depnode.getWorkshopPath()}/${configId}
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;ps -ef | grep &apos;${depnode.getWorkshopPath()}/${configId}&apos;| tr -s &apos; &apos;|cut -d&apos; &apos; -f2,8,9 | grep -v grep | grep &apos;jar&apos; | cut -d&apos; &apos; -f1|xargs --no-run-if-empty kill -9&quot;
setsid env SSH_ASKPASS=&apos;./apppasswd.sh&apos; DISPLAY=&apos;none:0&apos; ssh ${depnode.getSSHUserName()}@${depnode.getSSHIPAddr()} &quot;source /etc/profile;source ~/.bash_profile; nohup java -jar -Xms512m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=128m ${depnode.getWorkshopPath()}/${configId}/{{projectName}}-provider-${pub.getPSSysServiceAPI().getCodeName()?lower_case}.jar &gt;&gt;${depnode.getWorkshopPath()}/${configId}/${sys.codeName?lower_case}_${config?lower_case}-`date --date=&apos;0 days ago&apos; +%Y-%m-%d`.log 2&gt;&amp;1 &amp;&quot;
</#if>
</#if>
</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup@0.34">
<patterns class="empty-list"/>
<deleteDirs>false</deleteDirs>
<skipWhenFailed>false</skipWhenFailed>
<cleanWhenSuccess>true</cleanWhenSuccess>
<cleanWhenUnstable>true</cleanWhenUnstable>
<cleanWhenFailure>true</cleanWhenFailure>
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
<cleanWhenAborted>true</cleanWhenAborted>
<notFailBuild>false</notFailBuild>
<cleanupMatrixParent>false</cleanupMatrixParent>
<externalDelete></externalDelete>
</hudson.plugins.ws__cleanup.WsCleanup>
</publishers>
<buildWrappers/>
</project>
</#if>
</#if>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>{{projectName}}</artifactId>
<packaging>pom</packaging>
<parent>
<groupId>{{packageName}}</groupId>
<artifactId>{{projectName}}-dependencies</artifactId>
<version>1.0.0.0</version>
<relativePath>{{projectName}}-dependencies/pom.xml</relativePath>
</parent>
<modules>
<!-- dependencies -->
<module>{{projectName}}-dependencies</module>
<!-- cores -->
<module>{{projectName}}-core</module>
<!-- services -->
<module>{{projectName}}-provider</module>
</modules>
<dependencies>
<dependency>
<groupId>net.ibizsys.central.r8</groupId>
<artifactId>ibiz-central-r8</artifactId>
<version>0.2.15</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.7.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>ibizmvnrepository</id>
<name>ibizmvnrepository</name>
<url>http://172.16.240.220:8081/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>{{projectName}}-core</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-security</artifactId>
</dependency>
<!-- JBPM -->
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
</dependency>
<!-- Drools -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<!-- <dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency> -->
<!--MapStruct高性能属性映射工具-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
</dependency>
<!--baomidou-jobs定时服务 -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>jobs-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
</dependency>
</dependencies>
<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<profiles>
<profile>
<id>diff</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}'}</version>
<executions>
<execution>
<id>prepare-newdb</id>
<configuration>
<changeLogFile>${project.basedir}'}/src/main/resources/liquibase/h2_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>prepare-olddb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/master_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>make-diff</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/empty.xml</changeLogFile>
<diffChangeLogFile>${project.basedir}/src/main/resources/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<password></password>
<referenceUrl>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</referenceUrl>
<referenceDriver>org.h2.Driver</referenceDriver>
<referenceUsername>root</referenceUsername>
<verbose>true</verbose>
<logging>debug</logging>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,ibzcfg,IBZFILE,IBZUSER,IBZDATAAUDIT,IBZCFG</diffExcludeObjects>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>diff</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
package {{packageName}}.core.config;
import com.baomidou.jobs.starter.EnableJobs;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
@EnableJobs
@Configuration
@ConditionalOnProperty(name = "jobs.enabled", havingValue = "true", matchIfMissing = false)
public class JobsConfiguration {
}
package {{packageName}}.core.runtime;
public interface ISystemRuntime extends net.ibizsys.central.r8.IR8SystemRuntime {
{{#each system.allPSDataEntities as |entity|}}
default {{packageName}}.core.{{lowerCase entity.pSSystemModule.codeName}}.service.I{{pascalCase entity.codeName}}Service get{{pascalCase entity.codeName}}Service(){
return ({{packageName}}.core.{{lowerCase entity.pSSystemModule.codeName}}.service.I{{pascalCase entity.codeName}}Service) this.getDEService("{{entity.dynaModelFilePath}}");
}
{{/each}}
}
package {{packageName}}.core.runtime;
import net.ibizsys.central.dataentity.IDataEntityRuntime;
import net.ibizsys.central.dataentity.service.IDEService;
import net.ibizsys.central.r8.R8SystemRuntime;
import net.ibizsys.model.IPSDynaInstService;
import net.ibizsys.model.res.IPSSysUtil;
import net.ibizsys.runtime.res.ISysUtilRuntime;
public class SystemRuntimeBase extends R8SystemRuntime implements ISystemRuntime {
@Override
public String getName() {
return "{{system.name}}";
}
{{#if system.allPSSysUtils}}
@Override
protected ISysUtilRuntime createDefaultSysUtilRuntime(IPSSysUtil iPSSysUtil) {
{{#each system.allPSSysUtils as |sysUtil|}}
{{#if (and (eq sysUtil.utilType "USER")) (unless sysUtil.pSSysSFPlugin)}}
if(iPSSysUtil.getCodeName().equals("{{sysUtil.codeName}}"))
return new {{packageName}}.core.runtime.sysutil.{{sysUtil.codeName}}();
{{/if}}
{{/each}}
return super.createDefaultSysUtilRuntime(iPSSysUtil);
}
{{/if}}
@Override
protected void onInit() throws Exception {
this.registerDEServiceObjs();
super.onInit();
}
@Override
public IDEService getDEService(IDataEntityRuntime iDataEntityRuntime) {
if (!this.getSystemGatewayContext().isMultiSystemMode()) {
return this.getSystemGatewayContext().getDEService("{{packageName}}.core.runtime.ISystemRuntime", iDataEntityRuntime.getId());
}
return super.getDEService(iDataEntityRuntime);
}
protected void registerDEServiceObjs() {
{{#each system.allPSDataEntities as |entity|}}
this.registerDEServiceObj("{{entity.dynaModelFilePath}}","{entityService}");
{{/each}}
}
}
<#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 {{packageName}}.core.runtime.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
{{#if (and (eq sysUtil.utilType "USER")) (unless sysUtil.pSSysSFPlugin)}}
package {{packageName}}.core.runtime.sysutil;
import net.ibizsys.central.r8.sysutil.IR8SysUtilRuntime;
public interface I{{sysUtil.codeName}} extends IR8SysUtilRuntime {
}
{{/if}}
\ No newline at end of file
{{#if (and (eq sysUtil.utilType "USER")) (unless sysUtil.pSSysSFPlugin)}}
package {{packageName}}.core.runtime.sysutil;
import net.ibizsys.central.r8.sysutil.IR8SysUtilRuntime;
import net.ibizsys.central.r8.sysutil.R8SysUtilRuntimeBase;
import {{packageName}}.core.runtime.ISystemRuntime;
public class {{sysUtil.codeName}} extends R8SysUtilRuntimeBase implements I{{sysUtil.codeName}} {
public ISystemRuntime getSystemRuntime() {
return (ISystemRuntime) super.getSystemRuntime();
}
}
{{/if}}
\ No newline at end of file
package {{packageName}}.core.{{modules}}.dto;
import java.sql.Timestamp;
import java.util.List;
import java.math.BigDecimal;
import net.ibizsys.central.util.EntityDTO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import net.ibizsys.runtime.util.DataTypeUtils;
public class {{apiDto.codeName}} extends EntityDTO {
{{#each apiDto.apiDtoFields as |field|}}
/**
* {{field.logicName}}
*/
public final static String FIELD_{{upperCase field.codeName}} = "{{field.codeName}}";
/**
* 设置「{{field.logicName}}
*
* @param {{camelCase codeName}}
*/
@JsonIgnore
public {{apiDto.codeName}} set{{pascalCase codeName}}({{javaType}} {{camelCase codeName}}) {
this._set(FIELD_{{upperCase field.codeName}}, {{camelCase codeName}});
return this;
}
/**
* 获取「{{field.logicName}}」值
*
*/
@JsonIgnore
public {{javaType}} get{{pascalCase codeName}}() {
{{#if (or (eq javaType 'Integer') (eq javaType 'Long') (eq javaType 'Double') (eq javaType 'BigInteger') (eq javaType 'BigDecimal') (eq javaType 'Timestamp'))}}
try{
{{#if (eq javaType 'Timestamp')}}
return DataTypeUtils.getDateTimeValue(this._get(FIELD_{{upperCase field.codeName}}),null);
{{else}}
return DataTypeUtils.get{{javaType}}Value(this._get(FIELD_{{upperCase field.codeName}}),null);
{{/if}}
}catch (Exception e){
throw new RuntimeException(e);
}
{{else}}
return ({{javaType}}) this._get(FIELD_{{upperCase field.codeName}});
{{/if}}
}
/**
* 判断 「{{field.logicName}}」是否有值
*
*/
@JsonIgnore
public boolean contains{{pascalCase codeName}}() {
return this._contains(FIELD_{{upperCase field.codeName}});
}
/**
* 重置 「{{field.logicName}}
*
*/
@JsonIgnore
public {{apiDto.codeName}} reset{{pascalCase codeName}}() {
this._reset(FIELD_{{upperCase field.codeName}});
return this;
}
{{/each}}
}
\ No newline at end of file
package {{packageName}}.core.{{entity.module}}.service;
{{#each entity.allPSDEMethodDTOs as |deMethodDTO|}}
{{#if (or (eq deMethodDTO.type 'DEFAULT') (eq deMethodDTO.type 'DEACTIONINPUT'))}}
import {{packageName}}.core.{{entity.module}}.dto.{{deMethodDTO.name}};
{{/if}}
{{/each}}
import net.ibizsys.central.dataentity.service.IDEService;
import net.ibizsys.central.util.IEntityDTO;
import net.ibizsys.central.util.ISearchContextDTO;
import net.ibizsys.central.util.SearchContextDTO;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.model.dataentity.ds.IPSDEDataSet;
import net.ibizsys.model.dataentity.service.IPSDEMethodDTO;
import java.math.BigDecimal;
import java.util.List;
import org.springframework.data.domain.Page;
/**
* {{entity.logicName}}
{{#if entity.memo}}
* {{entity.memo}}
{{/if}}
*
*/
public interface I{{entity.codeName}}Service extends IDEService<{{entity.defaultPSDEMethodDTO.name}}, SearchContextDTO> {
{{#each entity.allPSDEFields as |field|}}
/**
* 属性: {{field.logicName}}
*/
String FIELD_{{upperCase field.name}} = "{{field.name}}";
{{/each}}
{{#each entity.allPSDEActions as |action|}}
/**
* 行为: {{action.logicName}}
*/
String ACTION_{{upperCase action.name}} = "{{action.name}}";
{{/each}}
{{#each entity.allPSDEDataQueries as |query|}}
/**
* 查询: {{query.logicName}}
*/
String DATAQUERY_{{upperCase query.name}} = "{{query.name}}";
{{/each}}
{{#each entity.allPSDEDataSets as |dataSet|}}
/**
* 集合: {{dataSet.logicName}}
*/
String DATASET_{{upperCase dataSet.name}} = "{{dataSet.name}}";
{{/each}}
@Override
default String getDataEntityId() {
return "{{entity.dynaModelFilePath}}";
}
@Override
default IEntityDTO createEntityDTO(IPSDEMethodDTO iPSDEMethodDTO) {
String strName = iPSDEMethodDTO.getName();
switch (strName) {
{{#each entity.allPSDEMethodDTOs as |deMethodDTO|}}
{{#if (or (eq deMethodDTO.type 'DEFAULT') (eq deMethodDTO.type 'DEACTIONINPUT'))}}
case "{{deMethodDTO.name}}":
return new {{deMethodDTO.name}}();
{{/if}}
{{/each}}
default:
return null;
}
}
@Override
default ISearchContextDTO createSearchContextDTO(IPSDEMethodDTO iPSDEMethodDTO) {
return new SearchContextDTO();
}
@Override
default Object executeAction(String strActionName, IPSDEAction iPSDEAction, Object[] args) throws Throwable {
switch (strActionName.toLowerCase()) {
{{#each entity.allPSDEActions as |deAction|}}
{{#if deAction.enableBackend}}
case "{{lowerCase deAction.name}}" :
{{#if neq deAction.pSDEActionReturn.type 'VOID'}}
return this.{srfmethodname(deAction.getCodeName())}(({getDEActionInputType(deAction)}) args[0]);
{{else}}
this.{srfmethodname(deAction.getCodeName())}(({getDEActionInputType(deAction)}) args[0]);
return null;
{{/if}}
{{/if}}
{{/each}}
}
return this.getDataEntityRuntime().executeAction(strActionName, iPSDEAction, args, true);
}
@Override
default Object fetchDataSet(String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args) throws Throwable {
switch (strDataSetName.toLowerCase()) {
{{#each entity.allPSDEDataSets as |deDataSet|}}
case "{{lowerCase deDataSet.name}}" :
return this.fetch{{pascalCase deDataSet.codeName}}((ISearchContextDTO) args[0]);
{{/each}}
}
return this.getDataEntityRuntime().fetchDataSet(strDataSetName, iPSDEDataSet, args, true);
}
{{#each entity.allPSDEActions as |deAction|}}
{{#if deAction.enableBackend}}
/**
* {{#if deAction.logicName}}{{deAction.logicName}}{{else}}{{deAction.name}}{{/if}}
{{#if deAction.memo}}
* {{deAction.memo}}
{{/if}}
*
* @param dto
* @throws Throwable
*/
default {getDEActionReturn(deAction)} {srfmethodname(deAction.getCodeName())}({getDEActionInput(deAction)}) throws Throwable {
{{#if neq deAction.pSDEActionReturn.type 'VOID'}}return ({getDEActionReturn(deAction)}) {{/if}}this.getDataEntityRuntime().executeAction("{deAction.getName()}", null, new Object[]{{getDEActionInputParams(deAction)}}, true);
}
{{/if}}
{{/each}}
{{#each entity.allPSDEDataSets as |dataSet|}}
{{#neq dataSet.ctionHoldera 2}}
/**
* {{#if dataSet.logicName}}{{dataSet.logicName}}{{else}}{{dataSet.name}}{{/if}}
{{#if dataSet.memo}}
* {{dataSet.memo}}
{{/if}}
*
* @param dto
* @return
* @throws Throwable
*/
default Page<{{entity.defaultPSDEMethodDTO.name}}> fetch{{pascalCase dataSet.codeName}}(ISearchContextDTO dto) throws Throwable {
return (Page<{{entity.defaultPSDEMethodDTO.name}}>) this.getDataEntityRuntime().fetchDataSet("{{dataSet.name}}", null, new Object[]{dto}, true);
}
{{/neq}}
{{/each}}
{{#each entity.allPSDEDataQueries as |dataQuery|}}
/**
* {{#if dataQuery.logicName}}{{dataQuery.logicName}}{{else}}{{dataQuery.name}}{{/if}}
{{#if dataQuery.memo}}
* {{dataQuery.memo}}
{{/if}}
*
* @param dto
* @return
* @throws Throwable
*/
default List<{{entity.defaultPSDEMethodDTO.name}}> select{{pascalCase dataQuery.codeName}}(ISearchContextDTO dto) throws Throwable {
Object obj = this.getDataEntityRuntime().selectDataQuery("{{dataQuery.name}}", dto);
return (List<{{entity.defaultPSDEMethodDTO.name}}>) obj;
}
{{/each}}
}
\ No newline at end of file
package {{packageName}}.core.{{entity.module}}.service.impl;
{{#each entity.allPSDEMethodDTOs as |deMethodDTO|}}
{{#if (or (eq deMethodDTO.type 'DEFAULT') (eq deMethodDTO.type 'DEACTIONINPUT'))}}
import {{packageName}}.core.{{entity.module}}.dto.{{deMethodDTO.name}};
{{/if}}
{{/each}}
import net.ibizsys.central.dataentity.service.DEServiceBase;
import net.ibizsys.central.dataentity.service.IDEService;
import net.ibizsys.central.r8.IR8SystemGateway;
import {{packageName}}.core.runtime.ISystemRuntime;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.central.util.SearchContextDTO;
import net.ibizsys.model.dataentity.ds.IPSDEDataSet;
import net.ibizsys.runtime.dataentity.DataEntityRuntimeException;
import net.ibizsys.runtime.dataentity.IDataEntityRuntimeContext;
import net.ibizsys.runtime.dataentity.action.IDEActionPluginRuntime;
import net.ibizsys.runtime.dataentity.ds.IDEDataSetPluginRuntime;
import net.ibizsys.runtime.util.ActionSessionManager;
import net.ibizsys.runtime.util.Errors;
import net.ibizsys.runtime.util.IAction;
import net.ibizsys.runtime.util.ITransactionalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.List;
@Service
public class {{entity.codeName}}ServiceImpl extends DEServiceBase<{{entity.defaultPSDEMethodDTO.name}}, SearchContextDTO> implements {{packageName}}.core.{{entity.module}}.service.I{{entity.codeName}}Service {
@Autowired(required = false)
IR8SystemGateway systemGateway;
ISystemRuntime iSystemRuntime;
@Override
public ISystemRuntime getSystemRuntime() {
if (this.iSystemRuntime == null)
this.iSystemRuntime = systemGateway.getSystemRuntime(ISystemRuntime.class, false);
return this.iSystemRuntime;
}
@PostConstruct
private void postConstruct() throws Exception {
if (systemGateway != null && !systemGateway.isMultiSystemMode()) {
try {
IDEService iDEService = systemGateway.getDEService("{{packageName}}.core.runtime.ISystemRuntime", this.getDataEntityId());
if(iDEService.getClass() == {{entity.codeName}}ServiceImpl.class)
systemGateway.registerDEService("{{packageName}}.core.runtime.ISystemRuntime", this.getDataEntityId(), this);
}catch (Exception e){
systemGateway.registerDEService("{{packageName}}.core.runtime.ISystemRuntime", this.getDataEntityId(), this);
}
}
}
@Override
protected void onPrepare() {
super.onPrepare();
try {
{{#each entity.allPSDEActions as |deAction|}}
<#if deAction.isEnableBackend() && !(deAction.getPSSysSFPlugin()??)>
{{#if (eq deAction.actionType 'USERCUSTOM')}}
this.getDataEntityRuntime().registerDEActionPluginRuntime(ACTION_{{upperCase deAction.name}}, new IDEActionPluginRuntime() {
@Override
public Object execute(IDataEntityRuntimeContext iDataEntityRuntimeContext, IPSDEAction iPSDEAction, Object[] args, Object actionData) throws Throwable {
{{#if neq deAction.pSDEActionReturn.type 'VOID'}}
return ActionSessionManager.getCurrentSession().execute(new IAction() {
@Override
public Object execute(Object[] args) throws Throwable {
return on{{pascalCase deAction.codeName}}(({getDEActionInputType(deAction)}) args[0]);
}
}, args, ITransactionalUtil.PROPAGATION_REQUIRED);
{{else}}
return ActionSessionManager.getCurrentSession().execute(new IAction() {
@Override
public Object execute(Object[] args) throws Throwable {
on{{pascalCase deAction.codeName}}(({getDEActionInputType(deAction)}) args[0]);
return null;
}
}, args, ITransactionalUtil.PROPAGATION_REQUIRED);
{{/if}}
}
});
{{elseif deAction.isRenderBeforeAfter}}
this.getDataEntityRuntime().registerDEActionPluginRuntime(ACTION_{{upperCase deAction.name}}, new IDEActionPluginRuntime() {
@Override
public Object execute(IDataEntityRuntimeContext iDataEntityRuntimeContext, IPSDEAction iPSDEAction, Object[] args, Object actionData) throws Throwable {
{getDEActionInputType2(deAction)} dto = ({getDEActionInputType2(deAction)}) args[0];
onBefore{deAction.getCodeName()}(dto);
<#if actionReturnType != 'VOID'>{getDEActionReturn(deAction)} result = ({getDEActionReturn(deAction)}) </#if>iDataEntityRuntimeContext.executeActionReal(iPSDEAction, args, actionData);
<#if actionReturnType != 'VOID'>
return onAfter{deAction.getCodeName()}(<#if actionReturnType != 'VOID'>result, </#if>dto);
<#else>
onAfter{deAction.getCodeName()}(<#if actionReturnType != 'VOID'> result, </#if>dto);
return null;
</#if>
}
});
</#if>
{{/if}}
{{/each}}
//结果集
{{#each entity.allPSDEDataSets as |dataSet|}}
this.getDataEntityRuntime().registerDEDataSetPluginRuntime(DATASET_{{upperCase dataSet.name}}, new IDEDataSetPluginRuntime() {
@Override
public Object fetch(IDataEntityRuntimeContext iDataEntityRuntimeContext, IPSDEDataSet iPSDEDataSet, Object[] args, Object actionData) throws Throwable {
return iDataEntityRuntimeContext.fetchDataSetReal(iPSDEDataSet, args, actionData);
}
});
{{/each}}
} catch (Throwable e) {
throw new RuntimeException(String.format("准备实体服务发生异常,%s", e.getMessage()), e);
}
}
{{#each entity.allPSDEActions as |deAction|}}
{{#if (and deAction.enableBackend (unless deAction.pSSysSFPlugin))}}
{{#if (eq deAction.actionType 'USERCUSTOM')}}
protected {getDEActionReturn(deAction)} on{{pascalCase deAction.codeName}}({getDEActionInput(deAction)}) throws Throwable {
throw new DataEntityRuntimeException(this.getDataEntityRuntime(), String.format("行为[%s]未实现", "{{#if deAction.logicName}}{{deAction.logicName}}{{else}}{{deAction.name}}{{/if}}"), Errors.NOTIMPL);
}
{{elseif deAction.isRenderBeforeAfter}}
protected void onBefore{{pascalCase deAction.codeName}}({getDEActionInput2(deAction)}) throws Throwable {
}
protected {getDEActionReturn(deAction)} onAfter{{pascalCase deAction.codeName}}({{#if neq deAction.pSDEActionReturn.type 'VOID'}}{getDEActionReturn(deAction)} result, {{/if}}{getDEActionInput2(deAction)}) throws Throwable {
{{#if neq deAction.pSDEActionReturn.type 'VOID'}}return result;{{/if}}
}
{{/if}}
{{/if}}
{{/each}}
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSLOCALE
</#ibiztemplate>
#${item.name}
<#list sys.getAllPSLanguageReses() as res>
<#assign content=res.getContent(item.id,false)>
<#if content?? && content?length gt 0>
${res.getLanResTag()}=${srfibiz5msg(content)}
</#if>
</#list>
\ No newline at end of file
<?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.6.xsd">
</databaseChangeLog>
<#if sysrun.getPSDBDevInst()??>
<#assign dbinst = sysrun.getPSDBDevInst()>
create schema if not exists ${dbinst.getUserName()};
set schema ${dbinst.getUserName()};
<#--CREATE ALIAS IF NOT EXISTS TO_NUMBER AS $$-->
<#--Long toNumber(String value) {-->
<#--return value == null ? null : Long.valueOf(value);-->
<#--}-->
<#--$$;-->
</#if>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<!--liquibase启动时需要指定chanlogxml,若无changelog,则使用此xml来初始化liquibase,使liquibase能正常启动 -->
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<include file="h2_table.xml" relativeToChangelogFile="true"/>
<include file="view.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#if sysrun.getPSDBDevInst()??>
<#assign dbinst = sysrun.getPSDBDevInst()>
<#assign curdate=.now?string["yyyyMMddHHmmss"]>
</#if>
<?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.6.xsd">
<#assign sequenceNumber=0>
<#list sys.getAllPSDataEntities() as de>
<#if de.getTableName?? &&de.getTableName()?? &&de.getStorageMode()?? &&de.getStorageMode()==1 && de.isSubSysDE()==false>
<#assign bPubDb=false>
<#if de.getAllPSDEDBConfigs()?? >
<#list de.getAllPSDEDBConfigs() as dbpub>
<#if dbpub.isPubModel() == true >
<#assign bPubDb = true>
<#break >
</#if>
</#list>
</#if>
<#assign sequenceNumber=sequenceNumber+1>
<#assign deVersion=de.getVersion()?c>
<#assign deName=de.getName()?lower_case>
<#assign hasPhisicalDEField=false>
<#comment>判断表中是否有物理属性</#comment>
<#list de.getAllPSDEFields() as defield>
<#if defield.isPhisicalDEField()==true>
<#assign hasPhisicalDEField=true>
<#break>
</#if>
</#list>
<#comment>输出表结构</#comment>
<#if bPubDb==true && hasPhisicalDEField==true>
<!--输出实体[${de.getName()}]数据结构 -->
<changeSet author="root" id="tab-${deName}-${deVersion}-${sequenceNumber}">
<createTable tableName="${de.getTableName()}">
<#list de.getAllPSDEFields() as defield>
<#if defield.isPhisicalDEField()==true><#comment>物理属性</#comment>
<#assign dataType="${srfdatatype(defield.getStdDataType())}">
<#assign javaType="${srfr7javatype(defield.stdDataType)}">
<#comment>varchar需要设置字段长度,若不设置,则liquibase比较时会自动填充,最终恢复到生产库会报错</#comment>
<#if javaType=='String'>
<#if defield.getLength()?? && defield.getLength()?c!='-1'>
<#assign dataType="${srfdatatype(defield.getStdDataType())}(${defield.getLength()?c})" >
<#else>
<#assign dataType="${srfdatatype(defield.getStdDataType())}(200)">
</#if>
<#elseif dataType?lower_case=='decimal'>
<#assign dataType="${srfdatatype(defield.getStdDataType())}(38,2)"><#comment>设置数值类型精度</#comment>
</#if>
<#if javaType='BigDecimal'>
<#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?? && (dbinst.getDBType()!='MYSQL5')>${defield.getLogicName()}</#if>" type="${dataType}">
<#if defield.isKeyDEField()==true>
<#comment>oracle中约束名长度不能大于30</#comment>
<#assign constraintName="PK_"+de.getName()+"_"+defield.getName()>
<#if constraintName?length gt 30>
<#assign constraintName=constraintName?substring(0,30)>
</#if>
<constraints primaryKey="true" primaryKeyName="${constraintName}"/>
</#if>
</column>
</#if>
</#list>
</createTable>
</changeSet>
</#if>
</#if>
</#list>
<#comment>输出外键</#comment>
<#list sys.getAllPSDataEntities() as de>
<#assign deVersion=de.getVersion()?c>
<#assign deName=de.getName()?lower_case>
<#if de.getTableName?? &&de.getTableName()?? &&de.getTableName()?upper_case!='IBZUSER'&&de.getTableName()?upper_case!='IBZFILE'&&de.getTableName()?upper_case!='IBZDATAAUDIT' &&de.getStorageMode()?? &&de.getStorageMode()==1 && de.isSubSysDE()==false>
<#assign bPubDb=false>
<#if de.getAllPSDEDBConfigs()?? >
<#list de.getAllPSDEDBConfigs() as dbpub>
<#if dbpub.isPubModel() == true >
<#assign bPubDb = true>
<#break >
</#if>
</#list>
</#if>
<#if de.getMinorPSDERs?? && de.getMinorPSDERs()?? >
<#list de.getMinorPSDERs() as fk>
<#if fk.getDERType()=='DER1N' && fk.isEnableFKey()==true>
<#if fk.getMajorPSDataEntity().getTableName()??>
<#assign sequenceNumber=sequenceNumber+1>
<#comment>oracle中约束名长度不能大于30</#comment>
<#assign fkConstraintName=fk.getName()>
<#if fkConstraintName?length gt 30>
<#assign fkConstraintName=fkConstraintName?substring(0,30)>
</#if>
<#if !P.exists("fk_",fkConstraintName,"") && bPubDb==true>
<!--输出实体[${de.getName()}]外键关系 -->
<changeSet author="root" 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>
</#if>
</#if>
</#list>
</#if>
</#if>
</#list>
</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<includeAll path="liquibase/changelog/"/>
<include file="view.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<includeAll path="liquibase/changelog/"/>
</databaseChangeLog>
\ No newline at end of file
<#if sysrun.getPSDBDevInst()??>
<#assign dbinst = sysrun.getPSDBDevInst()>
<#assign curdate=.now?string["yyyyMMddHHmmss"]>
</#if>
<?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.6.xsd">
<#assign sequenceNumber=0>
<#comment>输出视图信息</#comment>
<#list sys.getAllPSDataEntities() as de>
<#if de.getStorageMode()==1>
<#if de.getViewName?? && ((de.getViewName()!'')!='') && de.isSubSysDE()==false && de.isNoViewMode()!=true>
<#assign bPubDb=false>
<#if de.getAllPSDEDBConfigs()?? >
<#list de.getAllPSDEDBConfigs() as dbpub>
<#if dbpub.isPubModel() == true >
<#assign bPubDb = true>
<#break >
</#if>
</#list>
</#if>
<#assign sequenceNumber=sequenceNumber+1>
<#assign deVersion=de.getVersion()?c>
<#assign deName=de.getName()?lower_case>
<#if !P.exists("view_",de.getViewName(),"") && bPubDb == true>
<!--输出实体[${de.getName()}]视图结构信息 runOnChange="true" 当视图发生变更时,通过liquibase强刷prod的视图,实现视图的同步-->
<changeSet author="root" id="view-${deName}-${deVersion}-${sequenceNumber}" runOnChange="true">
<createView fullDefinition="false" replaceIfExists="true" viewName="${de.getViewName()}">
<#if de.getAllPSDEDataQueries?? && de.getAllPSDEDataQueries()??>
<#assign resultDataQuery = de.getAllPSDEDataQueries()>
<#list resultDataQuery as singleQuery>
<#if singleQuery.getCodeName()?lower_case=='default'>
<#if singleQuery.getAllPSDEDataQueryCodes()??>
<#assign queryCodeList = singleQuery.getAllPSDEDataQueryCodes()>
<#assign sql="">
<#comment>遍历数据查询,有oracle则输出,无则输出mysql</#comment>
<#list singleQuery.getAllPSDEDataQueryCodes() as dedqcode>
<#assign sql=srfjavasqlcode('${dedqcode.getQueryCode()}')>
<#assign dbtype=dedqcode.getDBType()?lower_case?replace("mysql5","mysql")>
<#if dbtype?lower_case=='oracle'>
<#break>
</#if>
</#list>
<![CDATA[ ${sql}]]>
<#break>
</#if>
</#if>
</#list>
</#if>
</createView>
</changeSet>
</#if>
</#if>
</#if>
</#list>
</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>{{projectName}}-dependencies</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
<packaging>pom</packaging>
<!-- Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>
<properties>
<!-- Spring Cloud Alibaba(2.2.x.RELEASE) & Spring Cloud(Spring Cloud Greenwich) & Spring Boot(2.2.x.RELEASE) compatibility -->
<spring-cloud-alibaba.version>2.2.1.RELEASE</spring-cloud-alibaba.version>
<spring-cloud-openfeign.version>2.2.1.RELEASE</spring-cloud-openfeign.version>
<!-- Alibaba Druid -->
<!-- <alibaba-druid.version>1.1.21</alibaba-druid.version> -->
<!-- Mybatis Plus -->
<mybatis-plus.version>3.4.1</mybatis-plus.version>
<mybatis-plus-dynamic-datasource.version>3.2.1</mybatis-plus-dynamic-datasource.version>
<!-- Swagger2 -->
<springfox-swagger.version>2.9.2</springfox-swagger.version>
<!-- JBPM+Drools -->
<drools-version>7.23.0.Final</drools-version>
<!-- Error -->
<zalando-problem-spring-web.version>0.23.0</zalando-problem-spring-web.version>
<!-- Security -->
<spring-cloud-security.version>2.1.1.RELEASE</spring-cloud-security.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!--logstash-logback-encoder-->
<logstash.version>5.2</logstash.version>
<!--Zuul网关-->
<spring-cloud-starter-netflix-zuul.version>2.2.1.RELEASE</spring-cloud-starter-netflix-zuul.version>
<!--MapStruct高性能属性映射工具-->
<mapstruct.version>1.3.0.Final</mapstruct.version>
<!--Java Web Token-->
<jsonwebtoken-jjwt.version>0.9.1</jsonwebtoken-jjwt.version>
<!--Liquibase数据库版本更新工具-->
<liquibase.version>3.9.0</liquibase.version>
<!--H2内存数据库-->
<h2.version>1.4.200</h2.version>
<!--caffeine缓存-->
<caffeine-cache.version>2.6.0</caffeine-cache.version>
<!--反序列化工具-->
<kryo.version>4.0.2</kryo.version>
<!--httpClient -->
<openfeign-httpclient.version>11.0</openfeign-httpclient.version>
<!--baomidou-jobs定时服务 -->
<baomidou-jobs.version>1.0.3</baomidou-jobs.version>
<!-- eureka微服务注册中心 -->
<eureka-client.version>2.2.1.RELEASE</eureka-client.version>
<!-- 阿里sentinel熔断器 -->
<alibaba-sentinel.version>2.1.1.RELEASE</alibaba-sentinel.version>
<!-- 阿里seata分布式事务 -->
<alibaba-seata.version>1.3.0</alibaba-seata.version>
{{#each system.allPSSystemDBConfigs as |dbConfig|}}
{{#if (eq dbConfig.dBType 'MYSQL5')}}
{{else if (eq dbConfig.dBType 'ORACLE')}}
<!-- Oracle 驱动 -->
<oracle.version>19.8.0.0</oracle.version>
{{else if (eq dbConfig.dBType 'POSTGRESQL')}}
<!-- PostgreSql 驱动 -->
<postgresql.version>42.2.6</postgresql.version>
{{/if}}
{{/each}}
{{#if system.enableMQ}}
<rocketmq.version>4.7.0</rocketmq.version>
{{/if}}
<flowable-modeler.version>6.4.2</flowable-modeler.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Alibaba Cloud -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
<version>${spring-cloud-openfeign.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<version>${alibaba-sentinel.version}</version>
</dependency>
<!-- eureka服务注册中心 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${eureka-client.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${alibaba-druid.version}</version>
</dependency>
<!-- Mybatis Plus
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${mybatis-plus-dynamic-datasource.version}</version>
</dependency> -->
<!-- Liquibase -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase.version}</version>
</dependency>
<!-- H2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<!-- Swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-swagger.version}</version>
</dependency>
<!-- JBPM -->
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
<version>${drools-version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<version>${drools-version}</version>
</dependency>
<!-- Drools -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools-version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools-version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${drools-version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${drools-version}</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>${logstash.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
<version>${spring-cloud-starter-netflix-zuul.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-security</artifactId>
<version>${spring-cloud-security.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jsonwebtoken-jjwt.version}</version>
</dependency>
<dependency>
<groupId>org.zalando</groupId>
<artifactId>problem-spring-web</artifactId>
<version>${zalando-problem-spring-web.version}</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>${caffeine-cache.version}</version>
</dependency>
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo-shaded</artifactId>
<version>${kryo.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>${openfeign-httpclient.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>jobs-spring-boot-starter</artifactId>
<version>${baomidou-jobs.version}</version>
</dependency>
{{#if system.enableGlobalTransaction}}
<!-- 阿里seata分布式事务 -->
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<version>${alibaba-seata.version}</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
{{/if}}
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>${flowable-modeler.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-conf</artifactId>
<version>${flowable-modeler.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Spring Boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Spring Cloud -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!-- Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- Httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<!-- Liquibase -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<!-- H2内存库 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
{{#each system.allPSSystemDBConfigs as |dbConfig|}}
{{#if (eq dbConfig.dBType 'MYSQL5')}}
<!-- MySQL驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>
{{else if (eq dbConfig.dBType 'ORACLE')}}
<!-- Oracle驱动包 -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${oracle.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>${oracle.version}</version>
</dependency>
{{else if (eq dbConfig.dBType 'POSTGRESQL')}}
<!-- PostgreSQL驱动包 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
{{/if}}
{{/each}}
{{#if system.enableES}}
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
{{/if}}
{{#if system.enableMQ}}
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
{{/if}}
{{#each system.allPSSysSFPubs as |pub|}}
{{#eq pub.contentType "CODE"}}
{{#each pub.getPSSysSFPubPkgs as |package|}}
{{#if package.pkgParam}}
{{package.pkgParam}}
{{/if}}
{{/each}}
{{/eq}}
{{/each}}
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>{{projectName}}-provider</artifactId>
<dependencies>
<dependency>
<groupId>{{packageName}}</groupId>
<artifactId>{{projectName}}-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<docker.image.prefix>registry.cn-shanghai.aliyuncs.com/ibizsys</docker.image.prefix>
</properties>
<profiles>
<profile>
<id>runtime</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>{{projectName}}-provider</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>{{packageName}}.IBizRuntimeApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
{{!--
<#if pub.getPSDeployCenter()?? && pub.getPSDeployCenter().getPSRegistryRepo()??>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<serverId>ibiz-dev</serverId>
<imageName>${docker.image.prefix}/${project.artifactId}:latest</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>../</directory>
<include>${project.artifactId}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>prepare</id>
<configuration>
<executable>cp</executable>
<arguments>
<argument>../${project.artifactId}.jar</argument>
<argument>${project.basedir}/src/main/docker/</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>buildpush</id>
<configuration>
<executable>docker</executable>
<arguments>
<argument>buildx</argument>
<argument>build</argument>
<argument>--platform</argument>
<argument>linux/amd64,linux/arm64</argument>
<argument>-t</argument>
<argument>${docker.image.prefix}/${project.artifactId}:latest</argument>
<argument>${project.basedir}/src/main/docker</argument>
<argument>--push</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-model</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<!-- 输出目录 -->
<outputDirectory>${project.build.outputDirectory}/model--${sys.getPubSystemId()}--${sys.getSysVersion()}</outputDirectory>
<resources>
<resource>
<!-- 资源目录 -->
<directory>${project.basedir}/../model</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</#if>
--}}
</plugins>
</build>
</profile>
</profiles>
</project>
FROM image.ibizlab.cn/library/openjdk:8-jre-alpine
ENV TZ=Asia/Shanghai \
SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
IBIZ_SLEEP=0 \
JAVA_OPTS=""
CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Duser.timezone=$TZ -Djava.security.egd=file:/dev/./urandom -jar /{{projectName}}-provider.jar
EXPOSE 8081
ADD {{projectName}}-provider.jar /{{projectName}}-provider.jar
<#ibiztemplate>
TARGET=PSSYSSERVICEAPI
</#ibiztemplate>
<#assign httpPort = "8081">
<#assign nacosUrl = "127.0.0.1:8848" >
<#assign redisHost = "127.0.0.1" >
<#assign redisPort = "6379" >
<#assign redisDataBase = "0" >
<#assign dbUserName="root">
<#assign dbPassWord="123456">
<#assign dbUrl="jdbc:mysql://127.0.0.1:3306/"+sys.name+"?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true">
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dockerPortMap="">
<#if sysrun?? && sysrun.getPSDevSlnMSDepAPI()?? >
<#assign depSysApi=sysrun.getPSDevSlnMSDepAPI()>
<#if depSysApi.getHttpPort()??>
<#assign httpPort = depSysApi.getHttpPort()?c>
</#if>
<#if depSysApi.getPSDCMSPlatformNode()??>
<#assign depSysApiPlatformNode=depSysApi.getPSDCMSPlatformNode()>
<#assign depSysApiPlatform=depSysApi.getPSDCMSPlatform()>
<#if depSysApiPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = depSysApiPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#if depSysApi.getUserParam("spring.redis.host","")?? && depSysApi.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depSysApi.getUserParam("spring.redis.host","")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.host","")?? && depSysApiPlatform.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depSysApiPlatform.getUserParam("spring.redis.host","")>
</#if>
<#if depSysApi.getUserParam("spring.redis.port","")?? && depSysApi.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depSysApi.getUserParam("spring.redis.port")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.port","")?? && depSysApiPlatform.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depSysApiPlatform.getUserParam("spring.redis.port")>
</#if>
<#if depSysApi.getUserParam("spring.redis.database","")?? && depSysApi.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depSysApi.getUserParam("spring.redis.database","")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.database","")?? && depSysApiPlatform.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depSysApiPlatform.getUserParam("spring.redis.database","")>
</#if>
<#if depSysApi.getUserParam("portmap","")?? && depSysApi.getUserParam("portmap","")!="">
<#assign dockerPortMap= depSysApi.getUserParam("portmap","")>
</#if>
</#if>
</#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&serverTimezone=GMT%2B8">
<#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>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{projectName}}-provider
labels:
app: {{projectName}}-provider
spec:
replicas: 1
selector:
matchLabels:
app: {{projectName}}-provider
template:
metadata:
labels:
app: {{projectName}}-provider
spec:
imagePullSecrets:
- name: aly-shanghai
containers:
- name: {{projectName}}-provider
image: registry.cn-shanghai.aliyuncs.com/ibizsys/{{projectName}}-provider:latest
imagePullPolicy: Always
ports:
- containerPort: ${httpPort}
<#if sysrun?? && sysrun.getPSDevSlnMSDepAPI()?? && sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()??>
<#assign depSysApi=sysrun.getPSDevSlnMSDepAPI()>
<#assign depSysApiPlatformNode=sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()>
<#assign depSysApiPlatform=sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatform()>
env:
<#if depSysApiPlatformNode.getSSHIPAddr()??>
- name: SPRING_CLOUD_NACOS_DISCOVERY_IP
value: "${depSysApiPlatformNode.getSSHIPAddr()}"
</#if>
<#comment>系统运行参数设置,从SysRun中获取到当前部署相关信息</#comment>
- name: SERVER_PORT
value: "${httpPort}"
- name: SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR
value: "${nacosUrl}"
- name: SPRING_REDIS_HOST
value: "${redisHost}"
- name: SPRING_REDIS_PORT
value: "${redisPort}"
- name: SPRING_REDIS_DATABASE
value: "${redisDataBase}"
- name: SPRING_DATASOURCE_USERNAME
value: "${dbUserName}"
- name: SPRING_DATASOURCE_PASSWORD
value: "${dbPassWord}"
- name: SPRING_DATASOURCE_URL
value: "${dbUrl}"
- name: SPRING_DATASOURCE_DRIVER-CLASS-NAME
value: "${dbDriver}"
- name: SPRING_DATASOURCE_DEFAULTSCHEMA
value: "${dbUserName}"
<#comment>输出服务接口自定义参数替换标准参数</#comment>
<#if depSysApi.getUserParamNames()??>
<@outputUserParam depSysApi depSysApi.getUserParamNames()/>
</#if>
<#comment>输出微服务平台自定义参数替换标准参数</#comment>
<#if depSysApiPlatform.getUserParamNames()??>
<@outputUserParam depSysApiPlatform depSysApiPlatform.getUserParamNames()/>
</#if>
</#if>
---
apiVersion: v1
kind: Service
metadata:
name: {{projectName}}-provider
labels:
app: {{projectName}}-provider
spec:
type: NodePort
ports:
- name: http
port: ${httpPort}
targetPort: ${httpPort}
nodePort: ${httpPort}
protocol: TCP
<#if dockerPortMap!=''>
- name: portmap
port: ${dockerPortMap}
targetPort: ${dockerPortMap}
nodePort: ${dockerPortMap}
protocol: TCP
</#if>
selector:
app: {{projectName}}-provider
<#comment>输出用户自定义参数</#comment>
<#macro outputUserParam paramObj paramList>
<#list paramList as param>
<#assign userParamkey=param?upper_case?replace(".","_")>
<#comment>nacos、数据库连接等信息从sysRun中获取</#comment>
<#if userParamkey!="SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR" && userParamkey!="SPRING_REDIS_HOST" &&
userParamkey!="SERVER_PORT" &&userParamkey!="SPRING_REDIS_PORT" &&userParamkey!="SPRING_REDIS_DATABASE"
&&userParamkey!="SPRING_DATASOURCE_USERNAME" &&userParamkey!="SPRING_DATASOURCE_PASSWORD"
&&userParamkey!="SPRING_DATASOURCE_URL" &&userParamkey!="SPRING_DATASOURCE_DRIVER-CLASS-NAME" &&userParamkey!="SPRING_DATASOURCE_DEFAULTSCHEMA">
<#comment>扩展标准配置:用户配置参数替换标准配置(application-sys.yml)</#comment>
<#if !P.exists('SysApiDeployUserParam',param)>
- name: ${userParamkey}
value: "${paramObj.getUserParam(param,"")}"
</#if>
</#if>
</#list>
</#macro>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSSERVICEAPI
</#ibiztemplate>
<#assign httpPort = "8081">
<#assign nacosUrl = "127.0.0.1:8848" >
<#assign redisHost = "127.0.0.1" >
<#assign redisPort = "6379" >
<#assign redisDataBase = "0" >
<#assign dbUserName="root">
<#assign dbPassWord="123456">
<#assign dbUrl="jdbc:mysql://127.0.0.1:3306/"+sys.name+"?useSSL=false&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true">
<#assign dbDriver="com.mysql.jdbc.Driver">
<#assign dockerPortMap="">
<#if sysrun?? && sysrun.getPSDevSlnMSDepAPI()?? >
<#assign depSysApi=sysrun.getPSDevSlnMSDepAPI()>
<#if depSysApi.getHttpPort()??>
<#assign httpPort = depSysApi.getHttpPort()?c>
</#if>
<#if depSysApi.getPSDCMSPlatformNode()??>
<#assign depSysApiPlatformNode=depSysApi.getPSDCMSPlatformNode()>
<#assign depSysApiPlatform=depSysApi.getPSDCMSPlatform()>
<#if depSysApiPlatform.getUserParam("nacos","127.0.0.1:8848")??>
<#assign nacosUrl = depSysApiPlatform.getUserParam("nacos","127.0.0.1:8848")>
</#if>
<#if depSysApi.getUserParam("spring.redis.host","")?? && depSysApi.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depSysApi.getUserParam("spring.redis.host","")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.host","")?? && depSysApiPlatform.getUserParam("spring.redis.host","")!="">
<#assign redisHost = depSysApiPlatform.getUserParam("spring.redis.host","")>
</#if>
<#if depSysApi.getUserParam("spring.redis.port","")?? && depSysApi.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depSysApi.getUserParam("spring.redis.port")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.port","")?? && depSysApiPlatform.getUserParam("spring.redis.port","")!="">
<#assign redisPort = depSysApiPlatform.getUserParam("spring.redis.port")>
</#if>
<#if depSysApi.getUserParam("spring.redis.database","")?? && depSysApi.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depSysApi.getUserParam("spring.redis.database","")>
<#elseif depSysApiPlatform.getUserParam("spring.redis.database","")?? && depSysApiPlatform.getUserParam("spring.redis.database","")!="">
<#assign redisDataBase = depSysApiPlatform.getUserParam("spring.redis.database","")>
</#if>
<#if depSysApi.getUserParam("portmap","")?? && depSysApi.getUserParam("portmap","")!="">
<#assign dockerPortMap= depSysApi.getUserParam("portmap","")>
</#if>
</#if>
</#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&serverTimezone=GMT%2B8">
<#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>
version: "3.2"
services:
{{projectName}}-provider:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/{{projectName}}-provider:latest
ports:
- "${httpPort}:${httpPort}"
<#if dockerPortMap!=''>
- "${dockerPortMap}"
</#if>
networks:
- agent_network
<#if sysrun?? && sysrun.getPSDevSlnMSDepAPI()?? && sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()??>
<#assign depSysApi=sysrun.getPSDevSlnMSDepAPI()>
<#assign depSysApiPlatformNode=sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatformNode()>
<#assign depSysApiPlatform=sysrun.getPSDevSlnMSDepAPI().getPSDCMSPlatform()>
environment:
<#if depSysApiPlatformNode.getSSHIPAddr()??>
- SPRING_CLOUD_NACOS_DISCOVERY_IP=${depSysApiPlatformNode.getSSHIPAddr()}
</#if>
<#comment>系统运行参数设置,从SysRun中获取到当前部署相关信息</#comment>
- SERVER_PORT=${httpPort}
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=${nacosUrl}
- SPRING_REDIS_HOST=${redisHost}
- SPRING_REDIS_PORT=${redisPort}
- SPRING_REDIS_DATABASE=${redisDataBase}
- SPRING_DATASOURCE_USERNAME=${dbUserName}
- SPRING_DATASOURCE_PASSWORD=${dbPassWord}
- SPRING_DATASOURCE_URL=${dbUrl}
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=${dbDriver}
- SPRING_DATASOURCE_DEFAULTSCHEMA=${dbUserName}
<#comment>输出服务接口自定义参数替换标准参数</#comment>
<#if depSysApi.getUserParamNames()??>
<@outputUserParam depSysApi depSysApi.getUserParamNames()/>
</#if>
<#comment>输出微服务平台自定义参数替换标准参数</#comment>
<#if depSysApiPlatform.getUserParamNames()??>
<@outputUserParam depSysApiPlatform depSysApiPlatform.getUserParamNames()/>
</#if>
</#if>
deploy:
resources:
limits:
memory: 4048M
reservations:
memory: 400M
mode: replicated
replicas: 1
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
volumes:
- "nfs:/app/file"
volumes:
nfs:
driver: local
driver_opts:
type: "nfs"
o: "addr=172.16.240.109,rw"
device: ":/nfs"
networks:
agent_network:
driver: overlay
attachable: true
<#comment>输出用户自定义参数</#comment>
<#macro outputUserParam paramObj paramList>
<#list paramList as param>
<#assign userParamkey=param?upper_case?replace(".","_")>
<#comment>nacos、数据库连接等信息从sysRun中获取</#comment>
<#if userParamkey!="SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR" && userParamkey!="SPRING_REDIS_HOST" &&
userParamkey!="SERVER_PORT" &&userParamkey!="SPRING_REDIS_PORT" &&userParamkey!="SPRING_REDIS_DATABASE"
&&userParamkey!="SPRING_DATASOURCE_USERNAME" &&userParamkey!="SPRING_DATASOURCE_PASSWORD"
&&userParamkey!="SPRING_DATASOURCE_URL" &&userParamkey!="SPRING_DATASOURCE_DRIVER-CLASS-NAME" &&userParamkey!="SPRING_DATASOURCE_DEFAULTSCHEMA">
<#comment>扩展标准配置:用户配置参数替换标准配置(application-sys.yml)</#comment>
<#if !P.exists('SysApiDeployUserParam',param)>
- ${userParamkey}=${paramObj.getUserParam(param,"")}
</#if>
</#if>
</#list>
</#macro>
\ No newline at end of file
package {{packageName}};
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@Slf4j
@EnableDiscoveryClient
@Configuration
@EnableTransactionManagement
@ComponentScan(basePackages = { "net.ibizsys.central.database", "net.ibizsys.central.r8", "{{packageName}}" })
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
})
@Import({ org.springframework.cloud.openfeign.FeignClientsConfiguration.class })
@EnableFeignClients(basePackages = { "net.ibizsys.central.r8", "{{packageName}}" })
@EnableAsync
@EnableScheduling
public class IBizRuntimeApplication extends WebMvcConfigurerAdapter {
public static void main(String[] args) {
SpringApplication.run(IBizRuntimeApplication.class, args);
}
}
package {{packageName}}.config;
import net.ibizsys.central.r8.security.AuthorizationTokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.core.GrantedAuthorityDefaults;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class SampleApiSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationEntryPoint unauthorizedHandler;
@Autowired
private UserDetailsService userDetailsService;
/**
* 自定义基于JWT的安全过滤器
*/
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}")
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}")
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Value("${ibiz.auth.excludesPattern:}")
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoderBean());
}
@Bean
GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}
@Bean
public PasswordEncoder passwordEncoderBean() {
return new BCryptPasswordEncoder();
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/**/*.ico", "/**/assets/**",
"/**/css/**", "/**/fonts/**", "/**/js/**", "/**/img/**", "/", "webjars/**", "/swagger-resources/**",
"/v2/**")
.permitAll()
// 放行登录请求
.antMatchers(HttpMethod.POST, "/" + loginPath).permitAll()
// 放行注销请求
//.antMatchers(HttpMethod.GET, "/" + logoutPath).permitAll()
// 文件操作
.antMatchers("/" + downloadpath + "/**").permitAll().antMatchers("/" + uploadpath).permitAll()
.antMatchers("/" + previewpath + "/**").permitAll();
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
// 所有请求都需要认证
httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
}
#eureka配置中心
spring:
cloud:
nacos:
discovery:
enabled: false
eureka:
client:
enabled: true
serviceUrl:
defaultZone: http://127.0.0.1:8762/eureka/
#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:
jackson:
time-zone: GMT+8
cache:
redis:
time-to-live: 72000
caffeine:
spec: initialCapacity=5,maximumSize=500,expireAfterWrite=72000s
redis:
host: 172.16.240.110
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: a_LAB01_da1af574b
password: 'D33f8870'
url: jdbc:mysql://172.16.186.185:3306/a_LAB01_da1af574b?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&serverTimezone=Asia/Shanghai&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
driver-class-name: com.mysql.jdbc.Driver
isSyncDBSchema: false
defaultSchema: a_LAB01_da1af574b
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: ${spring.datasource.username}
password: ${spring.datasource.password}
url: ${spring.datasource.url}
driver-class-name: ${spring.datasource.driver-class-name}
#启动是否加载liquibase构建表结构
liquibase:
enabled: false
change-log: classpath:liquibase/master.xml
# 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
type-handlers-package: net.ibizsys.central.database.mybatis.typehandler
{{#if system.enableES}}
management:
health:
elasticsearch:
enabled: false
{{/if}}
# 阿里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
#zuul网关超时设置
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
{{#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:
net.ibizsys.central.database.mybatis: INFO
org.springframework.boot.autoconfigure: ERROR
#系统是否开启权限验证、是否开启缓存
#缓存级别:无缓存(无配置项)、一级缓存(L1)、二级缓存(L2)
ibiz:
systemid: {{system.codeName}}
systemname: {{system.logicName}}
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
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="logs" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %-40.40logger{39} : %msg%n" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="LOG_PATTERN2" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([${LOG_LEVEL_PATTERN:-%5p}]) %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
<!-- 控制台输出 -->
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 按照每天生成日志文件 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_PATH}/{{projectName}}-provider.%d{yyyy-MM-dd}.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
<!-- <appender-ref ref="file" /> -->
</root>
</configuration>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册