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

接口实体

上级 6177f2ec
......@@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.util.ObjectUtils;
import java.nio.file.OpenOption;
import java.nio.file.Path;
......@@ -39,14 +40,14 @@ public class FileDto
@JsonIgnore
@JSONField(serialize = false)
public File getFile(String rootPath, boolean override) {
if(id==null&&content==null)
if(ObjectUtils.isEmpty(id)&& ObjectUtils.isEmpty(content))
return null;
if(id==null)
if(ObjectUtils.isEmpty(id))
id= UUID.randomUUID().toString();
if(name==null)
if(ObjectUtils.isEmpty(name))
name=id;
Path path= Paths.get(rootPath,id,name);
if(override&&content!=null)
if(override && !ObjectUtils.isEmpty(content))
{
File dir=path.getParent().toFile();
if(!dir.exists())
......
{{#eq apps "link"}}
package {{packageName}}.api.{{apps}}.domain;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.math.BigInteger;
import java.util.Map;
import java.util.HashMap;
import java.io.Serializable;
import java.math.BigDecimal;
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.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.*;
import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import cn.ibizlab.util.domain.*;
import org.springframework.data.annotation.Id;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import {{packageName}}.api.{{apps}}.dict.*;
/**
* {{appEntity.entity.logicName}}
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@TableName(value = "{{appEntity.entity.tableName}}")
@ApiModel(value = "{{appEntity.entity.logicName}}")
public class {{pascalCase appEntity.codeName}} {
{{#each appEntity.entity.fields}}
{{#if phisicalDEField}}
/**
* {{logicName}}
*/
{{#if keyDEField}}
@Id
@TableId(value = "{{columnName}}"{{#type.number}} , type = IdType.ASSIGN_ID{{/type.number}}{{#type.string}} , type = IdType.ASSIGN_UUID{{/type.string}})
{{else}}
@TableField(value = "{{columnName}}"{{#insertOnly}} , fill = FieldFill.INSERT{{/insertOnly}})
{{#logicValidField}}
@TableLogic{{#appEntity.entity.validLogicValue}}(value = "{{appEntity.entity.validLogicValue}}"{{#appEntity.entity.invalidLogicValue}} , delval = "{{appEntity.entity.invalidLogicValue}}"{{/appEntity.entity.invalidLogicValue}}){{/appEntity.entity.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 = "{{logicName}}")
private {{type.java}} {{camelCase codeName}};
{{#neq columnName jsonName}}
//columnName!=jsonName
{{/neq}}
{{/if}}
{{/each}}
}
{{/eq}}
\ No newline at end of file
......@@ -120,7 +120,7 @@ public class {{entity.codeName}}ServiceBase extends ServiceImpl<{{entity.codeNam
}
public Integer checkKey({{entity.codeName}} et) {
return this.count(Wrappers.lambdaQuery(et))>0?1:0;
return this.count(Wrappers.<{{entity.codeName}}>query(){{#each entity.keyFields as |field|}}.eq("{{lowerCase field.name}}", et.get{{pascalCase field.codeName}}()){{/each}})>0?1:0;
}
@Override
......
......@@ -125,7 +125,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
}
public boolean checkKey({{entity.codeName}} et) {
return this.count(Wrappers.lambdaQuery(et))>0;
return this.count(Wrappers.<{{entity.codeName}}>query(){{#each entity.keyFields as |field|}}.eq("{{lowerCase field.name}}", et.get{{pascalCase field.codeName}}()){{/each}})>0;
}
@Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册