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

null tableName

上级 aaecb088
...@@ -6,6 +6,11 @@ import lombok.Setter; ...@@ -6,6 +6,11 @@ import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import net.ibizsys.model.dataentity.service.IPSDEServiceAPI; import net.ibizsys.model.dataentity.service.IPSDEServiceAPI;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
...@@ -33,4 +38,18 @@ public class ApiEntityModel extends BaseModel{ ...@@ -33,4 +38,18 @@ public class ApiEntityModel extends BaseModel{
return api.getSystem().getEntity(getApiDataEntity().getPSDataEntity().getCodeName()); return api.getSystem().getEntity(getApiDataEntity().getPSDataEntity().getCodeName());
} }
private List<FieldModel> properties;
public List<FieldModel> getProperties()
{
if(properties==null)
{
properties=new ArrayList<>();
getEntity().getFields().forEach(field->{
properties.add(field);
});
}
return properties;
}
} }
...@@ -12,7 +12,7 @@ public class BaseModel implements IModel { ...@@ -12,7 +12,7 @@ public class BaseModel implements IModel {
public String getId() { public String getId() {
if(StringUtils.isEmpty(id)&&(!StringUtils.isEmpty(getCodeName()))) if(StringUtils.isEmpty(id)&&(!StringUtils.isEmpty(getCodeName())))
id=this.getCodeName().toString(); id=this.getCodeName();
return id; return id;
} }
...@@ -22,8 +22,8 @@ public class BaseModel implements IModel { ...@@ -22,8 +22,8 @@ public class BaseModel implements IModel {
return (T)this; return (T)this;
} }
public LabelExt getCodeName() { public String getCodeName() {
return new LabelExt(codeName); return codeName;
} }
...@@ -34,8 +34,8 @@ public class BaseModel implements IModel { ...@@ -34,8 +34,8 @@ public class BaseModel implements IModel {
return (T)this; return (T)this;
} }
public LabelExt getName() { public String getName() {
return new LabelExt(name); return name;
} }
public <T> T setName(String name) { public <T> T setName(String name) {
......
package cn.ibizlab.codegen.model; package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.DataObject; import cn.ibizlab.codegen.utils.DataObject;
import cn.ibizlab.codegen.utils.StringAdvUtils;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
...@@ -318,6 +319,10 @@ public class EntityModel extends BaseModel { ...@@ -318,6 +319,10 @@ public class EntityModel extends BaseModel {
return getUnionKeyFields(); return getUnionKeyFields();
} }
public List<FieldModel> getQuickSearchFields() {
return fields.stream().filter(s->s.getDataEntityField().isEnableQuickSearch()).collect(Collectors.toList());
}
private Map<String, ActionModel> actions; private Map<String, ActionModel> actions;
...@@ -325,7 +330,7 @@ public class EntityModel extends BaseModel { ...@@ -325,7 +330,7 @@ public class EntityModel extends BaseModel {
{ {
if(actions==null) if(actions==null)
actions=new LinkedHashMap<>(); actions=new LinkedHashMap<>();
actions.put(action.getCodeName().toCamelCase(),action); actions.put(StringAdvUtils.camelcase(action.getCodeName()),action);
return this; return this;
} }
...@@ -553,7 +558,7 @@ public class EntityModel extends BaseModel { ...@@ -553,7 +558,7 @@ public class EntityModel extends BaseModel {
else if("dameng".equals(dbType)||"dm".equals(dbType)) else if("dameng".equals(dbType)||"dm".equals(dbType))
system.setEnableDameng(true); system.setEnableDameng(true);
dsTypes.add(dbType); dsTypes.add(dbType);
if(!this.getTableName().equalsIgnoreCase(item.getTableName())) if(this.getTableName()!=null && (!this.getTableName().equalsIgnoreCase(item.getTableName())))
this.set("table-"+item.getDBType().toLowerCase().replace("mysql5","mysql"),item.getTableName()); this.set("table-"+item.getDBType().toLowerCase().replace("mysql5","mysql"),item.getTableName());
}); });
} }
......
...@@ -46,7 +46,7 @@ public class FieldModel extends BaseModel { ...@@ -46,7 +46,7 @@ public class FieldModel extends BaseModel {
} }
public String getAlias() { public String getAlias() {
String alias=this.getCodeName().toCamelCase(); String alias=StringAdvUtils.camelcase(this.getCodeName());
return getColumnName().equalsIgnoreCase(alias)&&(!"PICKUP".equals(getDataEntityField().getDataType()))?null:alias; return getColumnName().equalsIgnoreCase(alias)&&(!"PICKUP".equals(getDataEntityField().getDataType()))?null:alias;
} }
......
...@@ -5,6 +5,7 @@ import cn.ibizlab.codegen.CodegenConfig; ...@@ -5,6 +5,7 @@ import cn.ibizlab.codegen.CodegenConfig;
import cn.ibizlab.codegen.CodegenConstants; import cn.ibizlab.codegen.CodegenConstants;
import cn.ibizlab.codegen.templating.TemplateFileType; import cn.ibizlab.codegen.templating.TemplateFileType;
import cn.ibizlab.codegen.utils.StringAdvUtils;
import net.ibizsys.model.IPSSystem; import net.ibizsys.model.IPSSystem;
import net.ibizsys.model.PSModelServiceImpl; import net.ibizsys.model.PSModelServiceImpl;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -130,7 +131,7 @@ public class ModelStorage { ...@@ -130,7 +131,7 @@ public class ModelStorage {
{ {
getSystemModel().getApps().forEach(app->{ getSystemModel().getApps().forEach(app->{
app.getAppEntities().forEach(item->{ app.getAppEntities().forEach(item->{
CliOption opt=newCliOption(TemplateFileType.appEntity).baseData(item,item.getCodeName().toSpinalCase()).set("apps",app.getCodeName().toLowerCase()); CliOption opt=newCliOption(TemplateFileType.appEntity).baseData(item, StringAdvUtils.spinalcase(item.getCodeName())).set("apps",app.getCodeName().toLowerCase());
rt.addOption(opt); rt.addOption(opt);
}); });
}); });
...@@ -155,7 +156,7 @@ public class ModelStorage { ...@@ -155,7 +156,7 @@ public class ModelStorage {
{ {
getSystemModel().getApps().forEach(app->{ getSystemModel().getApps().forEach(app->{
app.getPages().forEach(item->{ app.getPages().forEach(item->{
CliOption opt=newCliOption(TemplateFileType.page).setCliSubType(item.getAppView().getViewType()).baseData(item,item.getCodeName().toSpinalCase()).set("apps",app.getCodeName().toLowerCase()).set("appModules",item.getAppModule().toSpinalCase()); CliOption opt=newCliOption(TemplateFileType.page).setCliSubType(item.getAppView().getViewType()).baseData(item,StringAdvUtils.spinalcase(item.getCodeName())).set("apps",app.getCodeName().toLowerCase()).set("appModules",item.getAppModule().toSpinalCase());
rt.addOption(opt); rt.addOption(opt);
}); });
...@@ -165,7 +166,7 @@ public class ModelStorage { ...@@ -165,7 +166,7 @@ public class ModelStorage {
{ {
getSystemModel().getApps().forEach(app->{ getSystemModel().getApps().forEach(app->{
app.getCtrls().forEach(item->{ app.getCtrls().forEach(item->{
CliOption opt=newCliOption(TemplateFileType.ctrl).setCliSubType(item.getControl().getControlType()).baseData(item,item.getCodeName().toSpinalCase()).set("apps",app.getCodeName().toLowerCase()).set("appEntities",item.getFolder().toSpinalCase()); CliOption opt=newCliOption(TemplateFileType.ctrl).setCliSubType(item.getControl().getControlType()).baseData(item,StringAdvUtils.spinalcase(item.getCodeName())).set("apps",app.getCodeName().toLowerCase()).set("appEntities",item.getFolder().toSpinalCase());
rt.addOption(opt); rt.addOption(opt);
}); });
}); });
......
...@@ -187,9 +187,10 @@ public class POSchema { ...@@ -187,9 +187,10 @@ public class POSchema {
keyMap=new LinkedHashMap<>(); keyMap=new LinkedHashMap<>();
searchMap=new LinkedHashMap<>(); searchMap=new LinkedHashMap<>();
quickSearch=new LinkedHashMap<>(); quickSearch=new LinkedHashMap<>();
columns.forEach(column -> { if(columns!=null)
refreshColumn(column); columns.forEach(column -> {
}); refreshColumn(column);
});
if(logicValid&&logicValidColumn==null) if(logicValid&&logicValidColumn==null)
logicValid=false; logicValid=false;
} }
......
package cn.ibizlab.codegen.model; package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.StringAdvUtils;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -64,7 +65,7 @@ public class RelationshipModel extends BaseModel{ ...@@ -64,7 +65,7 @@ public class RelationshipModel extends BaseModel{
public String getListCode() public String getListCode()
{ {
if(this.getDer().getMinorPSDataEntity().getStorageMode()==0) if(this.getDer().getMinorPSDataEntity().getStorageMode()==0)
return getCodeName().toPluralize().toLowerCase(); return StringAdvUtils.pluralize(getCodeName());
return null; return null;
} }
......
...@@ -126,6 +126,10 @@ public class StringAdvUtils { ...@@ -126,6 +126,10 @@ public class StringAdvUtils {
return underscore(word); return underscore(word);
} }
public static String pluralize(String word) {
return Inflector.getInstance().pluralize(camelcase(word).toLowerCase());
}
private static Pattern camelizeSlashPattern = Pattern.compile("\\/(.?)"); private static Pattern camelizeSlashPattern = Pattern.compile("\\/(.?)");
private static Pattern camelizeUppercasePattern = Pattern.compile("(\\.?)(\\w)([^\\.]*)$"); private static Pattern camelizeUppercasePattern = Pattern.compile("(\\.?)(\\w)([^\\.]*)$");
private static Pattern camelizeUnderscorePattern = Pattern.compile("(_)(.)"); private static Pattern camelizeUnderscorePattern = Pattern.compile("(_)(.)");
......
...@@ -25,7 +25,7 @@ import java.util.List; ...@@ -25,7 +25,7 @@ import java.util.List;
@Configuration @Configuration
@EnableFeignClients(basePackages = {"{{packageName}}" }) @EnableFeignClients(basePackages = {"{{packageName}}" })
@EnableZuulProxy @EnableZuulProxy
@ComponentScan(basePackages = {"{{packageName}}.{{apps}}","{{packageName}}.util"}) @ComponentScan(basePackages = {"{{packageName}}.{{apps}}","cn.ibizlab.util"})
@MapperScan("{{packageName}}.*.mapper") @MapperScan("{{packageName}}.*.mapper")
@SpringBootApplication(exclude = { @SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class, org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
......
package {{packageName}}.core.util.aspect; package {{packageName}}.core.util.aspect;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import {{packageName}}.util.annotation.Audit; import cn.ibizlab.util.annotation.Audit;
import {{packageName}}.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import {{packageName}}.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import {{packageName}}.util.service.IBZDataAuditService; import cn.ibizlab.util.service.IBZDataAuditService;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
......
package {{packageName}}.core.util.aspect; package {{packageName}}.core.util.aspect;
import {{packageName}}.util.annotation.DEField; import cn.ibizlab.util.annotation.DEField;
import {{packageName}}.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import {{packageName}}.util.enums.DEFieldDefaultValueType; import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import {{packageName}}.util.enums.DEPredefinedFieldType; import cn.ibizlab.util.enums.DEPredefinedFieldType;
import {{packageName}}.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import {{packageName}}.util.security.AuthenticationUser; import cn.ibizlab.util.security.AuthenticationUser;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
......
package {{packageName}}.core.util.aspect; package {{packageName}}.core.util.aspect;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import {{packageName}}.util.domain.DELogic; import cn.ibizlab.util.domain.DELogic;
import {{packageName}}.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import {{packageName}}.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import {{packageName}}.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
......
package {{packageName}}.core.util.aspect; package {{packageName}}.core.util.aspect;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import {{packageName}}.util.annotation.DEField; import cn.ibizlab.util.annotation.DEField;
import {{packageName}}.util.enums.DupCheck; import cn.ibizlab.util.enums.DupCheck;
import {{packageName}}.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import {{packageName}}.util.filter.QueryFilter; import cn.ibizlab.util.filter.QueryFilter;
import {{packageName}}.util.filter.SearchContextBase; import cn.ibizlab.util.filter.SearchContextBase;
import {{packageName}}.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package {{packageName}}.core.util.aspect; package {{packageName}}.core.util.aspect;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import {{packageName}}.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
......
...@@ -2,7 +2,7 @@ package {{packageName}}.core.util.aspect; ...@@ -2,7 +2,7 @@ package {{packageName}}.core.util.aspect;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import {{packageName}}.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import org.apache.rocketmq.client.producer.DefaultMQProducer; import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message; import org.apache.rocketmq.common.message.Message;
......
package {{packageName}}.core.util.aspect; package {{packageName}}.core.util.aspect;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import {{packageName}}.util.annotation.VersionCheck; import cn.ibizlab.util.annotation.VersionCheck;
import {{packageName}}.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import {{packageName}}.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import {{packageName}}.util.helper.RuleUtils; import cn.ibizlab.util.helper.RuleUtils;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
......
...@@ -51,7 +51,7 @@ public class RocketMQListenerProcessor implements MessageListenerOrderly { ...@@ -51,7 +51,7 @@ public class RocketMQListenerProcessor implements MessageListenerOrderly {
{{#if dataSync.inPSSysDataSyncAgent}} {{#if dataSync.inPSSysDataSyncAgent}}
{{#if dataSync.inTestPSDEAction}} {{#if dataSync.inTestPSDEAction}}
{{#unless @first}}else {{/unless}}if ("{{lowerCase dataSync.codeName}}".equalsIgnoreCase(tags)) { {{#unless @first}}else {{/unless}}if ("{{lowerCase dataSync.codeName}}".equalsIgnoreCase(tags)) {
{{packageName}}.core.{{entity.module}}.domain.{{entity.codeName}} domain = EntityBase.fromJSONString(body,{{packageName}}.core.{{entity.module}}.domain.{{entity.codeName}}.class); {{packageName}}.core.{{entity.module}}.domain.{{entity.codeName}} domain = JSON.parseObject(body,{{packageName}}.core.{{entity.module}}.domain.{{entity.codeName}}.class);
{{camelCase entity.codeName}}Service.{{camelCase dataSync.inTestPSDEAction.codeName}}(domain); {{camelCase entity.codeName}}Service.{{camelCase dataSync.inTestPSDEAction.codeName}}(domain);
} }
{{else}} {{else}}
......
package {{packageName}}.core.util.job; package {{packageName}}.core.util.job;
import {{packageName}}.util.client.IBZUAAFeignClient; import cn.ibizlab.util.client.IBZUAAFeignClient;
import {{packageName}}.util.client.IBZLiteFeignClient; import cn.ibizlab.util.client.IBZLiteFeignClient;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -43,19 +43,19 @@ public class PermissionSyncJob implements ApplicationRunner { ...@@ -43,19 +43,19 @@ public class PermissionSyncJob implements ApplicationRunner {
{{#if system.enableWorkflow}} {{#if system.enableWorkflow}}
@Autowired @Autowired
@Lazy @Lazy
private {{packageName}}.util.client.IBZWFFeignClient wfClient; private cn.ibizlab.util.client.IBZWFFeignClient wfClient;
{{/if}} {{/if}}
{{#if system.hasMsgTemplate}} {{#if system.hasMsgTemplate}}
@Autowired @Autowired
@Lazy @Lazy
private {{packageName}}.util.client.IBZNotifyFeignClient notifyClient; private cn.ibizlab.util.client.IBZNotifyFeignClient notifyClient;
{{/if}} {{/if}}
{{#if system.hasRuntimeDict}} {{#if system.hasRuntimeDict}}
@Autowired @Autowired
@Lazy @Lazy
{{packageName}}.util.client.IBZDictFeignClient dictClient; cn.ibizlab.util.client.IBZDictFeignClient dictClient;
{{/if}} {{/if}}
......
...@@ -12,6 +12,8 @@ import com.alibaba.fastjson.annotation.JSONField; ...@@ -12,6 +12,8 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat; 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.ObjectUtils;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
...@@ -53,6 +55,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable ...@@ -53,6 +55,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8") @JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
{{/timeType}} {{/timeType}}
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}) @JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
{{#eq type.java "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@ApiModelProperty("{{logicName}}") @ApiModelProperty("{{logicName}}")
private {{type.java}} {{camelCase codeName}}; private {{type.java}} {{camelCase codeName}};
......
...@@ -12,6 +12,7 @@ import com.alibaba.fastjson.annotation.JSONField; ...@@ -12,6 +12,7 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
import org.springframework.util.Assert; import org.springframework.util.Assert;
...@@ -69,6 +70,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable ...@@ -69,6 +70,9 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8") @JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
{{/timeType}} {{/timeType}}
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}) @JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
{{#eq type.java "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@ApiModelProperty("{{logicName}}") @ApiModelProperty("{{logicName}}")
private {{type.java}} {{camelCase codeName}}; private {{type.java}} {{camelCase codeName}};
......
...@@ -8,7 +8,11 @@ import java.util.List; ...@@ -8,7 +8,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*; import lombok.*;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
...@@ -20,10 +24,144 @@ import org.elasticsearch.index.query.QueryBuilders; ...@@ -20,10 +24,144 @@ import org.elasticsearch.index.query.QueryBuilders;
{{/entity.enableES}} {{/entity.enableES}}
import cn.ibizlab.util.filter.QueryWrapperContext; import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import {{packageName}}.core.{{module}}.filte.{{entity.codeName}}; import {{packageName}}.core.{{module}}.domain.{{entity.codeName}};
/** /**
* 关系型数据实体[{{entity.codeName}}] 查询条件对象 * 关系型数据实体[{{entity.codeName}}] 查询条件对象
*/ */
@Slf4j @Slf4j
@Data @Getter
public class {{entity.codeName}}SearchContext extends QueryWrapperContext<{{entity.codeName}}> { @Setter
\ No newline at end of file @NoArgsConstructor
@Accessors(chain = true)
@ApiModel("{{entity.logicName}}")
public class {{entity.codeName}}SearchContext extends QueryWrapperContext<{{entity.codeName}}> {
{{#each entity.fields as |field|}}
{{#each field.allPSDEFSearchModes as |formitem|}}
{{#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("{{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 {{entity.codeName}}SearchContext 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.getSearchCond().like("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "LEFTLIKE"}}
this.getSearchCond().likeRight("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "RIGHTLIKE"}}
this.getSearchCond().likeLeft("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "EQ"}}
this.getSearchCond().eq("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "NOTEQ"}}
this.getSearchCond().ne("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "GT"}}
this.getSearchCond().gt("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "GTANDEQ"}}
this.getSearchCond().ge("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "LT"}}
this.getSearchCond().lt("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "LTANDEQ"}}
this.getSearchCond().le("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}});
{{/eq}}
{{#eq formitem.valueOP "ISNOTNULL"}}
if(this.{{camelCase field.codeName}}{{formitem.valueOP}}.equals("1")){
this.getSearchCond().isNotNull("{{lowerCase field.name}}");
}
{{/eq}}
{{#eq formitem.valueOP "ISNULL"}}
if(this.{{camelCase field.codeName}}{{formitem.valueOP}}.equals("1")){
this.getSearchCond().isNull("{{lowerCase field.name}}");
}
{{/eq}}
{{#eq formitem.valueOP "IN"}}
this.getSearchCond().in("{{lowerCase field.name}}",this.{{camelCase field.codeName}}{{formitem.valueOP}}.split(";|,|;|,"));
{{/eq}}
{{#eq formitem.valueOP "NOTIN"}}
this.getSearchCond().notIn("{{lowerCase field.name}}",this.{{camelCase field.codeName}}{{formitem.valueOP}}.split(";|,|;|,"));
{{/eq}}
{{#if entity.enableES}}
{{#eq formitem.valueOP "LIKE"}}
this.getEsCond().must(QueryBuilders.wildcardQuery("{{lowerCase field.name}}", String.format("*%s*",{{camelCase field.codeName}}{{formitem.valueOP}})));
{{/eq}}
{{#eq formitem.valueOP "LEFTLIKE"}}
this.getEsCond().must(QueryBuilders.wildcardQuery("{{lowerCase field.name}}", String.format("%s*",{{camelCase field.codeName}}{{formitem.valueOP}})));
{{/eq}}
{{#eq formitem.valueOP "RIGHTLIKE"}}
this.getEsCond().must(QueryBuilders.wildcardQuery("{{lowerCase field.name}}", String.format("*%s",{{camelCase field.codeName}}{{formitem.valueOP}})));
{{/eq}}
{{#eq formitem.valueOP "EQ"}}
this.getEsCond().must(QueryBuilders.termQuery("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}}));
{{/eq}}
{{#eq formitem.valueOP "NOTEQ"}}
this.getEsCond().mustNot(QueryBuilders.termQuery("{{lowerCase field.name}}", {{camelCase field.codeName}}{{formitem.valueOP}}));
{{/eq}}
{{#eq formitem.valueOP "GT"}}
this.getEsCond().must(QueryBuilders.rangeQuery("{{lowerCase field.name}}").gt({{camelCase field.codeName}}{{formitem.valueOP}}));
{{/eq}}
{{#eq formitem.valueOP "GTANDEQ"}}
this.getEsCond().must(QueryBuilders.rangeQuery("{{lowerCase field.name}}").gte({{camelCase field.codeName}}{{formitem.valueOP}}));
{{/eq}}
{{#eq formitem.valueOP "LT"}}
this.getEsCond().must(QueryBuilders.rangeQuery("{{lowerCase field.name}}").lt({{camelCase field.codeName}}{{formitem.valueOP}}));
{{/eq}}
{{#eq formitem.valueOP "LTANDEQ"}}
this.getEsCond().must(QueryBuilders.rangeQuery("{{lowerCase field.name}}").lte({{camelCase field.codeName}}{{formitem.valueOP}}));
{{/eq}}
{{#eq formitem.valueOP "ISNOTNULL"}}
if(this.{{camelCase field.codeName}}{{formitem.valueOP}}.equals("1")){
this.getEsCond().mustNot(QueryBuilders.existsQuery("{{lowerCase field.name}}"));
}
{{/eq}}
{{#eq formitem.valueOP "ISNULL"}}
if(this.{{camelCase field.codeName}}{{formitem.valueOP}}.equals("1")){
this.getEsCond().must(QueryBuilders.existsQuery("{{lowerCase field.name}}"));
}
{{/eq}}
{{/if}}
}
return this;
}
{{/each}}
{{/each}}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
{{#each entity.quickSearchFields as |field|}}
{{#if @first}}
this.getSearchCond().and( wrapper ->
wrapper.like("{{lowerCase field.name}}", query)
{{else}}
.or.like("{{lowerCase field.name}}", query)
{{/if}}
{{#if @last}}
);
{{/if}}
{{/each}}
}
}
}
\ No newline at end of file
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
<#comment>索引从实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#comment>判断当前实体是否为索引子实体或继承子实体</#comment>
<#assign isIndexSubDE=false>
<#if de.getMinorPSDERs()??>
<#list de.getMinorPSDERs() as MinorPSDER>
<#if MinorPSDER.getDERType()?? && MinorPSDER.getMajorPSDataEntity()??>
<#comment>继承关系、索引关系 (包含分组属性)</#comment>
<#if MinorPSDER.getDERType()=="DERINHERIT" || (MinorPSDER.getDERType()=="DERINDEX" ) && MinorPSDER.getMajorPSDataEntity().getIndexTypePSDEField()??>
<#assign isIndexSubDE=true>
<#assign indexPSDER=MinorPSDER>
<#break>
</#if>
</#if>
</#list>
</#if>
<#if isIndexSubDE && indexPSDER??>
<#comment>索引主实体</#comment>
<#assign majorIndexDE=indexPSDER.getMajorPSDataEntity()>
<#assign majorIndexDECodeName=indexPSDER.getMajorPSDataEntity().codeName>
<#assign majorIndexDECodeNameCamel = srfr7templcaseformat(majorIndexDECodeName)?cap_first>
<#assign majorIndexDEKeyFieldCodeName=srfr7templcaseformat(majorIndexDE.getKeyPSDEField().codeName)>
<#assign majorIndexDEMajorTextFieldCodeName=srfr7templcaseformat(majorIndexDE.getMajorPSDEField().codeName)>
<#assign MinorIndexDECodeName=de.codeName>
<#assign MinorIndexDECodeNameCamel = srfr7templcaseformat(MinorIndexDECodeName)?cap_first>
<#assign MinorIndexDEKeyFieldCodeName=srfr7templcaseformat(de.getKeyPSDEField().codeName)>
<#assign MinorIndexDEMajorTextFieldCodeName=srfr7templcaseformat(de.getMajorPSDEField().codeName)>
package ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().codeName?lower_case}.mapping;
import org.mapstruct.*;
import ${pub.getPKGCodeName()}.core.${de.getPSSystemModule().getCodeName()?lower_case}.domain.${de.codeName};
import ${pub.getPKGCodeName()}.core.${majorIndexDE.getPSSystemModule().getCodeName()?lower_case}.domain.${majorIndexDE.codeName};
import java.util.List;
@Mapper(componentModel = "spring", uses = {})
public interface ${de.codeName}InheritMapping {
@Mappings({
@Mapping(source ="${MinorIndexDEKeyFieldCodeName}",target = "${majorIndexDEKeyFieldCodeName}"),
@Mapping(source ="${MinorIndexDEMajorTextFieldCodeName}",target = "${majorIndexDEMajorTextFieldCodeName}"),
@Mapping(target ="focusNull",ignore = true),
<#if indexPSDER.getPSDERIndexDEFieldMaps?? && indexPSDER.getPSDERIndexDEFieldMaps()??>
<#list indexPSDER.getPSDERIndexDEFieldMaps() as indexFieldmapping>
<#comment>排除主键及主文本属性</#comment>
<#if indexFieldmapping.getMajorPSDEField()?? && indexFieldmapping.getMinorPSDEField()??>
<#assign majorDEField=indexFieldmapping.getMajorPSDEField()>
<#assign MinorDEField=indexFieldmapping.getMinorPSDEField()>
<#if majorDEField.isKeyDEField()==false && MinorDEField.isKeyDEField()==false && majorDEField.isMajorDEField()==false && MinorDEField.isMajorDEField()==false>
<#if !P.exists(MinorDEField.codeName,majorDEField.codeName)>
@Mapping(source ="${srfr7templcaseformat(MinorDEField.codeName)}",target = "${srfr7templcaseformat(majorDEField.codeName)}"),
</#if>
</#if>
</#if>
</#list>
</#if>
})
${majorIndexDECodeName} to${majorIndexDECodeNameCamel}(${MinorIndexDECodeName} minorEntity);
@Mappings({
@Mapping(source ="${majorIndexDEKeyFieldCodeName}" ,target = "${MinorIndexDEKeyFieldCodeName}"),
@Mapping(source ="${majorIndexDEMajorTextFieldCodeName}" ,target = "${MinorIndexDEMajorTextFieldCodeName}"),
@Mapping(target ="focusNull",ignore = true),
<#if indexPSDER.getPSDERIndexDEFieldMaps()??>
<#list indexPSDER.getPSDERIndexDEFieldMaps() as indexFieldmapping>
<#comment>排除主键及主文本属性</#comment>
<#if indexFieldmapping.getMajorPSDEField()?? && indexFieldmapping.getMinorPSDEField()??>
<#assign majorDEField=indexFieldmapping.getMajorPSDEField()>
<#assign MinorDEField=indexFieldmapping.getMinorPSDEField()>
<#if majorDEField.isKeyDEField()==false && MinorDEField.isKeyDEField()==false && majorDEField.isMajorDEField()==false && MinorDEField.isMajorDEField()==false>
<#if !P.exists(majorDEField.codeName,MinorDEField.codeName)>
@Mapping(source ="${srfr7templcaseformat(majorDEField.codeName)}",target = "${srfr7templcaseformat(MinorDEField.codeName)}"),
</#if>
</#if>
</#if>
</#list>
</#if>
})
${MinorIndexDECodeName} to${MinorIndexDECodeNameCamel}(${majorIndexDECodeName} majorEntity);
List<${majorIndexDECodeName}> to${majorIndexDECodeNameCamel}(List<${MinorIndexDECodeName}> minorEntities);
List<${MinorIndexDECodeName}> to${MinorIndexDECodeNameCamel}(List<${majorIndexDECodeName}> majorEntities);
}
</#if>
</#if>
\ No newline at end of file
...@@ -31,8 +31,16 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName} ...@@ -31,8 +31,16 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
CachedBeanCopier.copy(get(et.get{{pascalCase entity.keyField.codeName}}()), et); CachedBeanCopier.copy(get(et.get{{pascalCase entity.keyField.codeName}}()), et);
return et; return et;
} }
List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> idList); List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> ids);
List<{{entity.codeName}}> getByEntities(Collection<{{entity.codeName}}> entities); default List<{{entity.codeName}}> getByEntities(Collection<{{entity.codeName}}> entities) {
List ids =new ArrayList();
entities.forEach(et -> {
Serializable id=et.get{{pascalCase entity.keyField.codeName}}();
if(!ObjectUtils.isEmpty(id))
ids.add(id);
});
return getByIds(ids);
}
{{entity.codeName}} getDraft({{entity.codeName}} et); {{entity.codeName}} getDraft({{entity.codeName}} et);
...@@ -63,7 +71,7 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName} ...@@ -63,7 +71,7 @@ public interface I{{entity.codeName}}Service extends IService<{{entity.codeName}
{{#enableEntityCache}} {{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true) @CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}} {{/enableEntityCache}}
boolean removeBatch(Collection<{{entity.keyField.type.java}}> idList); boolean removeBatch(Collection<{{entity.keyField.type.java}}> ids);
{{#each entity.extActions}} {{#each entity.extActions}}
{{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et); {{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et);
......
...@@ -62,11 +62,13 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam ...@@ -62,11 +62,13 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
Assert.notNull(et,"数据不存在,{{entity.logicName}}:"+key); Assert.notNull(et,"数据不存在,{{entity.logicName}}:"+key);
{{#entity.nesteds}} {{#entity.nesteds}}
//设置 [{{entityLogicName}}] //设置 [{{entityLogicName}}]
this.set{{pascalCase codeName}}({{camelCase entityCodeName}}Service.selectBy{{pascalCase fkField.codeName}}(key)); et.set{{pascalCase codeName}}({{camelCase entityCodeName}}Service.selectBy{{pascalCase fkField.codeName}}(key));
{{/entity.nesteds}} {{/entity.nesteds}}
return et;
}
public List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> ids) {
return this.listByIds(ids);
} }
List<{{entity.codeName}}> getByIds(Collection<{{entity.keyField.type.java}}> idList);
List<{{entity.codeName}}> getByEntities(Collection<{{entity.codeName}}> entities);
{{entity.codeName}} getDraft({{entity.codeName}} et); {{entity.codeName}} getDraft({{entity.codeName}} et);
...@@ -95,9 +97,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam ...@@ -95,9 +97,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{/unless}} {{/unless}}
{{/unless}} {{/unless}}
{{/each}} {{/each}}
{{#entity.hasReferences}} get(et);
{{/entity.hasReferences}}
return true; return true;
} }
{{#eq entity.actions.create.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.create.transactionMode "DEFAULT"}}@Transactional{{/eq}} {{#eq entity.actions.create.transactionMode "GLOBAL"}}@GlobalTransactional{{/eq}}{{#eq entity.actions.create.transactionMode "DEFAULT"}}@Transactional{{/eq}}
...@@ -121,7 +121,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam ...@@ -121,7 +121,7 @@ public class {{entity.codeName}}ServiceImpl extends ServiceImpl<{{entity.codeNam
{{#enableEntityCache}} {{#enableEntityCache}}
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true) @CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}} {{/enableEntityCache}}
boolean removeBatch(Collection<{{entity.keyField.type.java}}> idList); boolean removeBatch(Collection<{{entity.keyField.type.java}}> ids);
{{#entity.actions}} {{#entity.actions}}
{{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et); {{entity.codeName}} {{camelCase codeName}}({{entity.codeName}} et);
......
<#ibiztemplate> {{#unless apiEntity.subSysDE}}
TARGET=PSDESERVICEAPI
</#ibiztemplate>
<#comment>引入驼峰配置</#comment>
<#ibizinclude>/SLN/globalfunc.cfg</#ibizinclude>
<#comment>不发布子系统实体</#comment>
<#if de.isSubSysDE()==false>
<#assign pubPkgCodeName = pub.getPKGCodeName()>
<#assign itemSysApiCodeNameLC = item.getPSSysServiceAPI().getCodeName()?lower_case>
<#assign dtoBase="DTOBase">
<#comment>中台模式通过DTOClient设置dirtyflag</#comment>
<#if ((de.getPSSubSysServiceAPI().getServiceType())!'')=='MIDDLEPLATFORM'>
<#assign dtoBase="DTOClient">
</#if>
<#assign hasValueRuleGroup=false>
<#if sys.codeName == 'Sample'>
<#if de.getAllPSDEFValueRules()??>
<#list de.getAllPSDEFValueRules() as deRule>
<#if deRule.codeName!='Default'>
<#if deRule.getPSDEFVRGroupCondition()??>
<#assign hasValueRuleGroup=true>
<#break>
</#if>
</#if>
</#list>
</#if>
</#if>
package {{packageName}}.{{apis}}.dto; package {{packageName}}.{{apis}}.dto;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -46,158 +20,82 @@ import javax.validation.constraints.NotNull; ...@@ -46,158 +20,82 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import cn.ibizlab.util.domain.DTOBase; import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.DTOClient; import cn.ibizlab.util.domain.DTOClient;
import lombok.Data; import lombok.*;
<#if hasValueRuleGroup> import lombok.experimental.Accessors;
import cn.ibizlab.util.annotation.ValueRuleCheck;
</#if>
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
/** /**
* 服务DTO对象[${item.getCodeName()}DTO] * 服务DTO对象[{{apiEntity.codeName}}DTO]
*/ */
@Data @Getter
<@valueRuleGroup/> @Setter
@ApiModel("${item.getLogicName()}") @NoArgsConstructor
public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable { @Accessors(chain = true)
@ApiModel("{{apiEntity.logicName}}")
public class {{apiEntity.codeName}}DTO extends {{#eq apiEntity.entity.psSubSysServiceAPI.serviceType "MIDDLEPLATFORM"}}DTOClient{{else}}DTOBase{{/eq}} implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
<#if item.getPSDEServiceAPIFields()??> {{#each apiEntity.properties}}
<#comment>接口属性集合</#comment> {{#unless deepStructure}}
<#list item.getPSDEServiceAPIFields() as apifield>
<#assign defDataType = (apifield.getPSDEField().getDataType())!"">
<#assign columnname = apifield.getName()?lower_case>
<#assign prvateCodeName = srfr7templcaseformat(apifield.getCodeName()) >
<#assign publicCodeName = prvateCodeName?cap_first >
<#assign jsonfield = apifield.getCodeName()?lower_case >
<#assign defield=(apifield.getPSDEField())!"">
<#if defDataType!='ONE2MANYDATA'>
/** /**
* 属性 [${apifield.getName()}] * {{logicName}}
*
*/ */
<#if defDataType == "DATETIME" || ((defDataType=='PICKUPDATA'||defDataType=='INHERIT') && srfdatatype(apifield.getStdDataType())== "DATETIME" && apifield.getPSDEField().getValueFormat()=="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS")> @JsonProperty("{{jsonName}}")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8") {{#timeType}}
@JSONField(name = "${jsonfield}" , format="yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
<#elseif defDataType == "DATE" || ((defDataType=='PICKUPDATA'||defDataType=='INHERIT') && srfdatatype(apifield.getStdDataType())== "DATETIME" && apifield.getPSDEField().getValueFormat()=="%1$tY-%1$tm-%1$td")> {{/timeType}}
@JsonFormat(pattern="yyyy-MM-dd", locale = "zh" , timezone="GMT+8") @JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}})
@JSONField(name = "${jsonfield}" , format="yyyy-MM-dd") {{#eq type.java "Long"}}
<#elseif defDataType == "TIME" || ((defDataType=='PICKUPDATA'||defDataType=='INHERIT') && srfdatatype(apifield.getStdDataType())== "DATETIME" && apifield.getPSDEField().getValueFormat()=="%1$tH:%1$tM:%1$tS")> @JsonSerialize(using = ToStringSerializer.class)
@JsonFormat(pattern="HH:mm:ss", locale = "zh" , timezone="GMT+8") {{/eq}}
@JSONField(name = "${jsonfield}" , format="HH:mm:ss") @ApiModelProperty("{{logicName}}")
<#else> private {{type.java}} {{camelCase codeName}};
@JSONField(name = "${jsonfield}")
</#if>
@JsonProperty("${jsonfield}")
<#comment>Long型数据转String,解决前端精度丢失问题</#comment>
<#if srfr7javatype(apifield.getStdDataType())=='Long'>
@JsonSerialize(using = ToStringSerializer.class)
</#if>
<@valueRule defield />
@ApiModelProperty("${apifield.getLogicName()}")
private ${srfr7javatype(apifield.getStdDataType())} ${prvateCodeName};
</#if> {{/unless}}
</#list> {{/each}}
</#if>
<#comment>输出set方法用于设置null值</#comment> {{#each apiEntity.entity.nesteds}}
<#list item.getPSDEServiceAPIFields() as apifield>
<#assign defield = apifield.getPSDEField() >
<#assign defDataType = (defield.getDataType())!"">
<#assign columnname = apifield.getName()?lower_case>
<#assign prvateCodeName = srfr7templcaseformat(apifield.getCodeName()) >
<#assign publicCodeName = prvateCodeName?cap_first >
<#if defield.isPhisicalDEField()==true && defield.isKeyDEField()==false && defDataType!='ONE2MANYDATA'>
<#if defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
<#else >
/** /**
* 设置 [${apifield.getName()}] * {{entityLogicName}}
*/ */
public void set${publicCodeName}(${srfr7javatype(apifield.getStdDataType())} ${prvateCodeName}){ @JSONField(name = "{{pluralize codeName}}")
this.${prvateCodeName} = ${prvateCodeName} ; @JsonProperty("{{pluralize codeName}}")
this.modify("${columnname}",${prvateCodeName}); private List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{camelCase codeName}};
{{/each}}
{{#each apiEntity.properties}}
{{#unless deepStructure}}
{{#unless keyDEField}}
{{#unless predefinedType}}
/**
* 设置 [{{logicName}}]
*/
public {{apiEntity.codeName}}DTO set{{pascalCase codeName}}({{type.java}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
this.modify("{{lowerCase name}}", {{camelCase codeName}});
return this;
} }
{{/unless}}
{{/unless}}
</#if> {{/unless}}
</#if> {{/each}}
</#list>
<#comment>输出关系数据(子实体)</#comment> {{#apiEntity.entity.nesteds}}
<#if item.getPSDEServiceAPIRSs()?? > {{#columnName}}
<#list item.getPSDEServiceAPIRSs() as apider>
<#if apider.getPSDER1N()??>
<#assign der = apider.getPSDER1N() >
<#if apider.getMinorPSDEServiceAPI().isNested()>
<#assign subDTOs = srfpluralize(apider.getMinorPSDEServiceAPI().getCodeName())?lower_case >
<#assign subcode = srfr7templcaseformat((der.getMinorCodeName()!der.getMinorPSDataEntity().getCodeName())) >
<#if subcode?? && subcode==''><#assign subcode=srfr7templcaseformat(der.getMinorPSDataEntity().getCodeName())></#if>
/** /**
* [${apider.getMinorPSDEServiceAPI().getName()}] * 设置 [{{entityLogicName}}]
*/ */
@JsonProperty("${subDTOs}") public {{apiEntity.codeName}}DTO set{{pascalCase codeName}}(List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{camelCase codeName}}) {
@JSONField(name = "${subDTOs}") this.{{camelCase codeName}} = {{camelCase codeName}};
private List<${apider.getMinorPSDEServiceAPI().getCodeName()}DTO> ${subcode} ; this.modify("{{columnName}}", ({{camelCase codeName}}!=null)?{{camelCase codeName}}:(new ArrayList()));
return this;
}
{{/columnName}}
{{/apiEntity.entity.nesteds}}
</#if>
</#if>
</#list>
</#if>
} }
{{/unless}}
</#if> \ No newline at end of file
<#comment>属性值规则</#comment>
<#macro valueRule defield>
<#if defield !=''>
<#if defield.isKeyDEField()==true || defield.getPredefinedType()?? && defield.getPredefinedType()!=''>
<#else>
<#if defield.isAllowEmpty()==false>
<#assign notNullMsg="["+defield.getLogicName()+"]不允许为空!">
<#if srfr7javatype(defield.stdDataType)=='String'>
@NotBlank(message = "${notNullMsg}")
<#else>
@NotNull(message = "${notNullMsg}")
</#if>
</#if>
</#if>
<#if defield.getAllPSDEFValueRules()??>
<#list defield.getAllPSDEFValueRules() as defieldVR>
<#if defieldVR.getPSDEFVRGroupCondition?? && defieldVR.getPSDEFVRGroupCondition()?? && defieldVR.getCodeName()=='Default'>
<#assign vrCond=defieldVR.getPSDEFVRGroupCondition()>
<#assign vrCondType=vrCond.getCondType()>
<#assign vrCondOp=vrCond.getCondOp()>
<#if vrCond.getPSDEFVRConditions?? && vrCond.getPSDEFVRConditions()??>
<#list vrCond.getPSDEFVRConditions() as subVRCond>
<#if subVRCond.getCondType()=='STRINGLENGTH'>
<#if subVRCond.getMaxValue()?c!='-1'>
@Size(min = 0, max = ${subVRCond.getMaxValue()?c}, message = "${subVRCond.getRuleInfo()}")
</#if>
</#if>
</#list>
</#if>
</#if>
</#list>
</#if>
</#if>
</#macro>
<#comment>属性值规则(规则组)</#comment>
<#macro valueRuleGroup>
<#if hasValueRuleGroup>
<#assign ruleMsg="">
@ValueRuleCheck.List({
<#list de.getAllPSDEFValueRules() as deRule>
<#if deRule.codeName!='Default'>
<#if deRule.getPSDEFVRGroupCondition()??>
<#assign ruleName=(de.codeName+"_"+deRule.getPSDEField().codeName+"_"+deRule.codeName)?lower_case>
<#assign ruleField=(deRule.getPSDEField().codeName)?lower_case>
<#assign group=deRule.getPSDEFVRGroupCondition()>
@ValueRuleCheck(field = "${ruleField}", rule = "${ruleName}"),
</#if>
</#if>
</#list>
})
</#if>
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册