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

minicode

上级 1dee2fcb
...@@ -7,10 +7,7 @@ import lombok.Setter; ...@@ -7,10 +7,7 @@ import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import net.ibizsys.model.app.dataentity.IPSAppDEField; import net.ibizsys.model.app.dataentity.IPSAppDEField;
import net.ibizsys.model.control.IPSEditor; import net.ibizsys.model.control.IPSEditor;
import net.ibizsys.model.control.editor.IPSCheckBoxList; import net.ibizsys.model.control.editor.*;
import net.ibizsys.model.control.editor.IPSCodeListEditor;
import net.ibizsys.model.control.editor.IPSFileUploader;
import net.ibizsys.model.control.editor.IPSMDropDownList;
import net.ibizsys.model.control.form.IPSDEFDCatGroupLogic; import net.ibizsys.model.control.form.IPSDEFDCatGroupLogic;
import net.ibizsys.model.control.form.IPSDEForm; import net.ibizsys.model.control.form.IPSDEForm;
import net.ibizsys.model.control.form.IPSDEFormItem; import net.ibizsys.model.control.form.IPSDEFormItem;
...@@ -60,8 +57,19 @@ public class VoFieldModel extends BaseModel { ...@@ -60,8 +57,19 @@ public class VoFieldModel extends BaseModel {
} }
public PropType getType() { public PropType getType() {
type=PropType.findType(this.getPSDEFormItem().getDataType()); if(type==null) {
type = PropType.findType(this.getPSDEFormItem().getDataType());
if(type.equals(PropType.VARCHAR)&&this.getPSEditor()!=null&&this.getPSEditor() instanceof IPSDatePicker)
{
IPSDatePicker datePicker=(IPSDatePicker)this.getPSEditor();
if("YYYY-MM-DD".equalsIgnoreCase(datePicker.getDateTimeFormat()))
type=PropType.DATE;
else if(!StringUtils.isEmpty(datePicker.getDateTimeFormat()) && datePicker.getDateTimeFormat().toUpperCase().startsWith("HH"))
type=PropType.TIME;
else
type=PropType.DATETIME;
}
}
return type; return type;
} }
...@@ -174,21 +182,26 @@ public class VoFieldModel extends BaseModel { ...@@ -174,21 +182,26 @@ public class VoFieldModel extends BaseModel {
} }
public String getFormat(){ public String getFormat(){
if("Timestamp".equals(getType().getJava())) if(format==null)
{ {
if(this.getPSDEFormItem().getDataType()==PropType.DATE.getCode()||"%1$tY-%1$tm-%1$td".equalsIgnoreCase(this.getPSDEFormItem().getValueFormat())){ format="";
timeType="DATE"; if("Timestamp".equals(getType().getJava()))
format = "yyyy-MM-dd"; {
} if(this.getPSDEFormItem().getDataType()==PropType.DATE.getCode()||"%1$tY-%1$tm-%1$td".equalsIgnoreCase(this.getPSDEFormItem().getValueFormat())||type.equals(PropType.DATE)){
else if(this.getPSDEFormItem().getDataType()==PropType.TIME.getCode()||"%1$tH:%1$tM:%1$tS".equalsIgnoreCase(this.getPSDEFormItem().getValueFormat())){ timeType="DATE";
timeType="TIME"; format = "yyyy-MM-dd";
format = "HH:mm:ss"; }
} else if(this.getPSDEFormItem().getDataType()==PropType.TIME.getCode()||"%1$tH:%1$tM:%1$tS".equalsIgnoreCase(this.getPSDEFormItem().getValueFormat())||type.equals(PropType.TIME)){
else{ timeType="TIME";
timeType="DATETIME"; format = "HH:mm:ss";
format = "yyyy-MM-dd HH:mm:ss"; }
else{
timeType="DATETIME";
format = "yyyy-MM-dd HH:mm:ss";
}
} }
} }
return format; return format;
} }
...@@ -262,16 +275,30 @@ public class VoFieldModel extends BaseModel { ...@@ -262,16 +275,30 @@ public class VoFieldModel extends BaseModel {
public String getExample() { public String getExample() {
if(example==null) { if(example==null) {
example = ""; example = "";
} String dv="";
if (this.getDict() != null && !ObjectUtils.isEmpty(this.getDict().getOptions())) if(!ObjectUtils.isEmpty(this.getPSDEFormItem().getCreateDV())) {
{ if(ObjectUtils.isEmpty(this.getPSDEFormItem().getCreateDVT()))
example = this.getDict().getOptions().get(0).getValue().toString(); dv=this.getPSDEFormItem().getCreateDV();
if(!this.isSingleSelect()&&this.getDict().getOptions().size()>1) }
if(ObjectUtils.isEmpty(dv)) {
if(!ObjectUtils.isEmpty(this.getPSDEFormItem().getUpdateDV())) {
if(ObjectUtils.isEmpty(this.getPSDEFormItem().getUpdateDVT()))
dv=this.getPSDEFormItem().getUpdateDV();
}
}
if(!StringUtils.isEmpty(dv))
example=dv.replace("\"","");
else if (this.getDict() != null && !ObjectUtils.isEmpty(this.getDict().getOptions()))
{ {
example+=this.getDict().getCodeList().getValueSeparator()==null?";":this.getDict().getCodeList().getValueSeparator(); example = this.getDict().getOptions().get(0).getValue().toString();
example+= this.getDict().getOptions().get(1).getValue().toString(); if(!this.isSingleSelect()&&this.getDict().getOptions().size()>1)
{
example+=this.getDict().getCodeList().getValueSeparator()==null?";":this.getDict().getCodeList().getValueSeparator();
example+= this.getDict().getOptions().get(1).getValue().toString();
}
} }
} }
return example; return example;
} }
......
...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeNa ...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeNa
{{#eq javaType "Long"}} {{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
{{/eq}} {{/eq}}
@ApiModelProperty(value = "{{logicName}}{{#if dict}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}}) @ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}} {{#if createDefaultValue}}= {{createDefaultValue}}{{/if}}; protected {{javaType}} {{camelCase codeName}} {{#if createDefaultValue}}= {{createDefaultValue}}{{/if}};
{{/if}} {{/if}}
......
...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable { ...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
{{#eq javaType "Long"}} {{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
{{/eq}} {{/eq}}
@ApiModelProperty(value = "{{logicName}}{{#if dict}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}}) @ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}}; protected {{javaType}} {{camelCase codeName}};
{{/unless}} {{/unless}}
......
...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}Dto extends {{pascalCase ctrl.codeName} ...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}Dto extends {{pascalCase ctrl.codeName}
{{#eq javaType "Long"}} {{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
{{/eq}} {{/eq}}
@ApiModelProperty(value = "{{logicName}}{{#if dict}},【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}}) @ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}}; protected {{javaType}} {{camelCase codeName}};
{{/if}} {{/if}}
......
...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.cod ...@@ -52,7 +52,7 @@ public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.cod
{{#eq javaType "Long"}} {{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
{{/eq}} {{/eq}}
@ApiModelProperty(value = "{{logicName}}{{#if dict}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}}) @ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}} {{#if updateDefaultValue}}= {{updateDefaultValue}}{{/if}}; protected {{javaType}} {{camelCase codeName}} {{#if updateDefaultValue}}= {{updateDefaultValue}}{{/if}};
{{/if}} {{/if}}
......
{{#eq apps "link"}} {{#eq apps "link"}}
package {{packageName}}.api.{{apps}}.rest; package {{packageName}}.api.{{apps}}.dict;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -29,12 +29,17 @@ import io.swagger.annotations.ApiParam; ...@@ -29,12 +29,17 @@ import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import cn.ibizlab.edge.api.link.annotation.G1;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import {{packageName}}.api.{{apps}}.dict.*; import {{packageName}}.api.{{apps}}.dict.*;
@Slf4j @Slf4j
@Api(tags = {"数据字典" }) @Api(tags = {"数据字典" })
@RestController("{{lowerCase app.codeName}}-DictResource") @RestController("{{lowerCase app.codeName}}-DictResource")
@RequestMapping("/{{lowerCase app.codeName}}/dict") @RequestMapping("/{{lowerCase app.codeName}}/dict")
@G1
@ApiSupport(order = 99)
public class DictResource { public class DictResource {
......
{{#eq apps "link"}} {{#eq apps "link"}}
{{#if appEntity.forms}}
package {{packageName}}.api.{{apps}}.rest; package {{packageName}}.api.{{apps}}.rest;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -55,4 +56,5 @@ public class {{pascalCase appEntity.codeName}}Resource { ...@@ -55,4 +56,5 @@ public class {{pascalCase appEntity.codeName}}Resource {
} }
{{/if}}
{{/eq}} {{/eq}}
\ No newline at end of file
...@@ -78,9 +78,7 @@ public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeNa ...@@ -78,9 +78,7 @@ public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeNa
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true) @CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}} {{/enableEntityCache}}
default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable { default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable {
List keys=new ArrayList(); return IBaseService.super.onRemove(key);
keys.add(key);
return IBaseService.super.onRemove(keys);
} }
{{#enableEntityCache}} {{#enableEntityCache}}
......
...@@ -79,9 +79,7 @@ public interface {{entity.codeName}}Service extends IMPService<{{entity.codeName ...@@ -79,9 +79,7 @@ public interface {{entity.codeName}}Service extends IMPService<{{entity.codeName
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true) @CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}} {{/enableEntityCache}}
default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable { default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable {
List keys=new ArrayList(); return IMPService.super.onRemove(key);
keys.add(key);
return IMPService.super.onRemove(keys);
} }
{{#enableEntityCache}} {{#enableEntityCache}}
......
...@@ -78,9 +78,7 @@ public interface {{entity.codeName}}Service extends IServiceApiService<{{entity. ...@@ -78,9 +78,7 @@ public interface {{entity.codeName}}Service extends IServiceApiService<{{entity.
@CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true) @CacheEvict(value = "{{lowerCase entity.codeName}}", allEntries = true)
{{/enableEntityCache}} {{/enableEntityCache}}
default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable { default boolean onRemove({{entity.keyField.type.java}} key) throws Throwable {
List keys=new ArrayList(); return IServiceApiService.super.onRemove(key);
keys.add(key);
return IServiceApiService.super.onRemove(keys);
} }
{{#enableEntityCache}} {{#enableEntityCache}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册