提交 5fc220b7 编写于 作者: sq3536's avatar sq3536

ibizboot

上级 c0ceb20f
*volumes
*target
.settings
*node_modules
*bin
*.project
*.classpath
*.factorypath
.history
.vscode
.idea
**.iml
*.jar
*.log
.DS_Store
**.ibizlab-generator-ignore
**.DS_Store
**@macro/**
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
<name>{{projectDesc}}</name>
<description></description>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
</parent>
<modules>
<!-- boot -->
<module>{{projectName}}-boot</module>
</modules>
<dependencies>
<dependency>
<groupId>net.ibizsys.plugin</groupId>
<artifactId>ibiz-boot-starter</artifactId>
<version>2.4.0.123</version>
</dependency>
<!--达梦数据库-->
<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|}}
{{#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>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>ibizmvnrepository</id>
<name>ibizmvnrepository</name>
<url>http://172.16.240.220:8081/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>{{projectName}}</artifactId>
<groupId>{{packageName}}</groupId>
<version>1.0.0.0</version>
</parent>
<artifactId>{{projectName}}-boot</artifactId>
<name>{{projectDesc}} Dev Monolithic Boot</name>
<description>{{projectDesc}} Boot</description>
<dependencies>
</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>
</project>
package {{packageName}};
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
@EnableDiscoveryClient(autoRegister=false)
@SpringBootApplication(exclude= SecurityAutoConfiguration.class)
@ComponentScan({"net.ibizsys.central.cloud.core.spring","{{packageName}}"})
public class DevBootApplication {
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class, args);
}
}
package {{packageName}}.runtime;
import net.ibizsys.central.dataentity.IDataEntityRuntime;
import net.ibizsys.central.dataentity.service.IDEService;
import net.ibizsys.model.IPSDynaInstService;
import net.ibizsys.model.IPSSystemService;
import net.ibizsys.model.PSModelServiceImpl;
import net.ibizsys.model.res.IPSSysUtil;
import net.ibizsys.runtime.res.ISysUtilRuntime;
import net.ibizsys.central.plugin.boot.core.runtime.BootSystemRuntime;
public class SystemRuntime extends BootSystemRuntime {
@Override
public String getName() {
return "{{system.name}}";
}
@Override
protected IPSSystemService createPSSystemService() throws Exception {
PSModelServiceImpl psModelServiceImpl = new PSModelServiceImpl();
psModelServiceImpl.setPSModelFolderPath("/model/{{replace packageName "." "/"}}", true);
return psModelServiceImpl;
}
@Override
protected ISysUtilRuntime createDefaultSysUtilRuntime(IPSSysUtil iPSSysUtil) {
return super.createDefaultSysUtilRuntime(iPSSysUtil);
}
}
package {{packageName}}.util.config;
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties;
import net.ibizsys.central.plugin.boot.core.helper.UniqueNameGenerator;
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Properties;
{{#eq system.saaSMode 4}}
import com.baomidou.mybatisplus.core.parser.ISqlParserFilter;
import com.baomidou.mybatisplus.core.parser.SqlParserHelper;
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
import com.baomidou.mybatisplus.core.parser.ISqlParser;
import org.apache.ibatis.mapping.MappedStatement;
import java.util.ArrayList;
import java.util.List;
{{/eq}}
/**
* mybatis全局配置类
*/
@Configuration
@MapperScan(value="{{packageName}}.*.mapper",nameGenerator = UniqueNameGenerator.class)
public class MybatisConfiguration {
}
\ No newline at end of file
{{#if entity.needTypeHandler}}
package {{packageName}}.{{entity.module}}.domain.handlers;
import {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@MappedTypes({List.class})
@MappedJdbcTypes(JdbcType.VARCHAR)
public class {{entity.codeName}}TypeHandler extends AbstractJsonTypeHandler<List>
{
private static ObjectMapper objectMapper = new ObjectMapper();
private JavaType type;
public {{entity.codeName}}TypeHandler(Class<List> type) {
this.type = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, {{entity.codeName}}.class);
}
@Override
protected List parse(String json) {
try {
return objectMapper.readValue(json, type);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
protected String toJson(List obj) {
try {
return objectMapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
public static void setObjectMapper(ObjectMapper objectMapper) {
{{entity.codeName}}TypeHandler.objectMapper = objectMapper;
}
}
{{/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}}.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 org.springframework.util.Assert;
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;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
{{#entity.relEntities}}
import {{packageName}}.{{module}}.domain.{{codeName}};
{{/entity.relEntities}}
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "{{entity.tableName}}", resultMap = "{{entity.codeName}}ResultMap")
@ApiModel("{{entity.logicName}}")
public class {{entity.codeName}} extends BaseData implements Serializable
{
{{#each entity.fields}}
{{#unless deepStructure}}
/**
* {{logicName}}
*/
{{#if keyDEField}}
@Id
{{#if phisicalDEField}}
@TableId(value = "{{columnName}}"{{#type.number}} , type = IdType.ASSIGN_ID{{/type.number}}{{#type.string}} , type = IdType.ASSIGN_UUID{{/type.string}})
{{else}}
@TableField(exist = false)
{{/if}}
{{else}}
@TableField(value = "{{columnName}}"{{#insertOnly}} , fill = FieldFill.INSERT{{/insertOnly}}{{^phisicalDEField}} , exist = false{{/phisicalDEField}})
{{#logicValidField}}
@TableLogic{{#validLogicValue}}(value = "{{validLogicValue}}"{{#invalidLogicValue}} , delval = "{{invalidLogicValue}}"{{/invalidLogicValue}}){{/validLogicValue}}
{{/logicValidField}}
{{/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}}
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
@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}}")
{{else}}
@JsonIgnore
@JSONField(serialize = false)
{{/if}}
{{#if columnName}}
@TableField(value = "{{columnName}}" , typeHandler = {{packageName}}.{{module}}.domain.handlers.{{entityCodeName}}TypeHandler.class)
@ApiModelProperty(value = "{{columnName}}",name = "{{lowerCase codeName}}",notes = "{{logicName}}")
{{else}}
@TableField(exist = false)
@ApiModelProperty(value = "{{lowerCase codeName}}",name = "{{lowerCase codeName}}",notes = "{{logicName}}")
{{/if}}
protected 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}}
{{#entity.nesteds}}
{{#columnName}}
/**
* 设置 [{{entityLogicName}}]
*/
public void set{{pascalCase codeName}}(List<{{entityCodeName}}> {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
this.modify("{{columnName}}", ({{camelCase codeName}}!=null)?{{camelCase codeName}}:(new ArrayList()));
}
{{/columnName}}
{{/entity.nesteds}}
{{#if entity.keyField.type.number}}
public Serializable getDefaultKey(boolean gen) {
return IdWorker.getId();
}
{{else}}
{{#entity.unionKeyMode}}
{{#unless entity.keyField.phisicalDEField}}
/**
* 设置 [{{logicName}}]
*/
public void set{{pascalCase entity.keyField.codeName}}({{entity.keyField.type.java}} {{camelCase entity.keyField.codeName}}) {
this.{{camelCase entity.keyField.codeName}} = {{camelCase entity.keyField.codeName}};
if(!ObjectUtils.isEmpty({{camelCase entity.keyField.codeName}})) {
String [] args={{camelCase entity.keyField.codeName}}.split("\\|\\|");
{{#each entity.unionKeyFields}}
this.set("{{camelCase codeName}}", args[{{@index}}]);
{{/each}}
}
}
public {{entity.keyField.type.java}} get{{pascalCase entity.keyField.codeName}}() {
if(ObjectUtils.isEmpty(this.{{camelCase entity.keyField.codeName}}))
this.{{camelCase entity.keyField.codeName}} = ({{entity.keyField.type.java}})getDefaultKey(true);
return this.{{camelCase entity.keyField.codeName}};
}
{{/unless}}
public Serializable getDefaultKey(boolean gen) {
{{#each entity.unionKeyFields}}
Assert.notNull(get{{pascalCase codeName}}(),"未设置{{logicName}}");
{{/each}}
String key = String.format("{{#each entity.unionKeyFields}}{{#unless @first}}||{{/unless}}%s{{/each}}"
{{#each entity.unionKeyFields}},{{#if timeType}}DataObject.datetimeFormat.format(get{{pascalCase codeName}}()){{else}}get{{pascalCase codeName}}(){{/if}}{{/each}});
{{#if entity.keyField.phisicalDEField}}
key = DigestUtils.md5DigestAsHex(key.getBytes());
{{/if}}
return key;
}
{{/entity.unionKeyMode}}
{{/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 net.ibizsys.central.plugin.boot.core.domain.BaseData;
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 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}}.filter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import net.ibizsys.central.util.ISearchContextDTO;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import net.ibizsys.central.plugin.boot.core.filter.BaseFilter;
import {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
/**
* 关系型数据实体[{{entity.codeName}}] 查询条件对象
*/
@Slf4j
@Getter
@Setter
@NoArgsConstructor
@ApiModel("{{entity.logicName}}")
public class {{entity.codeName}}SearchContext extends BaseFilter<{{entity.codeName}}> {
{{#each entity.fields as |field|}}
{{#each field.allPSDEFSearchModes as |formitem|}}
{{#unless formitem.valueFunc}}
{{#if (or (eq formitem.valueOP "IN") (eq formitem.valueOP "ISNULL") (eq formitem.valueOP "ISNOTNULL"))}}
@JsonProperty("{{lowerCase formitem.name}}")
@JSONField(name = "{{lowerCase formitem.name}}")
{{else}}
@JsonProperty("{{lowerCase formitem.name}}")
{{#timeType}}
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
{{/timeType}}
@JSONField(name = "{{lowerCase formitem.name}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
{{#eq type.java "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
{{/if}}
@ApiModelProperty(value = "{{lowerCase formitem.name}}",name = "{{lowerCase formitem.name}}",notes = "{{field.logicName}}{{formitem.valueOP}}")
private {{#if (or (eq formitem.valueOP "IN") (eq formitem.valueOP "ISNULL") (eq formitem.valueOP "ISNOTNULL"))}}String{{else}}{{field.type.java}}{{/if}} {{camelCase field.codeName}}{{formitem.valueOP}};
public void set{{pascalCase field.codeName}}{{formitem.valueOP}}({{#if (or (eq formitem.valueOP "IN") (eq formitem.valueOP "ISNULL") (eq formitem.valueOP "ISNOTNULL"))}}String{{else}}{{field.type.java}}{{/if}} {{camelCase field.codeName}}{{formitem.valueOP}}) {
this.{{camelCase field.codeName}}{{formitem.valueOP}} = {{camelCase field.codeName}}{{formitem.valueOP}};
if(!ObjectUtils.isEmpty(this.{{camelCase field.codeName}}{{formitem.valueOP}})){
{{#eq formitem.valueOP "LIKE"}}
this.like("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "LEFTLIKE"}}
this.ll("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "RIGHTLIKE"}}
this.rl("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "EQ"}}
this.eq("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "NOTEQ"}}
this.ne("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "GT"}}
this.gt("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "GTANDEQ"}}
this.gte("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "LT"}}
this.lt("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "LTANDEQ"}}
this.lte("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "ISNOTNULL"}}
if(this.{{camelCase field.codeName}}{{formitem.valueOP}}.equals("1")){
this.nn("{{lowerCase field.name}}");
}
{{/eq}}
{{#eq formitem.valueOP "ISNULL"}}
if(this.{{camelCase field.codeName}}{{formitem.valueOP}}.equals("1")){
this.nvl("{{lowerCase field.name}}");
}
{{/eq}}
{{#eq formitem.valueOP "IN"}}
this.in("{{lowerCase field.name}}",this.{{camelCase field.codeName}}{{formitem.valueOP}}.split(";|,|;|,"));
{{/eq}}
{{#eq formitem.valueOP "NOTIN"}}
this.ni("{{lowerCase field.name}}",this.{{camelCase field.codeName}}{{formitem.valueOP}}.split(";|,|;|,"));
{{/eq}}
}
}
{{/unless}}
{{/each}}
{{/each}}
}
\ No newline at end of file
package {{packageName}}.{{entity.module}}.mapper;
import java.util.List;
import org.apache.ibatis.annotations.*;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map;
import org.apache.ibatis.annotations.Select;
import {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.{{entity.module}}.filter.{{entity.codeName}}SearchContext;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.alibaba.fastjson.JSONObject;
{{#dsName}}
@DS("{{entity.dataSource}}")
{{/dsName}}
public interface {{entity.codeName}}Mapper extends BaseMapper<{{entity.codeName}}> {
{{#entity.dataSets}}
Page<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> search{{pascalCase codeName}}(IPage page, @Param("ctx") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
List<{{#if enableGroup}}Map{{else}}{{entity.codeName}}{{/if}}> list{{pascalCase codeName}}(@Param("ctx") {{entity.codeName}}SearchContext context, @Param("ew") Wrapper<{{entity.codeName}}> wrapper);
{{/entity.dataSets}}
@Override
{{#enableEntityCache}}
@Cacheable(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0")
{{/enableEntityCache}}
{{entity.codeName}} selectById(Serializable id);
{{#enableEntityCache}}
@Cacheable(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
{{/enableEntityCache}}
{{entity.codeName}} selectEntity({{entity.codeName}} entity);
List<{{entity.codeName}}> selectEntities(@Param("list") List<{{entity.codeName}}> list);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
{{/enableEntityCache}}
int insert({{entity.codeName}} entity);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}")
{{/enableEntityCache}}
int updateById(@Param(Constants.ENTITY) {{entity.codeName}} entity);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0.{{camelCase entity.keyField.codeName}}", condition ="#p0 != null")
{{/enableEntityCache}}
int update(@Param(Constants.ENTITY) {{entity.codeName}} entity, @Param("ew") Wrapper<{{entity.codeName}}> updateWrapper);
@Override
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", key = "'row:'+#p0")
{{/enableEntityCache}}
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
* @param sql
* @return
*/
@Update("${sql}")
boolean updateBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义插入SQL
* @param sql
* @return
*/
@Insert("${sql}")
boolean insertBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义删除SQL
* @param sql
* @return
*/
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}(@Param("{{camelCase fkField.codeName}}") Serializable {{camelCase fkField.codeName}});
{{/entity.references}}
}
\ 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 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 {{packageName}}.{{entity.module}}.domain.{{entity.codeName}};
import {{packageName}}.{{entity.module}}.filter.{{entity.codeName}}SearchContext;
{{#dsName}}
@DS("{{entity.dataSource}}")
{{/dsName}}
public interface I{{entity.codeName}}Service extends IBaseService<{{entity.codeName}}, {{entity.codeName}}SearchContext> {
@Override
default String getDataEntityId() {
return "PSMODULES/{{entity.module}}/PSDATAENTITIES/{{entity.codeName}}.json";
}
default I{{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 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 boolean create({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.create(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 remove({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.remove(key);
}
default boolean remove(List keys) throws Throwable {
return IBaseService.super.remove(keys);
}
default {{entity.codeName}} get({{entity.keyField.type.java}} key) throws Throwable {
return IBaseService.super.get(key);
}
default {{entity.codeName}} getDraft({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.getDraft(dto);
}
default Integer checkKey({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.checkKey(dto);
}
{{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}}
default boolean save({{entity.codeName}} dto) throws Throwable {
return IBaseService.super.save(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;
}
{{#if action}}
default {{entity.codeName}} {{camelCase codeName}}({{entity.keyField.type.java}} key) {
return {{camelCase codeName}}(new {{entity.codeName}}().set{{pascalCase entity.keyField.codeName}}(key));
}
{{/if}}
{{/each}}
{{#entity.dataSets}}
default Page<{{entity.codeName}}> fetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("{{name}}", null, new Object[]{dto}, true);
}
default List<{{entity.codeName}}> select{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (List)this.getRuntimeService().getDataEntityRuntime().selectDataQuery("{{name}}", dto);
}
{{/entity.dataSets}}
{{#entity.references}}
List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}});
{{/entity.references}}
}
\ No newline at end of file
package {{packageName}}.{{entity.module}}.service.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import java.math.BigInteger;
import lombok.extern.slf4j.Slf4j;
import net.ibizsys.central.plugin.boot.core.service.impl.BaseServiceImpl;
import net.ibizsys.central.plugin.boot.core.helper.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.Assert;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
{{#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;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import javax.annotation.Resource;
{{#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 BaseServiceImpl<{{entity.codeName}},{{entity.codeName}}SearchContext> implements I{{entity.codeName}}Service {
@Resource
private {{entity.codeName}}Mapper baseMapper;
public {{entity.codeName}}Mapper getBaseMapper(){
return baseMapper;
}
{{#entity.relEntities}}
{{#neq storage "NONE"}}
@Autowired
@Lazy
protected I{{codeName}}Service {{camelCase codeName}}Service;
{{/neq}}
{{/entity.relEntities}}
public List<{{entity.codeName}}> getByEntities(List<{{entity.codeName}}> entities) {
return this.baseMapper.selectEntities(entities);
}
{{#entity.hasReferences}}
public void fillParentData({{entity.codeName}} et) {
{{#each entity.references as |reference|}}
{{#gt reference.relFieldCount 1}}
if(!ObjectUtils.isEmpty(et.get{{pascalCase reference.fkField.codeName}}())) {
{{reference.entityCodeName}} {{camelCase reference.entityCodeName}} = et.get{{pascalCase reference.codeName}}();
if(!ObjectUtils.isEmpty({{camelCase reference.entityCodeName}})) {
{{#each reference.fields as |field|}}
{{#neq field.dataType 'PICKUP'}}
et.set{{pascalCase field.codeName}}({{camelCase reference.entityCodeName}}.get{{pascalCase field.refFieldCodeName}}());
{{/neq}}
{{/each}}
}
}
{{/gt}}
{{/each}}
}
{{/entity.hasReferences}}
{{#entity.references}}
public List<{{entity.codeName}}> selectBy{{pascalCase fkField.codeName}}({{fkField.type.java}} {{camelCase fkField.codeName}}) {
return baseMapper.selectBy{{pascalCase fkField.codeName}}({{camelCase fkField.codeName}});
}
{{/entity.references}}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<property name="LOG_PATH" value="logs" />
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] %-40.40logger{39} : %msg%n" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="LOG_PATTERN2" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([${LOG_LEVEL_PATTERN:-%5p}]) %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}" />
<!-- 控制台输出 -->
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}}</pattern>
</encoder>
</appender>
<!--<appender name="LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">-->
<!-- <destination>127.0.0.1:9601</destination>-->
<!-- <encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">-->
<!-- <customFields>{"appname":"{{projectName}}"}</customFields>-->
<!-- </encoder>-->
<!--</appender>-->
<!-- 按照每天生成日志文件 -->
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_PATH}/{{projectName}}.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件最大的大小-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
<appender-ref ref="file" />
<!--<appender-ref ref="LOGSTASH" />-->
</root>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="{{packageName}}.{{entity.module}}.mapper.{{entity.codeName}}Mapper">
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="{{entity.codeName}}ResultMap" type="{{packageName}}.{{entity.module}}.domain.{{entity.codeName}}" autoMapping="true">
{{#entity.keyField.phisicalDEField}}
<id property="{{camelCase entity.keyField.codeName}}" column="{{entity.keyField.columnName}}" /><!--主键字段映射-->
{{/entity.keyField.phisicalDEField}}
{{#each entity.fields}}
{{#alias}}
{{#unless deepStructure}}
{{#unless keyDEField}}
<result property="{{alias}}" column="{{columnName}}" />
{{/unless}}
{{/unless}}
{{/alias}}
{{/each}}
{{#each entity.nesteds}}
{{#columnName}}
<result property="{{camelCase codeName}}" column="{{columnName}}" typeHandler="{{packageName}}.{{module}}.domain.handlers.{{entityCodeName}}TypeHandler" />
{{/columnName}}
{{/each}}
{{#each entity.references}}
<association property="{{camelCase codeName}}" javaType="{{packageName}}.{{module}}.domain.{{entityCodeName}}" column="{{fkField.columnName}}" select="{{packageName}}.{{module}}.mapper.{{entityCodeName}}Mapper.selectById" fetchType="lazy"></association>
{{/each}}
</resultMap>
<select id="selectById" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.viewDataQuery}}
{{#if entity.keyField.phisicalDEField}}
<include refid="view" />
{{#if entity.viewDataQuery.where}}
and
{{else}}
where
{{/if}}
{{else}}
select t1.* from ( <include refid="view" /> ) t1
where
{{/if}}
{{else}}
select t1.* from {{entity.viewName}} t1
where
{{#if entity.logicValid}}
{{#if entity.logicValidField.type.number}}
{{entity.logicValidField.columnName}} = {{entity.validLogicValue}}
{{else}}
{{entity.logicValidField.columnName}} = '{{entity.validLogicValue}}'
{{/if}}
and
{{/if}}
{{/if}}
t1.{{entity.keyField.columnName}}=#{id}
</select>
<select id="selectEntity" parameterType="{{packageName}}.{{entity.module}}.domain.{{entity.codeName}}" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.viewDataQuery}}
<include refid="view" />
{{#if entity.viewDataQuery.where}}
and
{{else}}
where
{{/if}}
{{else}}
select t1.* from {{entity.viewName}} t1
where
{{#if entity.logicValid}}
{{#if entity.logicValidField.type.number}}
{{entity.logicValidField.columnName}} = {{entity.validLogicValue}}
{{else}}
{{entity.logicValidField.columnName}} = '{{entity.validLogicValue}}'
{{/if}}
and
{{/if}}
{{/if}}
({{#each entity.keyFields as |field|}}{{#unless @first}} and {{/unless}}{{field.columnName}} = #{ {{camelCase field.codeName}} }{{/each}})
</select>
<select id="selectEntities" parameterType="java.util.List" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.viewDataQuery}}
<include refid="view" />
{{#if entity.viewDataQuery.where}}
and
{{else}}
where
{{/if}}
{{else}}
select t1.* from {{entity.viewName}} t1
where
{{#if entity.logicValid}}
{{#if entity.logicValidField.type.number}}
{{entity.logicValidField.columnName}} = {{entity.validLogicValue}}
{{else}}
{{entity.logicValidField.columnName}} = '{{entity.validLogicValue}}'
{{/if}}
and
{{/if}}
{{/if}}
({{#each entity.keyFields as |field|}}{{#unless @first}},{{/unless}}{{field.columnName}}{{/each}})
in (<foreach collection="list" item="item" index="index" separator=","> ({{#each entity.keyFields as |field|}}{{#unless @first}},{{/unless}}#{ item.{{camelCase field.codeName}} }{{/each}}) </foreach>)
</select>
{{#each entity.dataQueries}}
<sql id="{{camelCase codeName}}" databaseId="{{dsType}}">
<![CDATA[
{{dsCode}}
]]>
</sql>
{{/each}}
{{#each entity.dataSets}}
<select id="search{{pascalCase codeName}}" parameterType="{{packageName}}.{{entity.module}}.filter.{{entity.codeName}}SearchContext" {{#if enableGroup}}resultType="java.util.HashMap"{{else}}resultMap="{{entity.codeName}}ResultMap"{{/if}}>
{{select}}
from (
{{#each queries}}
<include refid="{{camelCase this}}"/>
{{#unless @last}}
union all
{{/unless}}
{{/each}}
) t1
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
{{groupBy}}
{{orderBy}}
</select>
{{/each}}
{{#each entity.references as | reference |}}
<select id="selectBy{{pascalCase reference.fkField.codeName}}" resultMap="{{entity.codeName}}ResultMap">
{{#if entity.defaultDataQuery}}
<include refid="{{camelCase entity.defaultDataQuery.codeName}}" />
{{#if entity.defaultDataQuery.where}}
and
{{else}}
where
{{/if}}
{{else}}
select t1.* from {{#if entity.viewName}}{{entity.viewName}}{{else}}{{entity.tableName}}{{/if}} t1 where
{{/if}}
{{reference.fkField.columnName}} = #{ {{camelCase reference.fkField.codeName}} }
</select>
{{/each}}
</mapper>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册