提交 3325f282 编写于 作者: ibizdev's avatar ibizdev

init

上级 f8a39c95
JAVAEE_IBIZ_R7 master
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}-app-usr</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-app-usr-${app.getPKGCodeName()?lower_case}</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} User Code ${app.getPKGCodeName()}</name>
<description>${pub.getCodeName()?lower_case?cap_first} User Code ${app.getPKGCodeName()}</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-app-usr</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} User Code</name>
<description>${pub.getCodeName()?lower_case?cap_first} user code</description>
<packaging>pom</packaging>
<#-- modules -->
<#if sys.getAllPSApps()??>
<modules>
<#list sys.getAllPSApps() as app>
<module>${pub.getCodeName()?lower_case}-app-usr-${app.getPKGCodeName()?lower_case}</module>
</#list>
</modules>
</#if>
<dependencies>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}-app</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} ${app.getPKGCodeName()}</name>
<description>${pub.getCodeName()?lower_case?cap_first} ${app.getPKGCodeName()}</description>
<dependencies>
<#if app.getAppMode()?? && app.getAppMode() == "WFAPP">
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-workflow</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</#if>
</dependencies>
<profiles>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>exec-yarn-run-install</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<workingDirectory>../../app_${app.getPKGCodeName()}</workingDirectory>
</configuration>
</execution>
<execution>
<id>exec-yarn-run-build</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>build</argument>
</arguments>
<workingDirectory>../../app_${app.getPKGCodeName()}</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<resources>
<resource>
<directory>${r'${basedir}'}/src/main/webapp</directory>
<!--注意此次必须要放在此目录下才能被访问到 -->
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
</resource>
<resource>
<directory>${r'${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>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${app.getPKGCodeName()}Application</mainClass>
<#-- <outputDirectory>../</outputDirectory> -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case};
import java.util.List;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.fasterxml.jackson.databind.ObjectMapper;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
import ${pub.getPKGCodeName()}.util.serialize.DomainSerializerProvider;
import lombok.Data;
@SpringBootApplication(exclude = {
})
@Import({
FeignClientsConfiguration.class
})
@ComponentScans({
@ComponentScan(basePackages = {"${pub.getPKGCodeName()}.util", "${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}"})
})
@EnableDiscoveryClient
@Configuration
@EnableFeignClients
<#if app.getPSSysServiceAPI()??>
@EnableConfigurationProperties(${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${app.getPKGCodeName()}Application.${app.getPSSysServiceAPI().getCodeName()}ClientProperties.class)
</#if>
public class ${app.getPKGCodeName()}Application extends WebMvcConfigurerAdapter{
public static void main(String[] args) {
SpringApplicationBuilder builder=new SpringApplicationBuilder(${app.getPKGCodeName()}Application.class);
builder.run(args);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter(ObjectMapper objectMapper) {
objectMapper.setSerializerProvider(new DomainSerializerProvider()) ;
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(objectMapper);
return converter;
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new SearchContextHandlerMethodArgumentResolver());
}
<#if app.getPSSysServiceAPI()??>
@ConfigurationProperties(prefix = "app.service.${app.getPSSysServiceAPI().getCodeName()?lower_case?replace('_','.')}")
@Data
public class ${app.getPSSysServiceAPI().getCodeName()}ClientProperties {
private String tokenUrl ;
private String clientId ;
private String clientSecret ;
private String serviceUrl ;
private String serviceId ;
}
</#if>
}
<#ibiztemplate>
TARGET=PSAPPDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${de.getPSSystemModule().getCodeName()?lower_case}.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 应用实体[${item.getLogicName()}]
*/
public class ${item.getCodeName()} implements Serializable {
private static final long serialVersionUID = 1L;
<#if item.getAllPSAppDEFields()??>
<#list item.getAllPSAppDEFields() as appfield>
/**
* ${appfield.getPSDEField().getLogicName()}
*/
private ${srfjavatype(appfield.getStdDataType())} ${appfield.getCodeName()?cap_first};
@JsonIgnore
private boolean ${appfield.getCodeName()?cap_first}DirtyFlag;
</#list>
<#list item.getAllPSAppDEFields() as appfield>
/**
* 获取 [${appfield.getPSDEField().getLogicName()}]
*/
@JsonProperty("${appfield.getCodeName()?lower_case}")
public ${srfjavatype(appfield.getStdDataType())} get${appfield.getCodeName()?cap_first}(){
return ${appfield.getCodeName()?cap_first} ;
}
/**
* 设置 [${appfield.getPSDEField().getLogicName()}]
*/
@JsonProperty("${appfield.getCodeName()?lower_case}")
public void set${appfield.getCodeName()?cap_first}(${srfjavatype(appfield.getStdDataType())} ${appfield.getCodeName()?uncap_first}){
this.${appfield.getCodeName()?cap_first} = ${appfield.getCodeName()?uncap_first} ;
this.${appfield.getCodeName()?cap_first}DirtyFlag = true ;
}
/**
* 获取 [${appfield.getPSDEField().getLogicName()}]脏标记
*/
@JsonIgnore
public boolean get${appfield.getCodeName()?cap_first}DirtyFlag(){
return this.${appfield.getCodeName()?cap_first}DirtyFlag ;
}
</#list>
</#if>
<#comment>嵌套对象</#comment>
<#if item.getMajorPSAppDERSs()?? >
<#list item.getMajorPSAppDERSs() as appder>
<#assign subs = srfpluralize(appder.getMinorPSAppDataEntity().getCodeName())?lower_case >
<#-- <#if appder.getParentFilter()?? >
<#assign subs = appder.getParentFilter()?uncap_first >
<#else>
<#if appder.getPSDER1N()??>
<#assign subs = appder.getPSDER1N().getCodeName()?uncap_first >
</#if>
</#if> -->
private List <${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${appder.getMinorPSAppDataEntity().getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.domain.${appder.getMinorPSAppDataEntity().getCodeName()}> ${subs} = new ArrayList<${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${appder.getMinorPSAppDataEntity().getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.domain.${appder.getMinorPSAppDataEntity().getCodeName()}>() ;
public List<${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${appder.getMinorPSAppDataEntity().getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.domain.${appder.getMinorPSAppDataEntity().getCodeName()}> get${subs?cap_first}(){
return ${subs} ;
}
public void set${subs?cap_first}(List <${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${appder.getMinorPSAppDataEntity().getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.domain.${appder.getMinorPSAppDataEntity().getCodeName()}> ${subs}){
this.${subs} = ${subs} ;
}
</#list>
</#if>
}
<#ibiztemplate>
TARGET=PSAPPDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.${de.getPSSystemModule().codeName?lower_case}.filter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import ${pub.getPKGCodeName()}.util.SearchContext;
@Data
public class ${item.getCodeName()}SearchContext extends SearchContext implements Serializable {
<#list de.getPSDEFields() as defield>
<#if defield.getAllPSDEFSearchModes()??>
<#list defield.getAllPSDEFSearchModes() as formitem>
<#assign defDataType=formitem.getPSDEField().getDataType()>
<#if defDataType == "DATETIME">
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
<#elseif defDataType == "DATE">
@JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8")
<#elseif defDataType == "TIME">
@JsonFormat(pattern="HH:mm", timezone="GMT+8")
</#if>
public ${srfjavatype(formitem.getPSDEField().stdDataType)} ${formitem.getName()?lower_case};//[${defield.getLogicName()}]
</#list>
</#if>
</#list>
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#if app.getAppMode()?? && app.getAppMode() == "WFAPP" && app.getAllPSAppWFs()??>
package ${pub.getPKGCodeName()}.${app.getPKGCodeName()?lower_case}.job;
import feign.Client;
import feign.Contract;
import feign.Feign;
import feign.codec.Decoder;
import feign.codec.Encoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import org.springframework.core.io.ClassPathResource;
import java.io.InputStream;
import java.util.List;
import java.util.ArrayList;
import ${pub.getPKGCodeName()}.util.config.SysInfoProperties;
import ${pub.getPKGCodeName()}.util.feign.FeignRequestInterceptor;
import ${pub.getPKGCodeName()}.util.config.UniWFClientProperties;
import ${pub.getPKGCodeName()}.util.feign.UniWFFeignClient;
import ${pub.getPKGCodeName()}.util.domain.PSWFVersion;
import ${pub.getPKGCodeName()}.util.domain.WFApp;
/**
*
*/
@Component
public class WFAppJob implements ApplicationRunner {
UniWFFeignClient uniWFFeignClient;
@Autowired
SysInfoProperties sysInfoProperties;
@Autowired
public WFAppJob(Decoder decoder, Encoder encoder, Client client, Contract contract, FeignRequestInterceptor feignRequestInterceptor, UniWFClientProperties uniWFClientProperties) {
if (uniWFClientProperties.getServiceId()!=null) {
Feign.Builder nameBuilder = Feign.builder()
.client(client)
.encoder(encoder)
.decoder(decoder)
.contract(contract)
.requestInterceptor(feignRequestInterceptor)
;
this.uniWFFeignClient = nameBuilder.target(UniWFFeignClient.class,"http://" + uniWFClientProperties.getServiceId() + "/") ;
} else if (uniWFClientProperties.getServiceUrl()!=null) {
if (client instanceof LoadBalancerFeignClient) {
client = ((LoadBalancerFeignClient) client).getDelegate();
}
Feign.Builder nameBuilder = Feign.builder()
.client(client)
.encoder(encoder)
.decoder(decoder)
.contract(contract)
.requestInterceptor(feignRequestInterceptor)
;
this.uniWFFeignClient = nameBuilder.target(UniWFFeignClient.class, "http://" + uniWFClientProperties.getServiceUrl() + "/") ;
}
}
@Override
public void run(ApplicationArguments args) throws Exception {
/* ---------- 工作流应用注册内容 ---------- */
// 注册业务工作流版本
WFApp wfapp = new WFApp();
wfapp.setWfappid(sysInfoProperties.getAppid());
wfapp.setWfappname(sysInfoProperties.getAppname());
wfapp.setPssystemid(sysInfoProperties.getSystemid());
wfapp.setWorkflowid(sysInfoProperties.getDomainid());
wfapp.setServiceid(sysInfoProperties.getServiceid());
wfapp.setServiceurl(sysInfoProperties.getServiceurl());
wfapp.setLogicname(sysInfoProperties.getApplogicname());
uniWFFeignClient.registWFApp(wfapp);
// 注册业务工作流版本
List<PSWFVersion> pswfversions = new ArrayList<PSWFVersion>();
<#assign i = 0>
<#list app.getAllPSAppWFVers() as wfver>
<#assign appwf = wfver.getPSAppWF()>
<#assign wf = appwf.getPSWorkflow()>
PSWFVersion pswfversion${i} = new PSWFVersion();
pswfversion${i}.setPswfversionid("${wfver.getId()}");
pswfversion${i}.setPswfversionname("${wfver.getCodeName()}");
pswfversion${i}.setLogicname("${wfver.getName()}");
<#if wfver.getPSWFVersion().getWFMode()??>
pswfversion${i}.setWfmodeid("${wfver.getPSWFVersion().getWFMode()}");
</#if>
pswfversion${i}.setPsworkflowid("${wf.getId()}");
pswfversion${i}.setPsworkflowname("${wf.getCodeName()}");
pswfversion${i}.setWfappid(sysInfoProperties.getAppid());
pswfversion${i}.setPssystemid(sysInfoProperties.getSystemid());
pswfversion${i}.setWorkflowid(sysInfoProperties.getDomainid());
// 文件传入
ClassPathResource pswfversion${i}DesignFile = new ClassPathResource("workflow/${wfver.getCodeName()}.bpmn");
InputStream pswfversion${i}Is = null;
try {
pswfversion${i}Is = pswfversion${i}DesignFile.getInputStream();
byte[] pswfversion${i}Content = new byte[pswfversion${i}Is.available()];
pswfversion${i}Is.read(pswfversion${i}Content);
pswfversion${i}.setFilename(pswfversion${i}.getPswfversionid() + "${wfver.getCodeName()}.bpmn");
pswfversion${i}.setFilecontent(pswfversion${i}Content);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (pswfversion${i}Is != null) {
try {
pswfversion${i}Is.close();
} catch (Exception e2) {
e2.printStackTrace();
}
}
pswfversion${i}Is = null;
}
pswfversions.add(pswfversion${i});
<#assign i++>
</#list>
uniWFFeignClient.registPSWFVersion(pswfversions);
}
}
</#if>
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
<#assign httpPort = "8080">
<#if sysrun?? >
<#if sysrun.getPSDevSlnMSDepApp()??>
<#-- 微服务部署APP -->
<#if sysrun.getPSDevSlnMSDepApp().getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepApp().getHttpPort()?c>
</#if>
</#if>
</#if>
server:
port: ${httpPort}
spring:
application:
name: ${app.getPKGCodeName()?lower_case}
cloud:
nacos:
discovery:
server-addr: 172.16.102.211:8848
feign:
sentinel:
enabled: true
# Logger Config
logging:
level:
com.sinosig: debug
ibiz:
appid: ${app.getId()}
appname: ${app.getName()}
applogicname: ${app.getPKGCodeName()}
<#if app.getPSSysServiceAPI()??>
app:
service:
${app.getPSSysServiceAPI().getCodeName()?lower_case}:
service-id: ${app.getPSSysServiceAPI().getServiceCodeName()?lower_case}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
spring:
profiles:
include: ${app.getPKGCodeName()?lower_case}<#if app.getAppMode()?? && app.getAppMode() == "WFAPP" && app.getAllPSAppWFs()??>, wf</#if>
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
Read Me
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-app</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Application</name>
<description>${pub.getCodeName()?lower_case?cap_first} Application</description>
<packaging>pom</packaging>
<#-- modules -->
<#if sys.getAllPSApps()??>
<modules>
<#list sys.getAllPSApps() as app>
<module>${pub.getCodeName()?lower_case}-app-${app.getPKGCodeName()?lower_case}</module>
</#list>
</modules>
</#if>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-boot</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Boot</name>
<description>${pub.getCodeName()?lower_case?cap_first} Boot</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-core</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-mybatis</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<#if sys.getAllPSSysServiceAPIs()??>
<#list sys.getAllPSSysServiceAPIs() as sysapi>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-service-${sysapi.getCodeName()?lower_case}</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-service-usr-${sysapi.getCodeName()?lower_case}</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</#list>
</#if>
<#if sys.getAllPSSubSysServiceAPIs()??>
<#list sys.getAllPSSubSysServiceAPIs() as subapi>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-client-${subapi.getCodeName()?lower_case}</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</#list>
</#if>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-usr</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${r'${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>${pub.codeName?lower_case}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>${pub.getPKGCodeName()}.${pub.codeName?cap_first}Application</mainClass>
<#-- <outputDirectory>../</outputDirectory> -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()};
import java.util.List;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.fasterxml.jackson.databind.ObjectMapper;
import ${pub.getPKGCodeName()}.util.web.SearchContextHandlerMethodArgumentResolver;
import ${pub.getPKGCodeName()}.util.serialize.DomainSerializerProvider;
import ${pub.getPKGCodeName()}.util.helper.UniqueNameGenerator;
@SpringBootApplication(exclude = {
})
@Import({
// ${pub.getPKGCodeName()}
})
@EnableDiscoveryClient
@Configuration
@ComponentScan(nameGenerator = UniqueNameGenerator.class)
@EnableTransactionManagement
public class ${pub.codeName?cap_first}Application extends WebMvcConfigurerAdapter {
public static void main(String[] args) {
SpringApplicationBuilder builder=new SpringApplicationBuilder(${pub.codeName?cap_first}Application.class);
builder.run(args);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter(ObjectMapper objectMapper) {
objectMapper.setSerializerProvider(new DomainSerializerProvider()) ;
final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(objectMapper);
return converter;
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new SearchContextHandlerMethodArgumentResolver());
}
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#if sys.getAllPSWorkflows()?? && srflist(sys.getAllPSWorkflows())?size gt 0>
package ${pub.getPKGCodeName()}.job;
import feign.Client;
import feign.Contract;
import feign.Feign;
import feign.codec.Decoder;
import feign.codec.Encoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import java.util.List;
import java.util.ArrayList;
import ${pub.getPKGCodeName()}.util.config.SysInfoProperties;
import ${pub.getPKGCodeName()}.util.feign.FeignRequestInterceptor;
import ${pub.getPKGCodeName()}.util.config.UniWFClientProperties;
import ${pub.getPKGCodeName()}.util.feign.UniWFFeignClient;
import ${pub.getPKGCodeName()}.util.domain.PSDEWF;
import ${pub.getPKGCodeName()}.util.domain.PSDataEntity;
import ${pub.getPKGCodeName()}.util.domain.PSSystem;
import ${pub.getPKGCodeName()}.util.domain.PSWorkflow;
import ${pub.getPKGCodeName()}.util.domain.WFEngine;
import ${pub.getPKGCodeName()}.util.domain.WFMode;
import ${pub.getPKGCodeName()}.util.domain.Workflow;
/**
*
*/
@Component
public class WFJob implements ApplicationRunner {
UniWFFeignClient uniWFFeignClient;
@Autowired
SysInfoProperties sysInfoProperties;
@Autowired
public WFJob(Decoder decoder, Encoder encoder, Client client, Contract contract, FeignRequestInterceptor feignRequestInterceptor, UniWFClientProperties uniWFClientProperties) {
if (uniWFClientProperties.getServiceId()!=null) {
Feign.Builder nameBuilder = Feign.builder()
.client(client)
.encoder(encoder)
.decoder(decoder)
.contract(contract)
.requestInterceptor(feignRequestInterceptor)
;
this.uniWFFeignClient = nameBuilder.target(UniWFFeignClient.class,"http://" + uniWFClientProperties.getServiceId() + "/") ;
} else if (uniWFClientProperties.getServiceUrl()!=null) {
if (client instanceof LoadBalancerFeignClient) {
client = ((LoadBalancerFeignClient) client).getDelegate();
}
Feign.Builder nameBuilder = Feign.builder()
.client(client)
.encoder(encoder)
.decoder(decoder)
.contract(contract)
.requestInterceptor(feignRequestInterceptor)
;
this.uniWFFeignClient = nameBuilder.target(UniWFFeignClient.class, "http://" + uniWFClientProperties.getServiceUrl() + "/") ;
}
}
@Override
public void run(ApplicationArguments args) throws Exception {
// 注册统一工作流(域注册)
Workflow workflow = new Workflow();
workflow.setWorkflowid(sysInfoProperties.getDomainid());
workflow.setWorkflowname(sysInfoProperties.getDomainname());
workflow.setLogicname(sysInfoProperties.getDomainlogicname());
uniWFFeignClient.registDomain(workflow);
// 注册工作流引擎
List<WFEngine> wfengines = new ArrayList<WFEngine>();
WFEngine wfengine1 = new WFEngine();
wfengine1.setWfengineid("ACTIVITI");
wfengine1.setWfenginename("ACTIVITI");
wfengine1.setWfenginetype("ACTIVITI");
wfengine1.setLogicname("ACTIVITI");
wfengines.add(wfengine1);
uniWFFeignClient.registWFEngine(wfengines);
// 注册业务系统(部署系统)
PSSystem pssystem = new PSSystem();
pssystem.setPssystemid(sysInfoProperties.getSystemid());
pssystem.setPssystemName(sysInfoProperties.getSystemname());
pssystem.setWorkflowid(sysInfoProperties.getDomainid());
pssystem.setServiceid(sysInfoProperties.getServiceid());
pssystem.setServiceurl(sysInfoProperties.getServiceurl());
pssystem.setLogicname(sysInfoProperties.getSystemlogicname());
uniWFFeignClient.registPSSystem(pssystem);
// 注册业务工作流
List<PSWorkflow> psworkflows = new ArrayList<PSWorkflow>();
<#assign i = 0>
<#list sys.getAllPSWorkflows() as pswf >
PSWorkflow psworkflow${i} = new PSWorkflow();
psworkflow${i}.setPsworkflowid("${pswf.getId()}");
psworkflow${i}.setPsworkflowname("${pswf.getCodeName()}");
psworkflow${i}.setLogicname("${pswf.getLogicName()}");
psworkflow${i}.setWorkflowid(sysInfoProperties.getDomainid());
psworkflow${i}.setPssystemid(sysInfoProperties.getSystemid());
psworkflow${i}.setWfenginetype("ACTIVITI");
psworkflows.add(psworkflow${i});
<#assign i++>
</#list>
uniWFFeignClient.registPSWorkflow(psworkflows);
// 注册业务实体
List<PSDataEntity> psdataentities = new ArrayList<PSDataEntity>();
<#assign i = 0>
<#if sys.getAllPSDataEntities()??>
<#list sys.getAllPSDataEntities() as psde >
<#if psde.hasPSDEWF()>
PSDataEntity psdataentity${i} = new PSDataEntity();
psdataentity${i}.setPsdataentityid("${psde.getId()}");
psdataentity${i}.setPsdataentityname("${psde.getCodeName()}");
psdataentity${i}.setLogicname("${psde.getLogicName()}");
psdataentity${i}.setWorkflowid(sysInfoProperties.getDomainid());
psdataentity${i}.setPssystemid(sysInfoProperties.getSystemid());
psdataentities.add(psdataentity${i});
<#assign i++>
</#if>
</#list>
</#if>
uniWFFeignClient.registPSDataEntity(psdataentities);
// 注册业务实体工作流
List<PSDEWF> psdewfs = new ArrayList<PSDEWF>();
<#assign i = 0>
<#list sys.getAllPSWorkflows() as pswf >
<#if pswf.getPSWFDEs()??>
<#assign deArr = [] />
<#list pswf.getPSWFDEs() as pswfde>
<#if !deArr?seq_contains(pswfde.getId())>
PSDEWF psdewf${i} = new PSDEWF();
psdewf${i}.setPsdewfid("${pswfde.getId()}");
psdewf${i}.setPsdewfname("${pswfde.getName()}");
psdewf${i}.setLogicname("${pswfde.getPSDataEntity().getLogicName()}");
psdewf${i}.setWfproxymode(${pswfde.getWFProxyMode()});
psdewf${i}.setPsdataentityid("${pswfde.getPSDataEntity().getId()}");
psdewf${i}.setWorkflowid(sysInfoProperties.getDomainid());
psdewf${i}.setPssystemid(sysInfoProperties.getSystemid());
psdewfs.add(psdewf${i});
<#assign deArr = deArr + [pswfde.getId()] >
<#assign i++>
</#if>
</#list>
</#if>
</#list>
uniWFFeignClient.registPSDEWF(psdewfs);
// 注册业务工作流模式
<#-- List<WFMode> wfmodes = new ArrayList<WFMode>();-->
<#-- 模型还没找到-->
<#-- <#assign i = 0>-->
<#-- <#if sys.getAllPSDataEntities()??>-->
<#-- <#list sys.getAllPSWFMode() as pswf >-->
<#-- WFMode wfmode${i} = new WFMode();-->
<#-- wfmode${i}.setPSWorkflowid("${pswf.getId()}");-->
<#-- wfmode${i}.setPSWorkflowname("${pswf.getCodeName()}");-->
<#-- wfmode${i}.setLogicname("${pswf.getLogicName()}");-->
<#-- wfmodes.add(wfmode${i});-->
<#-- <#assign i++>-->
<#-- </#list>-->
<#-- </#if>-->
<#-- uniWFFeignClient.registWFMode(wfmodes);-->
}
}
</#if>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<#assign httpPort = "8080">
<#if sysrun?? >
<#if sysrun.getPSDevSlnMSDepAPI()??>
<#-- 微服务部署API -->
<#if sysrun.getPSDevSlnMSDepAPI().getHttpPort()??>
<#assign httpPort = sysrun.getPSDevSlnMSDepAPI().getHttpPort()?c>
</#if>
</#if>
</#if>
server:
port: ${httpPort}
spring:
application:
name: ${item.getCodeName()?lower_case}
cloud:
<#-- 后期需要修改为节点获取 -->
nacos:
discovery:
server-addr: 172.16.102.211:8848
<#if sysrun.getPSDBDevInst()??>
<#assign dbinst = sysrun.getPSDBDevInst()>
datasource:
password: '${dbinst.getPassword()}'
username: ${dbinst.getUserName()}
url: ${dbinst.getConnUrl()}
driver-class-name: <#if (dbinst.getDBType()=='MYSQL5')>com.mysql.jdbc.Driver<#elseif (dbinst.getDBType()=='DB2')>com.ibm.db2.jcc.DB2Driver<#elseif (dbinst.getDBType()=='ORACLE')>oracle.jdbc.driver.OracleDriver<#elseif (dbinst.getDBType()=='SQLSERVER')>com.microsoft.sqlserver.jdbc.SQLServerDriver<#elseif (dbinst.getDBType()=='POSTGRESQL')>org.postgresql.Driver<#elseif (dbinst.getDBType()=='PPAS')>com.edb.Driver</#if>
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
</#if>
feign:
sentinel:
enabled: true
# Logger Config
logging:
level:
${pub.getPKGCodeName()}: debug
<#if sys.getAllPSSubSysServiceAPIs()??>
client:
service:
<#list sys.getAllPSSubSysServiceAPIs() as subsysapi>
${subsysapi.getCodeName()?lower_case}:
service-id: ${subsysapi.getServiceCodeName()?lower_case}
</#list>
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
spring:
profiles:
include: dev, core, mybatis<#if (sys.getAllPSWorkflows()?? && srflist(sys.getAllPSWorkflows())?size gt 0) || pub.getUserTag() == "IBIZUNIWF">, wf</#if>
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPI
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}-client</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-client-${item.codeName?lower_case}</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Client External</name>
<description>${pub.getCodeName()?lower_case?cap_first} Client External</description>
<dependencies>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPI
</#ibiztemplate>
package ${pub.getPKGCodeName()}.client.${item.getCodeName()?lower_case}.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@ConditionalOnClass(${item.getCodeName()}ClientConfiguration.class)
@ConditionalOnWebApplication
@EnableConfigurationProperties(${item.codeName}ClientProperties.class)
@Import({
FeignClientsConfiguration.class
})
public class ${item.getCodeName()}AutoConfiguration {
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPI
</#ibiztemplate>
package ${pub.getPKGCodeName()}.client.${item.getCodeName()?lower_case}.config;
public class ${item.getCodeName()}ClientConfiguration {
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPI
</#ibiztemplate>
package ${pub.getPKGCodeName()}.client.${item.getCodeName()?lower_case}.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import lombok.Data;
@ConfigurationProperties(prefix = "client.service.${item.getCodeName()?lower_case?replace('_','.')}")
@Data
public class ${item.getCodeName()}ClientProperties {
private String tokenUrl ;
private String clientId ;
private String clientSecret ;
private String serviceUrl ;
private String serviceId ;
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().codeName?lower_case}.feign;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import ${pub.getPKGCodeName()}.core.client.model.I${item.codeName};
import ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().codeName?lower_case}.model.${item.codeName}Impl;
import ${pub.getPKGCodeName()}.util.SearchContext;
<#if item.getPSSubSysServiceAPI().getServicePath()??>
<#if item.getPSSubSysServiceAPI().getServicePath() != '' >
<#assign fullpath= item.getPSSubSysServiceAPI().getServicePath() + "/" + srfpluralize(item.getCodeName()?lower_case) >
<#else>
<#assign fullpath="/" + item.getPSSubSysServiceAPI().getCodeName()?lower_case + "/" + srfpluralize(item.getCodeName()?lower_case) >
</#if>
<#else>
<#assign fullpath="/" + item.getPSSubSysServiceAPI().getCodeName()?lower_case + "/" + srfpluralize(item.getCodeName()?lower_case) >
</#if>
/**
* 实体[${item.codeName}] 服务对象接口
*/
public interface ${item.codeName}FeignClient {
<#if item.getPSSubSysServiceAPIDEMethods()??>
<#list item.getPSSubSysServiceAPIDEMethods() as apiMethod>
<#assign req_param_type=(apiMethod.getRequestParamType()!'')>
<#assign req_param=(apiMethod.getRequestField()!'')>
<#assign retval_type=(apiMethod.getRetvalType())!''>
<#assign return_type='void'>
<#if return_type?? && return_type!='' && retval_type !='VOID' && retval_type='ENTITY' ><#comment>由于无法获取到返回值类型,暂时通过请求参数类型确定返回值类型</#comment>
<#assign return_type=item.codeName>
</#if>
<#if apiMethod.getActionType()=='DEACTION'><#comment>实体行为</#comment>
<#-- public ${return_type} ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
<#if apiMethod.getCodeName() == 'Get'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@PathVariable("${item.getKeyDEField().getCodeName()?lower_case}") ${srfjavatype(item.getKeyDEField().stdDataType)} ${item.getKeyDEField().getCodeName()?lower_case});
<#elseif apiMethod.getCodeName() == 'Remove'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}")
public Boolean ${apiMethod.getCodeName()?uncap_first}(@PathVariable("${item.getKeyDEField().getCodeName()?lower_case}") ${srfjavatype(item.getKeyDEField().stdDataType)} ${item.getKeyDEField().getCodeName()?lower_case});
<#elseif apiMethod.getCodeName() == 'Create'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@RequestBody ${item.codeName}Impl ${item.codeName?lower_case});
<#elseif apiMethod.getCodeName() == 'Update'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/{${item.getKeyDEField().getCodeName()?lower_case}}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@PathVariable("${item.getKeyDEField().getCodeName()?lower_case}") ${srfjavatype(item.getKeyDEField().stdDataType)} ${item.getKeyDEField().getCodeName()?lower_case},@RequestBody ${item.codeName}Impl ${item.codeName?lower_case});
<#elseif apiMethod.getCodeName() == 'CreateBatch'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@RequestBody List<${item.codeName}Impl> ${srfpluralize(item.getCodeName()?lower_case)});
<#elseif apiMethod.getCodeName() == 'UpdateBatch'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@RequestBody List<${item.codeName}Impl> ${srfpluralize(item.getCodeName()?lower_case)});
<#elseif apiMethod.getCodeName() == 'RemoveBatch'>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@RequestBody List<${item.codeName}Impl> ${srfpluralize(item.getCodeName()?lower_case)});
<#else>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
public ${item.codeName}Impl ${apiMethod.getCodeName()?uncap_first}(@RequestBody ${item.codeName}Impl ${item.codeName?lower_case});
</#if>
<#elseif apiMethod.getActionType()=='SELECT'><#comment>简单查询</#comment>
<#-- public List<${item.codeName}> ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
public Page<${item.codeName}Impl> ${apiMethod.getCodeName()?uncap_first}();
<#elseif apiMethod.getActionType()=='FETCH'><#comment>数据集合</#comment>
@RequestMapping(method = RequestMethod.<#if apiMethod.getRequestMethod()??>${apiMethod.getRequestMethod()}<#else>POST</#if>, value = "${fullpath}/${apiMethod.getCodeName()?lower_case}")
public Page<${item.codeName}Impl> ${apiMethod.getCodeName()?uncap_first}(SearchContext context);
<#elseif apiMethod.getActionType()=='USER'><#comment>用户自定义</#comment>
public void ${apiMethod.getCodeName()?uncap_first}();
</#if>
</#list>
</#if>
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().getCodeName()?lower_case}.model;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.io.Serializable;
import java.math.BigDecimal;
import ${pub.getPKGCodeName()}.core.client.model.I${item.getCodeName()};
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* 接口实体[${item.getCodeName()}] 对象
*/
public class ${item.getCodeName()}Impl implements I${item.getCodeName()},Serializable{
<#-- 属性相关 -->
<#list item.getPSSubSysServiceAPIDEFields() as defield>
/**
* ${defield.getLogicName()}
*/
public ${srfjavatype(defield.stdDataType)} ${defield.getCodeName()?cap_first};
@JsonIgnore
public boolean ${defield.getCodeName()?cap_first}DirtyFlag;
</#list>
<#list item.getPSSubSysServiceAPIDEFields() as defield>
/**
* 获取 [${defield.getLogicName()}]
*/
@JsonProperty("${defield.getCodeName()?lower_case}")
public ${srfjavatype(defield.getStdDataType())} get${defield.getCodeName()?cap_first}(){
return ${defield.getCodeName()?cap_first} ;
}
/**
* 设置 [${defield.getLogicName()}]
*/
@JsonProperty("${defield.getCodeName()?lower_case}")
public void set${defield.getCodeName()?cap_first}(${srfjavatype(defield.getStdDataType())} ${defield.getCodeName()?uncap_first}){
this.${defield.getCodeName()?cap_first} = ${defield.getCodeName()?uncap_first} ;
this.${defield.getCodeName()?cap_first}DirtyFlag = true ;
}
/**
* 获取 [${defield.getLogicName()}]脏标记
*/
@JsonIgnore
public boolean get${defield.getCodeName()?cap_first}DirtyFlag(){
return ${defield.getCodeName()?cap_first}DirtyFlag ;
}
</#list>
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().codeName?lower_case}.service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import ${pub.getPKGCodeName()}.core.client.model.I${item.codeName};
import ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().getCodeName()?lower_case}.config.${item.getPSSubSysServiceAPI().getCodeName()}ClientProperties;
import ${pub.getPKGCodeName()}.core.client.service.I${item.getCodeName()}ClientService;
import ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().codeName?lower_case}.model.${item.codeName}Impl;
import ${pub.getPKGCodeName()}.client.${item.getPSSubSysServiceAPI().codeName?lower_case}.feign.${item.codeName}FeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import ${pub.getPKGCodeName()}.util.feign.FeignRequestInterceptor;
import ${pub.getPKGCodeName()}.util.SearchContext;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import ${pub.getPKGCodeName()}.util.feign.suport.SearchContextFeignEncode;
import feign.Client;
import feign.Contract;
import feign.Feign;
import feign.codec.Decoder;
import feign.codec.Encoder;
/**
* 实体[${item.codeName}] 服务对象接口
*/
@Service
public class ${item.codeName}ClientServiceImpl implements I${item.getCodeName()}ClientService {
${item.codeName}FeignClient ${item.codeName?uncap_first}FeignClient;
<#assign subApi=item.getPSSubSysServiceAPI()>
<#assign servicePath=''>
<#if subApi.getServiceParam()?? && subApi.getServiceParam()!=''>
<#assign servicePath='http://'+subApi.getServiceParam()+'/'>
<#elseif subApi.getServicePath()?? && subApi.getServicePath()!=''>
<#assign servicePath=subApi.getServiceParam()>
</#if>
<#-- <#if servicePath?? && servicePath!=''> -->
@Autowired
public ${item.codeName}ClientServiceImpl(Decoder decoder, Encoder encoder, Client client, Contract contract ,FeignRequestInterceptor feignRequestInterceptor,${item.getPSSubSysServiceAPI().getCodeName()}ClientProperties ${item.getPSSubSysServiceAPI().getCodeName()?lower_case}ClientProperties) {
if (${item.getPSSubSysServiceAPI().getCodeName()?lower_case}ClientProperties.getServiceId()!=null) {
Feign.Builder nameBuilder = Feign.builder()
.client(client)
.encoder(new SearchContextFeignEncode(encoder))
.decoder(decoder)
.contract(contract)
.requestInterceptor(feignRequestInterceptor)
;
this.${item.codeName?uncap_first}FeignClient = nameBuilder.target(${item.getCodeName()}FeignClient.class,"http://"+${item.getPSSubSysServiceAPI().getCodeName()?lower_case}ClientProperties.getServiceId()+"/") ;
}else if (${item.getPSSubSysServiceAPI().getCodeName()?lower_case}ClientProperties.getServiceUrl()!=null) {
if (client instanceof LoadBalancerFeignClient) {
client = ((LoadBalancerFeignClient) client).getDelegate();
}
Feign.Builder nameBuilder = Feign.builder()
.client(client)
.encoder(new SearchContextFeignEncode(encoder))
.decoder(decoder)
.contract(contract)
.requestInterceptor(feignRequestInterceptor)
;
this.${item.codeName?uncap_first}FeignClient = nameBuilder.target(${item.getCodeName()}FeignClient.class,"http://"+${item.getPSSubSysServiceAPI().getCodeName()?lower_case}ClientProperties.getServiceUrl()+"/") ;
}
}
<#-- </#if> -->
@Override
public I${item.getCodeName()} createModel() {
return new ${item.getCodeName()}Impl();
}
<#if item.getPSSubSysServiceAPIDEMethods()??>
<#list item.getPSSubSysServiceAPIDEMethods() as apiMethod>
<#assign req_param_type=(apiMethod.getRequestParamType()!'')>
<#assign req_param=(apiMethod.getRequestField()!'')>
<#assign retval_type=(apiMethod.getRetvalType())!''>
<#assign return_type='void'>
<#if return_type?? && return_type!='' && retval_type !='VOID' && retval_type='ENTITY' ><#comment>由于无法获取到返回值类型,暂时通过请求参数类型确定返回值类型</#comment>
<#assign return_type=item.codeName>
</#if>
<#if apiMethod.getActionType()=='DEACTION'><#comment>实体行为</#comment>
<#-- public ${return_type} ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
public void ${apiMethod.getCodeName()?uncap_first}(<#if apiMethod.getCodeName()=="CreateBatch" || apiMethod.getCodeName()=="UpdateBatch" || apiMethod.getCodeName()=="RemoveBatch" >List<I${item.codeName}> ${srfpluralize(item.codeName?lower_case)}<#else>I${item.codeName} ${item.codeName?lower_case}</#if>){
<#if apiMethod.getCodeName() == 'Get'>
I${item.codeName} clientModel = ${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(${item.codeName?lower_case}.get${item.getKeyDEField().getCodeName()?cap_first}()) ;
BeanCopier copier=BeanCopier.create(clientModel.getClass(), ${item.codeName?lower_case}.getClass(), false);
copier.copy(clientModel, ${item.codeName?lower_case}, null);
<#elseif apiMethod.getCodeName() == 'Remove'>
${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(${item.codeName?lower_case}.get${item.getKeyDEField().getCodeName()?cap_first}()) ;
<#elseif apiMethod.getCodeName() == 'Create'>
I${item.codeName} clientModel = ${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}((${item.codeName}Impl)${item.codeName?lower_case}) ;
BeanCopier copier=BeanCopier.create(clientModel.getClass(), ${item.codeName?lower_case}.getClass(), false);
copier.copy(clientModel, ${item.codeName?lower_case}, null);
<#elseif apiMethod.getCodeName() == 'Update'>
I${item.codeName} clientModel = ${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(${item.codeName?lower_case}.get${item.getKeyDEField().getCodeName()?cap_first}(),(${item.codeName}Impl)${item.codeName?lower_case}) ;
BeanCopier copier=BeanCopier.create(clientModel.getClass(), ${item.codeName?lower_case}.getClass(), false);
copier.copy(clientModel, ${item.codeName?lower_case}, null);
<#elseif apiMethod.getCodeName() == 'CreateBatch'>
if(${srfpluralize(item.codeName?lower_case)}!=null){
List<${item.codeName}Impl> list = new ArrayList<${item.codeName}Impl>();
for(I${item.codeName} i${item.codeName?lower_case} :${srfpluralize(item.codeName?lower_case)}){
list.add((${item.codeName}Impl)i${item.codeName?lower_case}) ;
}
${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(list) ;
}
<#elseif apiMethod.getCodeName() == 'UpdateBatch'>
if(${srfpluralize(item.codeName?lower_case)}!=null){
List<${item.codeName}Impl> list = new ArrayList<${item.codeName}Impl>();
for(I${item.codeName} i${item.codeName?lower_case} :${srfpluralize(item.codeName?lower_case)}){
list.add((${item.codeName}Impl)i${item.codeName?lower_case}) ;
}
${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(list) ;
}
<#elseif apiMethod.getCodeName() == 'RemoveBatch'>
if(${srfpluralize(item.codeName?lower_case)}!=null){
List<${item.codeName}Impl> list = new ArrayList<${item.codeName}Impl>();
for(I${item.codeName} i${item.codeName?lower_case} :${srfpluralize(item.codeName?lower_case)}){
list.add((${item.codeName}Impl)i${item.codeName?lower_case}) ;
}
${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(list) ;
}
<#else>
I${item.codeName} clientModel = ${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}((${item.codeName}Impl)${item.codeName?lower_case}) ;
BeanCopier copier=BeanCopier.create(clientModel.getClass(), ${item.codeName?lower_case}.getClass(), false);
copier.copy(clientModel, ${item.codeName?lower_case}, null);
</#if>
}
<#elseif apiMethod.getActionType()=='SELECT'><#comment>简单查询</#comment>
<#-- public List<${item.codeName}> ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
public Page<I${item.codeName}> ${apiMethod.getCodeName()?uncap_first}(SearchContext context){
return null ;
}
<#elseif apiMethod.getActionType()=='FETCH'><#comment>数据集合</#comment>
public Page<I${item.codeName}> ${apiMethod.getCodeName()?uncap_first}(SearchContext context){
Page<${item.codeName}Impl> page = this.${item.codeName?uncap_first}FeignClient.${apiMethod.getCodeName()?uncap_first}(context) ;
return new PageImpl(page.getContent(),context.getPageable(),page.getTotalElements());
}
<#elseif apiMethod.getActionType()=='USER'><#comment>用户自定义</#comment>
public void ${apiMethod.getCodeName()?uncap_first}(){
}
</#if>
</#list>
</#if>
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPI
</#ibiztemplate>
org.springframework.boot.autoconfigure.EnableAutoConfiguration=${pub.getPKGCodeName()}.client.${item.getCodeName()?lower_case}.config.${item.codeName}AutoConfiguration
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-client</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Client</name>
<description>${pub.getCodeName()?lower_case?cap_first} Client</description>
<packaging>pom</packaging>
<#-- modules -->
<#if sys.getAllPSSubSysServiceAPIs()??>
<modules>
<#list sys.getAllPSSubSysServiceAPIs() as subapi>
<module>${pub.getCodeName()?lower_case}-client-${subapi.getCodeName()?lower_case}</module>
</#list>
</modules>
</#if>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-core</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-core</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} Core</name>
<description>${pub.getCodeName()?lower_case?cap_first} Core</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</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>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSDEDBTABLE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.dao;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.codeName}SearchContext;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.dao.po.I${de.getCodeName()}Table;
import java.util.List;
import java.util.Map;
/**
* 关系型数据实体表[${item.getCodeName()}]DAO对象
*/
public interface I${de.getCodeName()}TableDAO {
I${de.getCodeName()}Table create${de.getCodeName()?lower_case?cap_first}Table();
<#assign keyfield=de.getKeyPSDEField()>
<#if de.getAllPSDEActions()??>
<#list de.getAllPSDEActions() as deaction>
<#--
<#if (deaction.getActionType()=='USERCUSTOM' || deaction.getActionType()=='DELOGIC') && (!deaction.codeName?lower_case?contains("major")) >
I${de.getCodeName()}Table ${srfmethodname(deaction.getCodeName())}(I${de.getCodeName()}Table et);
<#elseif deaction.getActionMode() == "READ">
I${de.getCodeName()}Table ${srfmethodname(deaction.getCodeName())}(${srfjavatype(keyfield.stdDataType)} srfkey);
<#else>
boolean ${srfmethodname(deaction.getCodeName())}(I${de.getCodeName()}Table et);
</#if>
-->
<#if deaction.codeName == 'Get' >
I${de.getCodeName()}Table ${srfmethodname(deaction.getCodeName())}(${srfjavatype(keyfield.stdDataType)} ${keyfield.getCodeName()?lower_case});
I${de.getCodeName()}Table ${srfmethodname(deaction.getCodeName())}(I${de.getCodeName()}Table et);
<#elseif deaction.codeName == 'Create'>
boolean ${srfmethodname(deaction.getCodeName())}(I${de.getCodeName()}Table et);
<#elseif deaction.codeName == 'Update'>
boolean ${srfmethodname(deaction.getCodeName())}(I${de.getCodeName()}Table et);
<#elseif deaction.codeName == 'Remove'>
boolean ${srfmethodname(deaction.getCodeName())}(${srfjavatype(keyfield.stdDataType)} ${keyfield.getCodeName()?lower_case});
</#if>
</#list>
</#if>
<#if de.getAllPSDEDataSets()??>
<#list de.getAllPSDEDataSets() as dedataset>
List<I${de.getCodeName()}Table> search${dedataset.getCodeName()}(${de.codeName}SearchContext context);
</#list>
</#if>
}
<#ibiztemplate>
TARGET=PSDEDBTABLE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.dao.po;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigDecimal;
/**
* 关系型数据实体表[${item.getCodeName()}] 对象
*/
public interface I${de.getCodeName()}Table {
<#--
<#list item.getPSSysDBTable().getAllPSSysDBColumns() as col>
public ${srfjavatype(col.getStdDataType())} get${col.getCodeName()?lower_case?cap_first}();
public void set${col.getCodeName()?lower_case?cap_first}(${srfjavatype(col.getStdDataType())} ${col.getCodeName()?lower_case});
</#list>
-->
<#list de.getAllPSDEFields() as defield>
<#if defield.getPSSysDBColumn()??>
//${defield.getPSSysDBColumn().getLogicName()}
${srfjavatype(defield.getPSSysDBColumn().getStdDataType())} get${defield.getPSSysDBColumn().getCodeName()?lower_case?cap_first}();
void set${defield.getPSSysDBColumn().getCodeName()?lower_case?cap_first}(${srfjavatype(defield.getPSSysDBColumn().getStdDataType())} ${defield.getPSSysDBColumn().getCodeName()?lower_case});
</#if>
</#list>
}
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
/**
* 实体[${item.getLogicName()}]
*/
public class ${item.getCodeName()} implements Serializable {
private static final long serialVersionUID = 1L;
<#-- 实体属性相关 -->
<#if item.getPSDEFields()??>
<#list item.getPSDEFields() as defield>
/**
* ${defield.getLogicName()} 属性
*/
private ${srfjavatype(defield.getStdDataType())} ${defield.getCodeName()?cap_first};
@JsonIgnore
private boolean ${defield.getCodeName()?cap_first}DirtyFlag;
</#list>
<#list item.getPSDEFields() as defield>
/**
* 获取 [${defield.getLogicName()}]
*/
public ${srfjavatype(defield.getStdDataType())} get${defield.getCodeName()?cap_first}(){
return ${defield.getCodeName()?cap_first} ;
}
/**
* 设置 [${defield.getLogicName()}]
*/
public void set${defield.getCodeName()?cap_first}(${srfjavatype(defield.getStdDataType())} ${defield.getCodeName()?uncap_first}){
this.${defield.getCodeName()?cap_first} = ${defield.getCodeName()?uncap_first} ;
this.${defield.getCodeName()?cap_first}DirtyFlag = true ;
}
/**
* 获取 [${defield.getLogicName()}]脏标记
*/
@JsonIgnore
public boolean get${defield.getCodeName()?cap_first}DirtyFlag(){
return ${defield.getCodeName()?cap_first}DirtyFlag ;
}
</#list>
</#if>
}
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.filter;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import ${pub.getPKGCodeName()}.util.ISearchFilter;
import ${pub.getPKGCodeName()}.util.domain.DataObj;
import com.fasterxml.jackson.annotation.JsonFormat;
import ${pub.getPKGCodeName()}.util.SearchContext;
import ${pub.getPKGCodeName()}.util.SearchFieldFilter;
import ${pub.getPKGCodeName()}.util.enums.SearchFieldType;
import ${pub.getPKGCodeName()}.util.enums.SearchGroupType;
import ${pub.getPKGCodeName()}.util.SearchGroupFilter;
import lombok.Data;
/**
* 关系型数据实体[${item.codeName}] 查询条件对象
*/
@Data
public class ${item.codeName}SearchContext extends SearchContext {
<#list item.getPSDEFields() as defield>
<#if defield.getAllPSDEFSearchModes()??>
<#list defield.getAllPSDEFSearchModes() as formitem>
<#assign defDataType=formitem.getPSDEField().getDataType()>
<#if defDataType == "DATETIME">
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
<#elseif defDataType == "DATE">
@JsonFormat(pattern="yyyy-MM-dd", timezone="GMT+8")
<#elseif defDataType == "TIME">
@JsonFormat(pattern="HH:mm", timezone="GMT+8")
</#if>
public ${srfjavatype(formitem.getPSDEField().stdDataType)} ${formitem.getName()?lower_case};//[${defield.getLogicName()}]
public void set${formitem.getName()?lower_case?cap_first}(${srfjavatype(formitem.getPSDEField().stdDataType)} ${formitem.getName()?lower_case}) {
this.${formitem.getName()?lower_case}=${formitem.getName()?lower_case};
SearchFieldFilter searchField = new SearchFieldFilter();
searchField.setParam("${defield.name?lower_case}");
searchField.setCondition(SearchFieldType.${formitem.getValueOp()});
searchField.setValue(${formitem.getName()?lower_case});
this.getCondition().add(searchField);
}
</#list>
</#if>
</#list>
/**
* 启用快速搜索
*/
public void setQuery(String strQuery)
{
this.query=strQuery;
if(!org.springframework.util.StringUtils.isEmpty(strQuery)){
<#if item.getPSDEFields()??>
<#list item.getPSDEFields() as defield>
<#if defield.isEnableQuickSearch()==true>
<#if !P.exists(de.getCodeName(),"searchcontext","querybegin")>
SearchGroupFilter searchGroupFilter=new SearchGroupFilter();
searchGroupFilter.setSearchGroupType(SearchGroupType.OR);
</#if>
SearchFieldFilter ${defield.codeName?lower_case}=new SearchFieldFilter();
${defield.codeName?lower_case}.setParam("${defield.codeName?lower_case}");
${defield.codeName?lower_case}.setCondition(SearchFieldType.LIKE);
${defield.codeName?lower_case}.setValue(strQuery);
searchGroupFilter.getCondition().add(${defield.codeName?lower_case});
this.getCondition().add(searchGroupFilter);
</#if>
</#list>
</#if>
}
}
}
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.getCodeName()}SearchContext;
/**
* 实体[${item.codeName}] 服务对象接口
*/
<#-- 标准模式 -->
public interface I${item.codeName}Service{
<#assign keyfield=item.getKeyPSDEField()>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if (deaction.getActionType()=='USERCUSTOM') && (!deaction.codeName?lower_case?contains("major")) ><#comment>Get与自定义行为返回DoMain不发带major</#comment>
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.getActionType()=='DELOGIC'>
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == 'Get'>
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${srfjavatype(keyfield.stdDataType)} ${keyfield.getCodeName()?lower_case}) ;
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == "Create">
boolean ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == "Update">
boolean ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == "Remove">
boolean ${srfmethodname(deaction.getCodeName())}(${srfjavatype(keyfield.stdDataType)} ${keyfield.getCodeName()?lower_case}) ;
<#elseif deaction.codeName == "Save">
boolean ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == "GetDraft">
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == "CheckKey">
boolean ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
<#elseif deaction.codeName == "CreateBatch">
void ${srfmethodname(deaction.getCodeName())}(List<${item.codeName}> ${item.codeName?lower_case}s) ;
<#elseif deaction.codeName == "UpdateBatch">
void ${srfmethodname(deaction.getCodeName())}(List<${item.codeName}> ${item.codeName?lower_case}s) ;
<#elseif deaction.codeName == "RemoveBatch">
void ${srfmethodname(deaction.getCodeName())}(List<${item.codeName}> ${item.codeName?lower_case}s) ;
<#else>
${item.codeName} ${srfmethodname(deaction.getCodeName())}(${item.codeName} ${item.codeName?lower_case}) ;
</#if>
</#list>
</#if>
<#if item.getAllPSDEDataSets()??>
<#list item.getAllPSDEDataSets() as dedataset>
<#--
public List<${item.codeName}> list${dedataset.getCodeName()}(${item.codeName}SearchFilter filter) {
return i${de.codeName?lower_case}Storage.list${dedataset.getCodeName()}(filter);
}
-->
/**
* 查询集合 ${dedataset.getLogicName()}
*/
Page<${item.codeName}> search${dedataset.getCodeName()}(${item.codeName}SearchContext context) ;
</#list>
</#if>
<#if de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as der>
/**
* 根据${der.getMajorPSDataEntity().getLogicName()}查询
*/
Page<${de.getCodeName()}> selectBy${der.getCodeName()}(${srfjavatype(der.getMajorPSDataEntity().getKeyPSDEField().stdDataType)} ${der.getMajorPSDataEntity().getKeyPSDEField().getCodeName()?lower_case}) ;
List<${de.getCodeName()}> selectBy${der.getCodeName()}2(${srfjavatype(der.getMajorPSDataEntity().getKeyPSDEField().stdDataType)} ${der.getMajorPSDataEntity().getKeyPSDEField().getCodeName()?lower_case});
</#list>
</#if>
<#-- List<${item.codeName}> listByMapTable(Map<String, Object> map); -->
}
<#ibiztemplate>
TARGET=PSDELOGIC
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};
/**
* 关系型数据实体[${item.codeName}] 对象
*/
public interface I${de.codeName}${item.codeName}Logic {
void execute(${de.codeName} ${de.codeName?lower_case} ) ;
}
<#ibiztemplate>
TARGET=PSDELOGIC
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import ${pub.getPKGCodeName()}.core.${item.getPSDataEntity().getPSSystemModule().getCodeName()?lower_case}.service.logic.I${de.codeName}${item.codeName}Logic;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()};
<#--import ${pub.getPKGCodeName()}.util.errors.BadRequestAlertException;-->
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.KieContainer;
/**
* 关系型数据实体[${item.codeName}] 对象
*/
@Service
public class ${de.codeName}${item.codeName}LogicImpl implements I${de.codeName}${item.codeName}Logic{
@Autowired
private KieContainer kieContainer;
<#comment>注入处理逻辑中所用到的service对象</#comment>
<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??>
<#list item.getPSDELogicNodes() as deLogicNode>
<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>
<#assign nodePSDataEntity=deLogicNode.getDstPSDataEntity()>
<#if !P.exists("Autowired",nodePSDataEntity.getCodeName(),"service")>
@Autowired
private ${pub.getPKGCodeName()}.core.${nodePSDataEntity.getPSSystemModule().codeName?lower_case}.service.I${nodePSDataEntity.codeName}Service ${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service;
</#if>
</#if>
</#list>
</#if>
<#comment>注入当前实体的service对象,供自定义查询使用</#comment>
@Autowired
private ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.I${de.codeName}Service iBzSysDefaultService;
public void execute(${de.codeName} et){
KieSession kieSession = null;
try{
kieSession=kieContainer.newKieSession();
<#comment>插入逻辑参数</#comment>
<#if item.getPSDELogicParams?? && item.getPSDELogicParams()??>
<#assign logicName=(de.codeName+item.codeName)?lower_case>
<#list item.getPSDELogicParams() as logicParam>
<#assign paramObj=(logicName+logicParam.codeName)?lower_case>
<#assign paramObjValue=(logicName+logicParam.codeName)?lower_case>
<#if logicParam.isDefault()==true><#comment>默认变量</#comment>
<#assign paramObjValue="et">
<#elseif logicParam.getParamPSDataEntity?? && logicParam.getParamPSDataEntity()??>
<#assign ParamPSDataEntity=logicParam.getParamPSDataEntity()>
${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName} ${(logicName+logicParam.codeName)?lower_case} =new ${pub.getPKGCodeName()}.core.${ParamPSDataEntity.getPSSystemModule().codeName?lower_case}.domain.${ParamPSDataEntity.codeName}();
<#else>
Map ${(logicName+logicParam.codeName)?lower_case} =new HashMap();
</#if>
kieSession.insert(${paramObjValue}); <#comment>将逻辑参数存储到fact</#comment>
kieSession.setGlobal("${paramObj}",${paramObjValue});<#comment>将逻辑参数存储到global</#comment>
</#list>
</#if>
<#comment>插入处理逻辑中所用到的service对象</#comment>
<#if item.getPSDELogicNodes?? && item.getPSDELogicNodes()??>
<#list item.getPSDELogicNodes() as deLogicNode>
<#if deLogicNode.getDstPSDataEntity?? && deLogicNode.getDstPSDataEntity()??>
<#if !P.exists(item.codeName,"kieSessionGlobalService",deLogicNode.getDstPSDataEntity().getCodeName()?lower_case)>
kieSession.setGlobal("${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service",${deLogicNode.getDstPSDataEntity().getCodeName()?lower_case}service);<#comment>将逻辑中引用到的service存储到global</#comment>
</#if>
</#if>
</#list>
</#if>
<#comment>插入当前实体的defaultService对象,供自定义查询使用</#comment>
kieSession.setGlobal("iBzSys${de.codeName?lower_case?cap_first}DefaultService",iBzSysDefaultService);<#comment>将逻辑中引用到的service存储到global</#comment>
kieSession.startProcess("${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.service.logic.${de.codeName?lower_case}${item.getCodeName()?lower_case}");<#comment>执行所要执行的流程</#comment>
}catch(Exception e){
System.out.println("执行[${item.getName()}]处理逻辑发生异常"+e);
<#--throw new BadRequestAlertException(""+e,"","");-->
}finally {
if(kieSession!=null)
kieSession.destroy();
}
}
}
<#ibiztemplate>
TARGET=PSDEFVALUERULE
</#ibiztemplate>
<#--<#if ((pub.getUserTag4())!'')=='nancy'>-->
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.valuerule.anno.${de.codeName?lower_case};
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.valuerule.validator.${de.codeName?lower_case}.${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName}Validator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
/**
* 值规则注解
* 实体:${de.codeName}
* 属性:${item.getPSDEField().codeName}
* 值规则:${item.codeName}
*/
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName}Validator.class})
public @interface ${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName} {
//是否默认检查
boolean flag() default ${item.isCheckDefault()?c};
//值规则名称
String info() default "${item.getName()}";
//值规则信息,如果为空,使用值规则名称。
<#assign message = item.getName()>
<#if item.getRuleInfo()??>
<#assign message = item.getRuleInfo()>
</#if>
String message() default "${message}";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
<#--</#if>-->
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDEFVALUERULE
</#ibiztemplate>
<#--<#if ((pub.getUserTag4())!'')=='nancy'>-->
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.valuerule.validator.${de.codeName?lower_case};
import lombok.extern.slf4j.Slf4j;
import ${pub.getPKGCodeName()}.util.valuerule.DefaultValueRule;
import ${pub.getPKGCodeName()}.util.valuerule.VRCondition;
import ${pub.getPKGCodeName()}.util.valuerule.condition.*;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.valuerule.anno.${de.codeName?lower_case}.${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName};
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
<#comment>属性值对应的java</#comment>
<#assign defieldType = srfjavatype(item.getPSDEField().stdDataType)>
/**
* 值规则注解解析类
* 实体:${de.codeName}
* 属性:${item.getPSDEField().codeName}
* 值规则:${item.codeName}
<#assign message = item.getName()>
<#if item.getRuleInfo()?? && item.getRuleInfo() !='()'>
<#assign message = item.getRuleInfo()>
</#if>
* 值规则信息:${message}
*/
@Slf4j
@Component("${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName}Validator")
public class ${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName}Validator implements ConstraintValidator<${de.codeName}${item.getPSDEField().codeName?cap_first}${item.codeName}, ${defieldType}>,Validator {
private static final String MESSAGE = "值规则校验失败:【${message}】";
@Override
public boolean isValid(${defieldType} value, ConstraintValidatorContext context) {
boolean isValid = doValidate(value);
if(!isValid) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate(MESSAGE)
.addConstraintViolation();
}
return doValidate(value);
}
@Override
public boolean supports(Class<?> aClass) {
<#comment>TODO 细化……</#comment>
return true;
}
@Override
public void validate(Object o, Errors errors) {
if( o!=null && supports(o.getClass())){
if (!doValidate((${defieldType}) o)){
errors.reject(MESSAGE);
}
}
}
public boolean doValidate(${defieldType} value) {
<#if item.codeName =='Default'>
DefaultValueRule<${defieldType}> valueRule = new DefaultValueRule<>("默认值规则",MESSAGE,"${item.getPSDEField().codeName}",value)
//字符串长度,重复检查模式,重复值范围,基础值规则,是否递归检查。
.init(${item.getPSDEField().getStringLength()?c},"${item.getPSDEField().getDupCheckMode()}",null,null,${item.getPSDEField().isCheckRecursion()?c});
return valueRule.isValid();
<#else>
VRGroupCondition<${defieldType}> groupCondition =
<@generateRGroupCondition item.getPSDEFVRGroupCondition() />
;
return groupCondition.isValid();
</#if>
}
}
<#comment>组条件代码生成 start</#comment>
<#macro generateRGroupCondition vrCondition>
new VRGroupCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
.init(${(vrCondition.getCondOp()=='AND')?c})
<#if vrCondition.getPSDEFVRConditions()??>
<#list vrCondition.getPSDEFVRConditions() as vrCondition>
<#assign conditionType = vrCondition.getCondType()>
<#if conditionType == 'SIMPLE'>
<#comment>常规条件(Simple)</#comment>
.add(new VRSimpleCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
//操作类型,参数类型,参数值
.init(VRSimpleCondition.OpType.${vrCondition.getPSDBValueOPId()},"${vrCondition.getParamType()!""}","${vrCondition.getParamValue()!""}"))
<#elseif conditionType == 'REGEX'>
<#comment>正则条件(REGEX</#comment>
.add(new VRRegExSingleCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
//正则表达式
.init("${vrCondition.getRegExCode()?replace("\\","\\\\")?replace("\"","\\\"")}"))
<#elseif conditionType == 'VALUERANGE2'>
<#comment>数值范围 (VALUERANGE2) </#comment>
//最小值,最大值,是否包含最小值,是否包含最大值
.add(new VRValueRange2Condition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
.init("${vrCondition.getMinValue()!""}","${vrCondition.getMaxValue()!""}",${vrCondition.isIncludeMinValue()?c},${vrCondition.isIncludeMaxValue()?c}))
<#elseif conditionType == 'VALUERANGE3'>
<#comment>数值范围(VALUERANGE3)值清单 </#comment>
.add(new VRValueRange3Condition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
<#assign listString ="">
<#if vrCondition.getValueRanges()??>
<#list vrCondition.getValueRanges() as valueRange>
<#assign listString = listString + "\""+ valueRange +"\"">
<#if valueRange_has_next>
<#assign listString = listString + ", ">
</#if>
</#list>
</#if>
//值清单
.init(${listString}))
<#elseif conditionType == 'STRINGLENGTH'>
<#comment>字符长度(STRINGLENGTH </#comment>
.add(new VRStringLengthCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
//最小长度,最大长度,是否包含最小值,是否包含最大值。
.init(${vrCondition.getMinValue()!"null"},${vrCondition.getMaxValue()!"null"},${vrCondition.isIncludeMinValue()?c},${vrCondition.isIncludeMaxValue()?c}))
<#elseif conditionType == 'SYSVALUERULE'>
<#comment>系统值规则(SYSVALUERULE </#comment>
.add(new VRSysValueRuleCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value))
<#elseif conditionType == 'VALUERANGE'>
<#comment>数据集范围(VALUERANGEstart</#comment>
.add(new VRValueRangeCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}", value)
<#assign majorField = ""/>
<#assign exField = "" />
<#if vrCondition.getMajorPSDataEntity()?? >
<#assign majorField = ''>
<#if vrCondition.getExtMajorPSDEField()??>
<#assign majorField = vrCondition.getExtMajorPSDEField().codeName>
</#if>
</#if>
<#if vrCondition.getExtMajorPSDEField()??>
<#assign exField = vrCondition.getExtMajorPSDEField().codeName>
</#if>
<#assign majorEntity = vrCondition.getMajorPSDataEntity()/>
//属性名,当前实体,数据集,数据集实体,数据集属性附加,当前实体附加属性
.init("${item.getPSDEField().codeName}", ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.domain.${de.codeName}.class,"${vrCondition.getMajorPSDEDataSet().getName()?lower_case?cap_first}",
${pub.getPKGCodeName()}.core.${majorEntity.getPSSystemModule().codeName?lower_case}.domain.${majorEntity.codeName}.class," ${majorField?lower_case}","${exField?lower_case}"))
<#elseif conditionType == 'VALUERECURSION'>
.add(new VRValueRecursionCondition<>("${vrCondition.getName()}", ${vrCondition.isNotMode()?c}, "${item.getRuleInfo()!""}",value))
<#elseif conditionType == 'GROUP'>
<#comment>条件组(GROUP </#comment>
.add(
<@generateRGroupCondition vrCondition=vrCondition />
)
<#else>
</#if>
</#list>
</#if>
</#macro>
<#comment>组条件代码生成 end</#comment>
<#--</#if>-->
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.client.model;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* Client 实体 [${item.getCodeName()}] 对象
*/
public interface I${item.getCodeName()} {
<#list item.getPSSubSysServiceAPIDEFields() as apifield>
/**
* 获取 [${apifield.getLogicName()}]
*/
public void set${apifield.getCodeName()?cap_first}(${srfjavatype(apifield.getStdDataType())} ${apifield.getCodeName()?uncap_first});
/**
* 设置 [${apifield.getLogicName()}]
*/
public ${srfjavatype(apifield.getStdDataType())} get${apifield.getCodeName()?cap_first}();
/**
* 获取 [${apifield.getLogicName()}]脏标记
*/
public boolean get${apifield.getCodeName()?cap_first}DirtyFlag();
</#list>
}
<#ibiztemplate>
TARGET=PSSUBSYSSERVICEAPIDE
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.client.service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import ${pub.getPKGCodeName()}.core.client.model.I${item.codeName};
import ${pub.getPKGCodeName()}.util.SearchContext;
/**
* 实体[${item.codeName}] 服务对象接口
*/
public interface I${item.codeName}ClientService{
public I${item.codeName} createModel() ;
<#if item.getPSSubSysServiceAPIDEMethods()??>
<#list item.getPSSubSysServiceAPIDEMethods() as apiMethod>
<#assign req_param_type=(apiMethod.getRequestParamType()!'')>
<#assign req_param=(apiMethod.getRequestField()!'')>
<#assign retval_type=(apiMethod.getRetvalType())!''>
<#assign return_type='void'>
<#if return_type?? && return_type!='' && retval_type !='VOID' && retval_type='ENTITY' ><#comment>由于无法获取到返回值类型,暂时通过请求参数类型确定返回值类型</#comment>
<#assign return_type=item.codeName>
</#if>
<#if apiMethod.getActionType()=='DEACTION'><#comment>实体行为</#comment>
<#-- public ${return_type} ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
<#-- public <#if apiMethod.getReturnValueType()??><#if apiMethod.getReturnValueType()=='VOID'>void<#elseif apiMethod.getReturnValueType()=='ENTITY'>I${item.codeName}<#else>void</#if><#else>void</#if> ${apiMethod.getCodeName()?uncap_first}(<#if apiMethod.getRequestParamType()??><#if apiMethod.getRequestParamType()=='FIELD'>${srfjavatype(item.getKeyDEField().stdDataType)} ${apiMethod.getRequestField()?lower_case}<#elseif apiMethod.getRequestParamType()=='ENTITY'>I${item.codeName} ${item.codeName?lower_case}<#else></#if><#else></#if>); -->
<#if apiMethod.getCodeName()=="CreateBatch" || apiMethod.getCodeName()=="UpdateBatch" || apiMethod.getCodeName()=="RemoveBatch" >
public void ${apiMethod.getCodeName()?uncap_first}(List<I${item.codeName}> ${srfpluralize(item.codeName?lower_case)});
<#else>
public void ${apiMethod.getCodeName()?uncap_first}(I${item.codeName} ${item.codeName?lower_case});
</#if>
<#elseif apiMethod.getActionType()=='SELECT'><#comment>简单查询</#comment>
<#-- public List<${item.codeName}> ${srfmethodname(apiMethod.getCodeName())}(<#if req_param_type?? && req_param_type=='ENTITY'><#if apiMethod.getPSDEName()??>${apiMethod.getPSDEName()} entity</#if></#if>); -->
public Page<I${item.codeName}> ${apiMethod.getCodeName()?uncap_first}(SearchContext context);
<#elseif apiMethod.getActionType()=='FETCH'><#comment>数据集合</#comment>
public Page<I${item.codeName}> ${apiMethod.getCodeName()?uncap_first}(SearchContext context);
<#elseif apiMethod.getActionType()=='USER'><#comment>用户自定义</#comment>
public void ${apiMethod.getCodeName()?uncap_first}();
</#if>
</#list>
</#if>
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.config;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.*;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.internal.io.ResourceFactory;
import org.kie.spring.KModuleBeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import java.io.IOException;
@Configuration
public class DroolsAutoConfiguration {
private static final String RULES_PATH = "rules/";
@Bean
@ConditionalOnMissingBean(KieFileSystem.class)
public KieFileSystem kieFileSystem() throws IOException {
KieFileSystem kieFileSystem = getKieServices().newKieFileSystem();
for (Resource file : getRuleFiles()) {
kieFileSystem.write(ResourceFactory.newUrlResource(file.getURL()));
}
return kieFileSystem;
}
private Resource[] getRuleFiles() throws IOException {
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
return resourcePatternResolver.getResources("classpath*:" + RULES_PATH + "**/*.*");
}
@Bean
@ConditionalOnMissingBean(KieContainer.class)
public KieContainer kieContainer() throws IOException {
final KieRepository kieRepository = getKieServices().getRepository();
kieRepository.addKieModule(new KieModule() {
public ReleaseId getReleaseId() {
return kieRepository.getDefaultReleaseId();
}
});
KieBuilder kieBuilder = getKieServices().newKieBuilder(kieFileSystem());
kieBuilder.buildAll();
return getKieServices().newKieContainer(kieRepository.getDefaultReleaseId());
}
private KieServices getKieServices() {
return KieServices.Factory.get();
}
@Bean
@ConditionalOnMissingBean(KieBase.class)
public KieBase kieBase() throws IOException {
return kieContainer().getKieBase();
}
@Bean
@ConditionalOnMissingBean(KieSession.class)
public KieSession kieSession() throws IOException {
return kieContainer().newKieSession();
}
@Bean
@ConditionalOnMissingBean(KModuleBeanFactoryPostProcessor.class)
public KModuleBeanFactoryPostProcessor kiePostProcessor() {
return new KModuleBeanFactoryPostProcessor();
}
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#if de.getStorageMode()!=0 || de.getStorageMode()!=4 >
package ${pub.getPKGCodeName()}.core.repository ;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import ${pub.getPKGCodeName()}.core.repository.po.${de.getCodeName()};
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.getCodeName()}SearchContext;
/**
* 实体 [${item.getLogicName()}] 存储对象
*/
public interface ${item.codeName}Repository extends Repository<${item.codeName}> {
<#if de.getAllPSDEDataSets()??>
<#list de.getAllPSDEDataSets() as dedataset>
/**
* 查询集合 [<#if dedataset.getLogicName()??>${dedataset.getLogicName()}<#else>${dedataset.name}</#if>]
* @param context
* @return
*/
Page<${item.codeName}> search${dedataset.getCodeName()?cap_first}(${de.codeName}SearchContext context);
</#list>
</#if>
${de.getCodeName()} convert2PO(${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()} domain , ${de.getCodeName()} po) ;
${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()} convert2Domain( ${de.getCodeName()} po ,${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()} domain) ;
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.core.repository ;
public interface Repository<T> {
T createPO();
T get(String key);
<#-- T get(T po); -->
boolean create(T po);
boolean update(T po);
boolean remove(String key);
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#if de.getStorageMode()!=0 || de.getStorageMode()!=4 >
package ${pub.getPKGCodeName()}.core.repository.po ;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.math.BigInteger;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.getCodeName()}SearchContext;
/**
* 实体 [${item.getLogicName()}] 存储模型
*/
public interface ${item.codeName}{
<#list de.getAllPSDEFields() as defield>
<#if defield.isPhisicalDEField()>
/**
* ${defield.getLogicName()}
*/
${srfjavatype(defield.stdDataType)} get${defield.codeName?cap_first}();
void set${defield.codeName?cap_first}(${srfjavatype(defield.stdDataType)} ${defield.codeName?uncap_first});
/**
* 获取 [${defield.getLogicName()}]脏标记
*/
boolean get${defield.getCodeName()?cap_first}DirtyFlag();
</#if>
</#list>
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
# ${sys.getCodeName()?lower_case}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}-dependencies</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
<name>${pub.getCodeName()?lower_case?cap_first} Dependencies</name>
<packaging>pom</packaging>
<description>${pub.getCodeName()?lower_case?cap_first} Dependencies</description>
<!-- Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>
<#-- properties, usually record jars version constants -->
<properties>
<!-- Spring Cloud Alibaba(2.1.x.RELEASE) & Spring Cloud(Spring Cloud Greenwich) & Spring Boot(2.1.x.RELEASE) compatibility -->
<spring-cloud-alibaba.version>2.1.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.16</alibaba-druid.version>
<!-- Mybatis Plus -->
<mybatis-plus.version>3.0.6</mybatis-plus.version>
<mybatis-plus-dynamic-datasource.version>2.5.4</mybatis-plus-dynamic-datasource.version>
<!-- Liquibase -->
<liquibase.version>3.6.3</liquibase.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>
<!-- Activity -->
<activiti.version>7.1.0.M2</activiti.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
<#-- dependencies,just for statement, manage the version of jars -->
<dependencyManagement>
<dependencies>
<!-- Alibaba Cloud -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${r'${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>${r'${spring-cloud-openfeign.version}'}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Alibaba Druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${r'${alibaba-druid.version}'}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${r'${alibaba-druid.version}'}</version>
</dependency>
<!-- Mybatis Plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${r'${mybatis-plus.version}'}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${r'${mybatis-plus-dynamic-datasource.version}'}</version>
</dependency>
<!-- Liquibase -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${r'${liquibase.version}'}</version>
</dependency>
<!-- Swagger2 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${r'${springfox-swagger.version}'}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${r'${springfox-swagger.version}'}</version>
</dependency>
<!-- JBPM -->
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
<version>${r'${drools-version}'}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<version>${r'${drools-version}'}</version>
</dependency>
<!-- Drools -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${r'${drools-version}'}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${r'${drools-version}'}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${r'${drools-version}'}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${r'${drools-version}'}</version>
</dependency>
<!-- Activiti -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>${r'${activiti.version}'}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-json-converter</artifactId>
<version>${r'${activiti.version}'}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-image-generator</artifactId>
<version>${r'${activiti.version}'}</version>
</dependency>
<!-- Error -->
<#--<dependency>-->
<#--<groupId>org.zalando</groupId>-->
<#--<artifactId>problem-spring-web</artifactId>-->
<#--<version>${r'${zalando-problem-spring-web.version}'}</version>-->
<#--</dependency>-->
<!-- Security -->
<#--<dependency>-->
<#--<groupId>org.springframework.cloud</groupId>-->
<#--<artifactId>spring-cloud-starter-security</artifactId>-->
<#--<version>${r'${spring-cloud-security.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 Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</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>
<!-- Error -->
<#--<dependency>-->
<#--<groupId>org.zalando</groupId>-->
<#--<artifactId>problem-spring-web</artifactId>-->
<#--</dependency>-->
<!-- Security -->
<#--<dependency>-->
<#--<groupId>org.springframework.cloud</groupId>-->
<#--<artifactId>spring-cloud-starter-security</artifactId>-->
<#--</dependency>-->
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-docs</artifactId>
<packaging>pom</packaging>
<name>${pub.getCodeName()?lower_case?cap_first} Docs</name>
<description>${pub.getCodeName()?lower_case?cap_first} Docs</description>
</project>
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
# ${pub.getCodeName()?lower_case}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
<?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>${pub.getCodeName()?lower_case}</artifactId>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<version>${pub.getVersionString()?default("V0.0.1_alpha")}</version>
</parent>
<artifactId>${pub.getCodeName()?lower_case}-mongodb</artifactId>
<name>${pub.getCodeName()?lower_case?cap_first} MongoDB</name>
<description>${pub.getCodeName()?lower_case?cap_first} MongoDB</description>
<dependencies>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-core</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>${pub.getPKGCodeName()?lower_case}</groupId>
<artifactId>${pub.getCodeName()?lower_case}-util</artifactId>
<version>${r'${project.version}'}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies>
</project>
<#ibiztemplate>
TARGET=PSDEBDTABLE
</#ibiztemplate>
<#if item.getPSSysBDScheme()?? && item.getPSSysBDScheme().getBDType() == 'MONGODB' >
package ${pub.getPKGCodeName()}.mongodb;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.UUID;
import java.util.HashMap;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mongodb.BasicDBObject;
import com.mongodb.MongoBulkWriteException;
import com.mongodb.WriteResult;
import com.mongodb.bulk.BulkWriteResult;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.BulkOperations;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Repository;
import org.springframework.util.ObjectUtils;
import ${pub.getPKGCodeName()}.core.repository.${de.getCodeName()}Repository;
import ${pub.getPKGCodeName()}.core.repository.po.${de.getCodeName()};
import ${pub.getPKGCodeName()}.mongodb.po.${item.getPSSysBDTable().getCodeName()}Impl;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.filter.${de.codeName}SearchContext;
/**
* 关系型数据实体表[${de.getCodeName()}] 对象
*/
@Repository
@ConditionalOnProperty(prefix = "${de.getCodeName()?lower_case}", value="store" , havingValue = "nosql", matchIfMissing = <#if de.getStorageMode()==2>true<#else>false</#if>)
public class ${item.getPSSysBDTable().getCodeName()}RepositoryImpl implements ${de.getCodeName()}Repository{
@Autowired
private MongoTemplate mongoTemplate;
public ${de.getCodeName()} createPO() {
return new ${item.getPSSysBDTable().getCodeName()}Impl();
}
public ${de.getCodeName()} get(${srfjavatype(de.getKeyDEField().stdDataType)} key) {
Query query = new Query(Criteria.where("${de.getKeyPSDEField().getCodeName()?lower_case}").is(key));
return mongoTemplate.findOne(query, ${item.getPSSysBDTable().getCodeName()}Impl.class,"${item.getPSSysBDTable().getCodeName()?lower_case}");
}
<#--
public ${item.getPSSysBDTable().getCodeName()} get(${item.getPSSysBDTable().getCodeName()} po) {
return null;
}
-->
public boolean create(${de.getCodeName()} po) {
if(po.get${de.getKeyPSDEField().getCodeName()?cap_first}()==null){
po.set${de.getKeyPSDEField().getCodeName()?cap_first}(UUID.randomUUID().toString());
}
mongoTemplate.save(po,"${item.getPSSysBDTable().getCodeName()?lower_case}");
return true;
}
public boolean update(${de.getCodeName()} po) {
Query query = new Query(Criteria.where("${de.getKeyPSDEField().getCodeName()?lower_case}").is(po.get${de.getKeyPSDEField().getCodeName()?cap_first}()));
Update update = new Update();
String str = JSON.toJSONString(po);
JSONObject jQuery = JSON.parseObject(str);
jQuery.forEach((key, value) -> {
if (!key.equals("${de.getKeyPSDEField().getCodeName()?lower_case}")) {
update.set(key, value);
}
});
UpdateResult updateResult = mongoTemplate.updateFirst(query, update, ${de.getCodeName()}.class, "${item.getPSSysBDTable().getCodeName()?lower_case}");
if(updateResult!=null && updateResult.getMatchedCount()>0)
return true ;
return false;
}
public boolean remove(${srfjavatype(de.getKeyDEField().stdDataType)} key) {
Query query = new Query(Criteria.where("${de.getKeyPSDEField().getCodeName()?lower_case}").is(key));
DeleteResult deleteResult = mongoTemplate.remove(query,${de.getCodeName()}.class,"${item.getPSSysBDTable().getCodeName()?lower_case}");
if(deleteResult != null && deleteResult.getDeletedCount()>0)
return true ;
return false ;
}
<#if de.getAllPSDEDataSets()??>
<#list de.getAllPSDEDataSets() as dedataset>
public Page<${de.getCodeName()}> search${dedataset.getCodeName()?cap_first}(${de.codeName}SearchContext context){
List<${de.getCodeName()}> list = new ArrayList<${de.getCodeName()}>() ;
Map<String, String> conditions = null ;
if (ObjectUtils.isEmpty(conditions)) {
List<${item.getPSSysBDTable().getCodeName()}Impl> listImpl = mongoTemplate.findAll(${item.getPSSysBDTable().getCodeName()}Impl.class,"${item.getPSSysBDTable().getCodeName()?lower_case}");
for (${item.getPSSysBDTable().getCodeName()}Impl ${item.getPSSysBDTable().getCodeName()?lower_case}Impl : listImpl) {
list.add(${item.getPSSysBDTable().getCodeName()?lower_case}Impl);
}
} else {
//设置分页参数
Query query = new Query();
query.limit(100);
query.skip(1);
// query中注入查询条件
conditions.forEach((key, value) -> query.addCriteria(Criteria.where(key).is(value)));
list = mongoTemplate.find(query, ${de.getCodeName()}.class,"${item.getPSSysBDTable().getCodeName()?lower_case}");
}
return new PageImpl<${de.getCodeName()}>(list, context.getPageable(), 10000);
}
</#list>
</#if>
public ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()} convert2Domain( ${de.getCodeName()} po ,${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()} domain){
if(po == null)
return domain ;
if(domain == null){
domain = new ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()}();
}
BeanCopier copier=BeanCopier.create(po.getClass(), domain.getClass(), false);
copier.copy(po, domain, null);
return domain ;
}
public ${de.getCodeName()} convert2PO(${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.getCodeName()} domain , ${de.getCodeName()} po){
if(domain == null)
return po ;
if(po==null){
po = createPO() ;
}
BeanCopier copier=BeanCopier.create(domain.getClass(), po.getClass(), false);
copier.copy(domain, po, null);
return po ;
}
}
</#if>
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
package ${pub.getPKGCodeName()}.mongodb.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConditionalOnClass(MongoDBConfiguration.class)
@ConditionalOnWebApplication
public class MongoDBAutoConfiguration {
}
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
org.springframework.boot.autoconfigure.EnableAutoConfiguration=${pub.getPKGCodeName()}.mongodb.config.MongoDBAutoConfiguration
\ No newline at end of file
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
此差异已折叠。
<#ibiztemplate>
TARGET=PSSYSTEM
</#ibiztemplate>
org.springframework.boot.autoconfigure.EnableAutoConfiguration=${pub.getPKGCodeName()}.mybatis.config.MybatisAutoConfiguration
\ No newline at end of file
此差异已折叠。
<#ibiztemplate>
TARGET=PSSYSSERVICEAPI
</#ibiztemplate>
org.springframework.boot.autoconfigure.EnableAutoConfiguration=${pub.getPKGCodeName()}.service.${item.getCodeName()?lower_case}.config.${item.codeName}AutoConfiguration
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册