提交 8c0967f8 编写于 作者: sq3536's avatar sq3536

129

上级 b6d3c63c
......@@ -45,9 +45,9 @@ public class Generate extends IbizLabGeneratorCommand {
"(or multiple options, each with -t /templateA -t /tmp/templateB)")
private List<String> templateDirs;
@Option(name = {"--template-name"}, title = "template name",
description = "special template name, e.g. r7 or r8 or ibiz-boot or doc, sets template name properties that can be load inner template from class-path/resources ")
private String templateName;
@Option(name = {"--embed-template"}, title = "embed template name",
description = "special embed template name, e.g. r7 or r8 or ibiz-boot or doc, sets template name properties that can be load inner template from class-path/resources ")
private String embedTemplate;
@Option(name = {"--template-path"}, title = "template files relative path",
description = "special template file's relative path, multiple paths are supported, the format of /folderA/README.md.hbs,/folderB/sub/file.json.hbs " +
......@@ -172,8 +172,8 @@ public class Generate extends IbizLabGeneratorCommand {
configurator.setTemplateDirs(templateDirs);
}
if(!StringUtils.isEmpty(templateName)) {
configurator.setTemplateName(templateName);
if(!StringUtils.isEmpty(embedTemplate)) {
configurator.setEmbedTemplate(embedTemplate);
}
if (!ObjectUtils.isEmpty(templatePaths)) {
......
......@@ -3,6 +3,8 @@ package cn.ibizlab.codegen.cmd;
import cn.ibizlab.codegen.templating.TemplateManager;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
......@@ -30,42 +32,49 @@ public class ListCommand extends IbizLabGeneratorCommand {
List<String> retList = new ArrayList<>();
if (!StringUtils.isEmpty(template)) {
getList("templ/"+template,"",retList,true);
retList=getList("templ/"+template+"/**");
retList.forEach(item->System.out.println(item));
} else {
getList("templ","",retList,false);
retList=getList("templ/**");
retList.forEach(item->System.out.println(item));
}
retList.forEach(item->System.out.println(item));
}
private ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
public void getList(String rootDir,String templateDir, List<String> list,boolean recu) {
public List<String> getList(String rootDir) {
List<String> list=new ArrayList<>();
try
{
if(templateDir.endsWith("//"))
return;
URL url = this.getClass().getClassLoader().getResource(rootDir+"/"+templateDir);
if (url != null) {
InputStream stream = this.getClass().getClassLoader().getResourceAsStream(rootDir+"/"+templateDir);
try(Scanner scanner = new Scanner(stream)) {
while (scanner.hasNextLine()) {
String str = scanner.nextLine();
if(!StringUtils.isEmpty(str))
{
String newPath=str;
if(!StringUtils.isEmpty(templateDir))
newPath=templateDir+"/"+str;
if(recu&&(!str.endsWith(".hbs"))&&(!str.endsWith(".ibizlab-generator-ignore"))&&(str.indexOf(".")<0))
getList(rootDir,newPath,list,recu);
else
list.add(newPath);
}
}
} catch (Exception e) {
Resource[] resource=resourceResolver.getResources("classpath:"+rootDir);
for(Resource file:resource)
{
if(file instanceof ClassPathResource)
{
String path=((ClassPathResource)file).getPath();
String name=file.getFilename();
path=path.replaceAll("\\\\","/");
if(path.endsWith("/"))
continue;
path=path.substring(rootDir.length()-2);
list.add(path);
}
else if(file instanceof FileSystemResource)
{
String path=((FileSystemResource)file).getPath();
String name=file.getFilename();
if(file.getFile().isDirectory())
continue;
path=path.replaceAll("\\\\","/");
String atStr="/modules/ibizlab-generator-core/target/classes/";
int at="/modules/ibizlab-generator-core/target/classes/".length()+rootDir.length()-2;
path=path.substring(path.indexOf(atStr)+at);
list.add(path);
}
}
......@@ -74,6 +83,7 @@ public class ListCommand extends IbizLabGeneratorCommand {
ex.printStackTrace();
}
return list;
}
}
......@@ -154,9 +154,9 @@
</dependency>
<dependency>
<groupId>net.ibizsys.model</groupId>
<groupId>net.ibizsys.plugin</groupId>
<artifactId>ibiz-model</artifactId>
<version>0.2.23</version>
<version>8.1.0.132</version>
<exclusions>
<exclusion>
<artifactId>slf4j-simple</artifactId>
......
......@@ -42,7 +42,7 @@ public class CodegenConfig {
private List<String> templateDirs;
private String templateName;
private String embedTemplate;
private String auth;
......@@ -169,8 +169,8 @@ public class CodegenConfig {
private CommonTemplateContentLocator commonTemplateContentLocator;
public CommonTemplateContentLocator getCommonTemplateContentLocator() {
if((!StringUtils.isEmpty(templateName))&&commonTemplateContentLocator==null) {
String loc = TemplateManager.getCPResourcePath(Paths.get("templ" , templateName).toString());
if((!StringUtils.isEmpty(embedTemplate))&&commonTemplateContentLocator==null) {
String loc = TemplateManager.getCPResourcePath(Paths.get("templ" , embedTemplate).toString());
URL url = this.getClass().getClassLoader().getResource(loc);
if (url != null) {
commonTemplateContentLocator = new CommonTemplateContentLocator(loc);
......
......@@ -41,7 +41,7 @@ public final class CodegenConfigurator {
private String outputDir;
private List<String> filters;
private List<String> templateDirs;
private String templateName;
private String embedTemplate;
private List<String> templatePaths;
private List<String> templateFilters;
private String auth;
......@@ -214,8 +214,8 @@ public final class CodegenConfigurator {
return this;
}
public CodegenConfigurator setTemplateName(String templateName) {
this.templateName = templateName;
public CodegenConfigurator setEmbedTemplate(String embedTemplate) {
this.embedTemplate = embedTemplate;
return this;
}
......@@ -264,8 +264,8 @@ public final class CodegenConfigurator {
config.setTemplateDirs(this.templateDirs);
}
if(!StringUtils.isEmpty(templateName)) {
config.setTemplateName(this.templateName);
if(!StringUtils.isEmpty(embedTemplate)) {
config.setEmbedTemplate(this.embedTemplate);
}
if(!ObjectUtils.isEmpty(templatePaths)) {
......
......@@ -8,7 +8,7 @@ import net.ibizsys.model.dataentity.service.IPSDEMethodDTO;
import net.ibizsys.model.dataentity.service.IPSDEServiceAPI;
import net.ibizsys.model.dataentity.service.IPSDEServiceAPIMethod;
import net.ibizsys.model.dataentity.service.IPSDEServiceAPIRS;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.util.CollectionUtils;
import java.util.*;
......
......@@ -9,8 +9,8 @@ import lombok.Setter;
import lombok.experimental.Accessors;
import net.ibizsys.model.dataentity.IPSDataEntity;
import net.ibizsys.model.dataentity.service.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -45,7 +45,7 @@ public class ApiMethodModel extends BaseModel {
public String getMethodName() {
String strName = super.getName();
if (CollectionUtils.isNotEmpty(parentApiEntities)) {
if (!CollectionUtils.isEmpty(parentApiEntities)) {
strName += "By";
for (ApiEntityRSModel parent : parentApiEntities) {
strName += StringAdvUtils.pascalcase(parent.getParentIdFieldCodeName());
......
......@@ -37,14 +37,11 @@ public class SystemModel extends BaseModel {
system.getAllPSSystemModules().forEach(item -> {
});
if (!ObjectUtils.isEmpty(system.getAllPSSysSFPubs())) {
system.getAllPSSysSFPubs().forEach(pub -> {
if (pub.isMainPSSysSFPub())
this.pub = pub;
});
if (!ObjectUtils.isEmpty(system.getDefaultPSSysSFPub())) {
if (this.pub == null)
this.pub = system.getAllPSSysSFPubs().get(0);
this.pub = system.getDefaultPSSysSFPub();
}
if (this.pub != null) {
this.setCodeName(this.pub.getCodeName());
......
package cn.ibizlab.codegen.templating;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import java.io.File;
import java.io.InputStream;
......@@ -56,36 +61,43 @@ public class CommonTemplateContentLocator implements TemplatePathLocator {
}
public List<String> getTemplatePaths() {
List<String> list = new ArrayList<>();
getList(this.resourceLocation,"",list,true);
List<String> list = getList(this.resourceLocation+"/**");
return list;
}
private void getList(String rootDir, String templateDir, List<String> list, boolean recu) {
public List<String> getList(String rootDir) {
List<String> list=new ArrayList<>();
try
{
if(templateDir.endsWith("//"))
return;
URL url = this.getClass().getClassLoader().getResource(rootDir+"/"+templateDir);
if (url != null) {
InputStream stream = this.getClass().getClassLoader().getResourceAsStream(rootDir+"/"+templateDir);
try(Scanner scanner = new Scanner(stream)) {
while (scanner.hasNextLine()) {
String str = scanner.nextLine();
if(!org.springframework.util.StringUtils.isEmpty(str))
{
String newPath=str;
if(!org.springframework.util.StringUtils.isEmpty(templateDir))
newPath=templateDir+"/"+str;
if(recu&&(!str.endsWith(".hbs"))&&(!str.endsWith(".ibizlab-generator-ignore"))&&(str.indexOf(".")<0))
getList(rootDir,newPath,list,recu);
else
list.add(newPath);
}
}
} catch (Exception e) {
ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
Resource[] resource=resourceResolver.getResources("classpath:"+rootDir);
for(Resource file:resource)
{
if(file instanceof ClassPathResource)
{
String path=((ClassPathResource)file).getPath();
String name=file.getFilename();
path=path.replaceAll("\\\\","/");
if(path.endsWith("/"))
continue;
path=path.substring(rootDir.length()-2);
list.add(path);
}
else if(file instanceof FileSystemResource)
{
String path=((FileSystemResource)file).getPath();
String name=file.getFilename();
if(file.getFile().isDirectory())
continue;
path=path.replaceAll("\\\\","/");
String atStr="/modules/ibizlab-generator-core/target/classes/";
int at="/modules/ibizlab-generator-core/target/classes/".length()+rootDir.length()-2;
path=path.substring(path.indexOf(atStr)+at);
list.add(path);
}
}
......@@ -94,5 +106,7 @@ public class CommonTemplateContentLocator implements TemplatePathLocator {
ex.printStackTrace();
}
return list;
}
}
......@@ -5,7 +5,7 @@
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
<version>{{system.pub.versionString}}</version>
<name>{{projectDesc}}</name>
<description></description>
<packaging>pom</packaging>
......@@ -18,35 +18,27 @@
<modules>
<module>{{projectName}}-core</module>
<!-- boot -->
<module>{{projectName}}-boot</module>
<module>{{projectName}}-provider</module>
</modules>
<dependencies>
<!--达梦数据库-->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>Dm7JdbcDriver17</artifactId>
<version>7.6.0.165</version>
</dependency>
{{#each system.allPSSysSFPubs as |pub|}}
{{#eq pub.contentType "CODE"}}
{{#each pub.getPSSysSFPubPkgs as |package|}}
{{#eq system.pub.contentType "CODE"}}
{{#each system.pub.psSysSFPubPkgs as |package|}}
{{#if package.pkgParam}}
{{package.pkgParam}}
{{/if}}
{{/each}}
{{/eq}}
{{/each}}
</dependencies>
<repositories>
<repository>
<id>aliyunmaven</id>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public/</url>
<id>ibizmvnrepository</id>
<name>ibizmvnrepository</name>
<url>http://172.16.240.220:8081/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
......@@ -57,9 +49,9 @@
</snapshots>
</repository>
<repository>
<id>ibizmvnrepository</id>
<name>ibizmvnrepository</name>
<url>http://172.16.240.220:8081/nexus/content/groups/public/</url>
<id>aliyunmaven</id>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
......@@ -70,4 +62,50 @@
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>ibizmvnrepository-plugin</id>
<url>http://172.16.240.220:8081/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>aliyun-plugin</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>{{projectName}}-boot</artifactId>
<name>{{projectDesc}} Boot [{{projectName}}-boot]</name>
<description>{{projectDesc}} Boot</description>
<dependencies>
<dependency>
<groupId>{{packageName}}</groupId>
<artifactId>{{projectName}}-core</artifactId>
<version>1.0.0.0</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>boot</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>{{projectName}}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>{{packageName}}.DevBootApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<output>
../
</output>
<inputSpec>
${basedir}/src/main/resources/model/com/sa/jcsc
</inputSpec>
<templateDirs>
${basedir}/src/main/resources/templ/ibiz-boot
</templateDirs>
<templateName>
ibiz-boot
</templateName>
<packageName>
${project.groupId}
</packageName>
<name>
${parent.artifactId}
</name>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -6,7 +6,7 @@
<parent>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
<version>{{system.pub.versionString}}</version>
</parent>
<artifactId>{{projectName}}-core</artifactId>
......@@ -19,5 +19,88 @@
<artifactId>ibiz-boot-starter</artifactId>
<version>2.4.0.132</version>
</dependency>
<!-- Liquibase -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.9.0</version>
</dependency>
<!-- H2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>diff</id>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<executions>
<execution>
<id>prepare-newdb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/h2_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>prepare-olddb</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/master_table.xml</changeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<dropFirst>true</dropFirst>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>make-diff</id>
<configuration>
<changeLogFile>${project.basedir}/src/main/resources/liquibase/changelog/empty.xml</changeLogFile>
<diffChangeLogFile>${project.basedir}/src/main/resources/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:file:${project.build.directory}/db/last;MODE=mysql</url>
<username>root</username>
<password></password>
<referenceUrl>jdbc:h2:file:${project.build.directory}/db/new;MODE=mysql</referenceUrl>
<referenceDriver>org.h2.Driver</referenceDriver>
<referenceUsername>root</referenceUsername>
<verbose>true</verbose>
<logging>debug</logging>
<contexts>!test</contexts>
<diffExcludeObjects>Index:.*,table:ibzfile,ibzuser,ibzdataaudit,ibzcfg,IBZFILE,IBZUSER,IBZDATAAUDIT,IBZCFG</diffExcludeObjects>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>diff</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
......@@ -6,6 +6,5 @@ import net.ibizsys.central.plugin.boot.core.domain.BaseData;
public interface I{{sysUtil.codeName}} extends ISysUtilRuntime {
BaseData getMapData(BaseData dto) throws Throwable ;
}
{{/if}}
\ No newline at end of file
......@@ -11,8 +11,5 @@ public class {{sysUtil.codeName}} extends SysUtilRuntimeBase implements I{{sysUt
return (SystemRuntime) super.getSystemRuntime();
}
public BaseData getMapData(BaseData dto) throws Throwable {
return dto;
}
}
{{/if}}
\ No newline at end of file
package {{packageName}}.{{entity.module}}.domain;
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.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import net.ibizsys.central.plugin.boot.core.domain.BaseData;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Transient;
import org.springframework.data.annotation.Id;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
{{#entity.relEntities}}
import {{packageName}}.{{module}}.domain.{{codeName}};
{{/entity.relEntities}}
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@ApiModel("{{entity.logicName}}")
public class {{entity.codeName}} extends BaseData implements Serializable
{
{{#each entity.fields}}
{{#unless deepStructure}}
/**
* {{logicName}}
*/
{{#if keyDEField}}
@Id
{{/if}}
@JsonProperty("{{jsonName}}")
{{#timeType}}
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
{{/timeType}}
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
{{#eq type.java "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@ApiModelProperty(value = "{{columnName}}",name = "{{jsonName}}",notes = "{{logicName}}")
private {{type.java}} {{camelCase codeName}};
{{/unless}}
{{/each}}
{{#each entity.references}}
/**
* {{entityLogicName}}
*/
@JSONField(name = "{{lowerCase codeName}}")
@JsonProperty("{{lowerCase codeName}}")
@ApiModelProperty(value = "{{lowerCase codeName}}",name = "{{lowerCase codeName}}",notes = "{{logicName}}")
private {{entityCodeName}} {{camelCase codeName}};
{{/each}}
{{#each entity.nesteds}}
/**
* {{entityLogicName}}
*/
{{#if listCode}}
@JSONField(name = "{{listCode}}")
@JsonProperty("{{listCode}}")
@ApiModelProperty(value = "{{lowerCase listCode}}",name = "{{lowerCase codeName}}",notes = "{{logicName}}")
{{else}}
@JsonIgnore
@JSONField(serialize = false)
@ApiModelProperty(value = "{{lowerCase codeName}}",name = "{{lowerCase codeName}}",notes = "{{logicName}}")
{{/if}}
private List<{{entityCodeName}}> {{camelCase codeName}};
{{/each}}
{{#each entity.fields}}
{{#unless deepStructure}}
{{#unless keyDEField}}
{{#unless predefinedType}}
/**
* 设置 [{{logicName}}]
*/
public void set{{pascalCase codeName}}({{type.java}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
this.modify("{{lowerCase name}}", {{camelCase codeName}});
}
{{/unless}}
{{/unless}}
{{/unless}}
{{/each}}
}
\ No newline at end of file
package {{packageName}}.{{entity.module}}.service.impl;
import lombok.extern.slf4j.Slf4j;
import net.ibizsys.central.plugin.boot.core.service.impl.MPServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
{{#system.enableGlobalTransaction}}
import io.seata.spring.annotation.GlobalTransactional;
{{/system.enableGlobalTransaction}}
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Lazy;
import {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.{{entity.module}}.filter.{{entity.codeName}}SearchContext;
import {{packageName}}.{{entity.module}}.service.I{{entity.codeName}}Service;
import {{packageName}}.{{entity.module}}.mapper.{{entity.codeName}}Mapper;
{{#entity.relEntities}}
import {{packageName}}.{{module}}.domain.{{codeName}};
{{#neq storage "NONE"}}
import {{packageName}}.{{module}}.service.I{{codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
/**
* 实体[{{entity.logicName}}] 服务对象接口实现
*/
@Slf4j
@Service("{{entity.codeName}}Service")
public class {{entity.codeName}}ServiceImpl extends MPServiceImpl<{{entity.codeName}},{{entity.codeName}}SearchContext,{{entity.codeName}}Mapper> implements I{{entity.codeName}}Service {
{{#entity.relEntities}}
{{#neq storage "NONE"}}
@Autowired
@Lazy
protected I{{codeName}}Service {{camelCase codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
{{#each entity.extActions}}
public boolean {{camelCase codeName}}({{entity.codeName}} dto) throws Throwable {
if(!I{{entity.codeName}}Service.super.{{camelCase codeName}}(dto))
return false;
return true;
}
{{/each}}
}
\ No newline at end of file
package {{packageName}}.{{entity.module}}.service;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cache.annotation.CacheEvict;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.ibizsys.central.util.ISearchContextDTO;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.model.dataentity.ds.IPSDEDataSet;
import net.ibizsys.central.plugin.boot.core.service.IBaseService;
import net.ibizsys.central.plugin.boot.core.helper.CachedBeanCopier;
import net.ibizsys.central.plugin.boot.core.helper.SpringContextHolder;
import net.ibizsys.central.dataentity.IDataEntityRuntimeContext;
import {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.{{entity.module}}.filter.{{entity.codeName}}SearchContext;
{{#entity.relEntities}}
import {{packageName}}.{{module}}.domain.{{codeName}};
{{#neq storage "NONE"}}
import {{packageName}}.{{module}}.service.{{codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
{{#dsName}}
@DS("{{entity.dataSource}}")
{{/dsName}}
public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeName}}, {{entity.codeName}}SearchContext> {
@Override
default String getDataEntityId() {
return "PSMODULES/{{entity.module}}/PSDATAENTITIES/{{entity.codeName}}.json";
}
default {{entity.codeName}}Service getProxyService() {
return SpringContextHolder.getBean(this.getClass());
}
default boolean create({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.create(dto);
}
default boolean onCreate({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onCreate(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean update({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.update(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onUpdate({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onUpdate(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean remove({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.remove(key);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable {
List keys=new ArrayList();
keys.add(key);
return IBaseService.super.onRemove(keys);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean remove(List keys) throws Throwable {
return IBaseService.super.remove(keys);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onRemove(List keys) throws Throwable {
return IBaseService.super.onRemove(keys);
}
default {{entity.codeName}} get({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.get(key);
}
default {{entity.codeName}} onGet({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.onGet(key);
}
default {{entity.codeName}} getDraft({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.getDraft(dto);
}
default {{entity.codeName}} onGetDraft({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onGetDraft(dto);
}
default Integer checkKey({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.checkKey(dto);
}
default Integer onCheckKey({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onCheckKey(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean save({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.save(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onSave({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onSave(dto);
}
{{#each entity.extActions}}
default boolean {{camelCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{dto}, true);
return true;
}
default boolean on{{pascalCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{dto}, null);
return true;
}
{{#if action}}
default {{entity.codeName}} {{camelCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = new {{entity.codeName}}();
dto.set{{pascalCase entity.keyField.codeName}}(key);
return {{camelCase codeName}}(dto);
}
default {{entity.codeName}} on{{pascalCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = new {{entity.codeName}}();
dto.set{{pascalCase entity.keyField.codeName}}(key);
return on{{pascalCase codeName}}(dto);
}
{{/if}}
{{/each}}
{{#entity.dataSets}}
default Page<{{entity.codeName}}> fetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("{{name}}", dto.getDataSet(), new Object[]{dto}, true);
}
default Page<{{entity.codeName}}> onFetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getDataEntityRuntimeContext().fetchDataSetReal("{{name}}", dto.getDataSet(), new Object[]{dto}, null);
}
default List<{{entity.codeName}}> select{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (List)this.getRuntimeService().getDataEntityRuntime().selectDataQuery("{{name}}", dto);
}
{{/entity.dataSets}}
}
\ No newline at end of file
......@@ -28,66 +28,24 @@ import {{packageName}}.{{entity.module}}.mapper.{{entity.codeName}}Mapper;
{{#entity.relEntities}}
import {{packageName}}.{{module}}.domain.{{codeName}};
{{#neq storage "NONE"}}
import {{packageName}}.{{module}}.service.I{{codeName}}Service;
import {{packageName}}.{{module}}.service.{{codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
{{#dsName}}
@DS("{{entity.dataSource}}")
{{/dsName}}
public interface I{{entity.codeName}}Service extends IMPService<{{entity.codeName}}, {{entity.codeName}}SearchContext,{{entity.codeName}}Mapper> {
public interface {{entity.codeName}}Service extends IMPService<{{entity.codeName}}, {{entity.codeName}}SearchContext,{{entity.codeName}}Mapper> {
@Override
default String getDataEntityId() {
return "PSMODULES/{{entity.module}}/PSDATAENTITIES/{{entity.codeName}}.json";
}
default I{{entity.codeName}}Service getProxyService() {
default {{entity.codeName}}Service getProxyService() {
return SpringContextHolder.getBean(this.getClass());
}
default Object onExecuteAction(String strActionName, IPSDEAction iPSDEAction, Object[] args) throws Throwable {
switch (strActionName.toLowerCase()) {
{{#each entity.extActions}}
case "{{lowerCase codeName}}" :
this.{{camelCase codeName}}(({{entity.codeName}})args[0]);
return null;
{{/each}}
}
return this.getRuntimeService().getDataEntityRuntime().executeAction(strActionName, iPSDEAction, args, true);
}
default Object onExecuteActionReal(IDataEntityRuntimeContext iDataEntityRuntimeContext, String strActionName, IPSDEAction iPSDEAction, Object[] args, Object actionData) throws Throwable{
switch (strActionName.toLowerCase()) {
{{#each entity.extActions}}
case "{{lowerCase codeName}}" :
this.on{{pascalCase codeName}}(({{entity.codeName}})args[0]);
return null;
{{/each}}
}
return iDataEntityRuntimeContext.executeActionReal(strActionName, iPSDEAction, args, actionData);
}
default Object onFetchDataSet(String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args) throws Throwable {
switch (strDataSetName.toLowerCase()) {
{{#entity.dataSets}}
case "{{lowerCase codeName}}" :
return this.fetch{{pascalCase codeName}}(({{entity.codeName}}SearchContext) args[0]);
{{/entity.dataSets}}
}
return this.getRuntimeService().getDataEntityRuntime().fetchDataSet(strDataSetName, iPSDEDataSet, args, true);
}
default Object onFetchDataSetReal(IDataEntityRuntimeContext iDataEntityRuntimeContext, String strDataSetName, IPSDEDataSet iPSDEDataSet, Object[] args, Object actionData) throws Throwable{
switch (strDataSetName.toLowerCase()) {
{{#entity.dataSets}}
case "{{lowerCase codeName}}" :
return this.onFetch{{pascalCase codeName}}(({{entity.codeName}}SearchContext) args[0]);
{{/entity.dataSets}}
}
return iDataEntityRuntimeContext.fetchDataSetReal(strDataSetName, iPSDEDataSet, args, actionData);
}
default boolean create({{entity.codeName}} dto) throws Throwable {
return IMPService.super.create(dto);
}
......
package {{packageName}}.{{entity.module}}.service;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cache.annotation.CacheEvict;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.ibizsys.central.util.ISearchContextDTO;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.model.dataentity.ds.IPSDEDataSet;
import net.ibizsys.central.plugin.boot.core.service.IBaseService;
import net.ibizsys.central.plugin.boot.core.helper.CachedBeanCopier;
import net.ibizsys.central.plugin.boot.core.helper.SpringContextHolder;
import net.ibizsys.central.dataentity.IDataEntityRuntimeContext;
import {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.{{entity.module}}.filter.{{entity.codeName}}SearchContext;
{{#entity.relEntities}}
import {{packageName}}.{{module}}.domain.{{codeName}};
{{#neq storage "NONE"}}
import {{packageName}}.{{module}}.service.{{codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
{{#dsName}}
@DS("{{entity.dataSource}}")
{{/dsName}}
public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeName}}, {{entity.codeName}}SearchContext> {
@Override
default String getDataEntityId() {
return "PSMODULES/{{entity.module}}/PSDATAENTITIES/{{entity.codeName}}.json";
}
default {{entity.codeName}}Service getProxyService() {
return SpringContextHolder.getBean(this.getClass());
}
default boolean create({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.create(dto);
}
default boolean onCreate({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onCreate(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean update({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.update(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onUpdate({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onUpdate(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean remove({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.remove(key);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable {
List keys=new ArrayList();
keys.add(key);
return IBaseService.super.onRemove(keys);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean remove(List keys) throws Throwable {
return IBaseService.super.remove(keys);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onRemove(List keys) throws Throwable {
return IBaseService.super.onRemove(keys);
}
default {{entity.codeName}} get({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.get(key);
}
default {{entity.codeName}} onGet({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.onGet(key);
}
default {{entity.codeName}} getDraft({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.getDraft(dto);
}
default {{entity.codeName}} onGetDraft({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onGetDraft(dto);
}
default Integer checkKey({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.checkKey(dto);
}
default Integer onCheckKey({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onCheckKey(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean save({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.save(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean onSave({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.onSave(dto);
}
{{#each entity.extActions}}
default boolean {{camelCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{dto}, true);
return true;
}
default boolean on{{pascalCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{dto}, null);
return true;
}
{{#if action}}
default {{entity.codeName}} {{camelCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = new {{entity.codeName}}();
dto.set{{pascalCase entity.keyField.codeName}}(key);
return {{camelCase codeName}}(dto);
}
default {{entity.codeName}} on{{pascalCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = new {{entity.codeName}}();
dto.set{{pascalCase entity.keyField.codeName}}(key);
return on{{pascalCase codeName}}(dto);
}
{{/if}}
{{/each}}
{{#entity.dataSets}}
default Page<{{entity.codeName}}> fetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("{{name}}", dto.getDataSet(), new Object[]{dto}, true);
}
default Page<{{entity.codeName}}> onFetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getDataEntityRuntimeContext().fetchDataSetReal("{{name}}", dto.getDataSet(), new Object[]{dto}, null);
}
default List<{{entity.codeName}}> select{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (List)this.getRuntimeService().getDataEntityRuntime().selectDataQuery("{{name}}", dto);
}
{{/entity.dataSets}}
}
\ No newline at end of file
spring:
cloud:
nacos:
discovery:
server-addr: nacos.ibizcloud.cn:8848
group: ibiz_config_group
config:
server-addr: nacos.ibizcloud.cn:8848
group: ibiz_config_group
file-extension: yaml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>{{system.pub.versionString}}</version>
</parent>
<artifactId>{{projectName}}-provider</artifactId>
<name>{{projectDesc}} Boot [{{projectName}}-provider]</name>
<description>{{projectDesc}} Boot</description>
<dependencies>
<dependency>
<groupId>{{packageName}}</groupId>
<artifactId>{{projectName}}-core</artifactId>
<version>{{system.pub.versionString}}</version>
</dependency>
</dependencies>
<properties>
<docker.image.prefix>registry.cn-shanghai.aliyuncs.com/ibizsys</docker.image.prefix>
</properties>
<profiles>
<profile>
<id>boot</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>{{projectName}}</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>{{packageName}}.IBizRuntimeApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>runtime</id>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>{{projectName}}-provider</finalName>
<jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
<mainClass>{{packageName}}.IBizRuntimeApplication</mainClass>
<outputDirectory>../</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<serverId>ibiz-dev</serverId>
<imageName>${docker.image.prefix}/${project.artifactId}:latest</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>../</directory>
<include>${project.artifactId}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>prepare</id>
<configuration>
<executable>cp</executable>
<arguments>
<argument>../${project.artifactId}.jar</argument>
<argument>${project.basedir}/src/main/docker/</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>buildpush</id>
<configuration>
<executable>docker</executable>
<arguments>
<argument>buildx</argument>
<argument>build</argument>
<argument>--platform</argument>
<argument>linux/amd64,linux/arm64</argument>
<argument>-t</argument>
<argument>${docker.image.prefix}/${project.artifactId}:latest</argument>
<argument>${project.basedir}/src/main/docker</argument>
<argument>--push</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-model</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<!-- 输出目录 -->
<outputDirectory>${project.build.outputDirectory}/model--3620927A-1D8A-4D78-B879-B838BBDFAD7F--1</outputDirectory>
<resources>
<resource>
<!-- 资源目录 -->
<directory>${project.basedir}/../model</directory>
<includes>
<include>**/**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<output>
../
</output>
<inputSpec>
${basedir}/src/main/resources/model/com/sa/jcsc
</inputSpec>
<templateDirs>
${basedir}/src/main/resources/templ/ibiz-boot
</templateDirs>
<embedTemplate>
ibiz-boot
</embedTemplate>
<packageName>
${project.groupId}
</packageName>
<name>
${parent.artifactId}
</name>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -8,11 +8,11 @@ import org.springframework.context.annotation.ComponentScan;
@EnableDiscoveryClient(autoRegister=false)
@SpringBootApplication(exclude= SecurityAutoConfiguration.class)
@ComponentScan({"net.ibizsys.central.cloud.core.spring","{{packageName}}"})
public class DevBootApplication {
@ComponentScan({"net.ibizsys.central.cloud.core.spring","net.ibizsys.central.plugin.boot.core","{{packageName}}"})
public class IBizRuntimeApplication {
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class, args);
SpringApplication.run(IBizRuntimeApplication.class, args);
}
}
**服务(service)接口的实现**
按需实现core项目中的接口,注意要继承自ibiz-boot-starter中的基础服务类,完成和dataEntityRuntime的衔接,有以下几个可选:
* 1.MPServiceImpl<Entity,EntitySearchContext,EntityMapper>
自带mybatis-plus的baseMapper,可以直接使用部分mybatis-plus的常用方法(list/count/getOne),有数据库操作时优先选用
* 2.BaseServiceImpl<Entity,EntitySearchContext>
最低基础服务类
实现类建议放入本项目的对应模块.service.impl包内,示例如下:
```
@Slf4j
@Service
public class XXXServiceImpl extends MPServiceImpl<XXX,XXXSearchContext,XXXMapper> implements XXXService {
//示例1:整体重写create方法
public boolean create(XXX et) {
if(!XXXService.supper.create(et))
return false;
return true;
}
//示例2:分段重写update方法, 支持before/on/after分段的方法有 create,update,save,getDraft,VOID的自定义方法
public void beforeUpdate(XXX et) {
et.setMemo("示例");
}
public boolean onUpdate(XXX et) {
if(!XXXService.supper.onUpdate(et))
return false;
return true;
}
public void afterUpdate(XXX et) {
et.setMemo("示例");
}
//示例3:分段重写fetch方法, 支持before/on分段,所有查询集合都支持,codeName已做驼峰转换,参照XXXService接口中声明的方法名
public void beforeFetchDefault(XXXSearchContext dto) {
dto.eq("field1","条件值");
}
public Page<XXX> onFetchDefault(XXXSearchContext dto) {
return XXXService.supper.onFetchDefault(dto);
}
}
```
{{#if (and (eq sysUtil.utilType "USER")) (unless sysUtil.pSSysSFPlugin)}}
package {{packageName}}.runtime.sysutil;
{{/if}}
\ No newline at end of file
......@@ -42,7 +42,7 @@ public class GenerateMojo extends AbstractMojo {
private String[] templateDirs;
@Parameter
private String templateName;
private String embedTemplate;
@Parameter
private String[] templatePaths;
......@@ -136,8 +136,8 @@ public class GenerateMojo extends AbstractMojo {
configurator.setTemplateDirs(Arrays.asList(templateDirs));
}
if(!StringUtils.isEmpty(templateName)) {
configurator.setTemplateName(this.templateName);
if(!StringUtils.isEmpty(embedTemplate)) {
configurator.setEmbedTemplate(this.embedTemplate);
}
if (!ObjectUtils.isEmpty(templatePaths)) {
......
......@@ -65,6 +65,17 @@
<jackson.version>2.10.2</jackson.version>
</properties>
<distributionManagement>
<repository>
<id>ibizmvnrepository-plugin</id>
<url>http://172.16.240.220:8081/repository/releases</url>
</repository>
<snapshotRepository>
<id>ibizmvnrepository-plugin</id>
<url>http://172.16.240.220:8081/repository/snapshots</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>aliyunmaven</id>
......@@ -82,7 +93,7 @@
<repository>
<id>ibizmvnrepository</id>
<name>ibizmvnrepository</name>
<url>http://172.16.240.220:8081/nexus/content/groups/public/</url>
<url>http://172.16.240.220:8081/repository/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册