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

minicode

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