提交 41e0da6d 编写于 作者: zhouweidong's avatar zhouweidong

补充属性值规则

上级 80c76b3b
......@@ -122,6 +122,14 @@ public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable
<#comment>属性值规则</#comment>
<#macro valueRule defield>
<#if defield !=''>
<#if defield.isAllowEmpty()==false>
<#assign notNullMsg="["+defield.getLogicName()+"]不允许为空!">
<#if srfr7javatype(defield.stdDataType)=='String'>
@NotBlank(message = "${notNullMsg}")
<#else>
@NotNull(message = "${notNullMsg}")
</#if>
</#if>
<#if defield.getAllPSDEFValueRules()??>
<#list defield.getAllPSDEFValueRules() as defieldVR>
<#if defieldVR.getPSDEFVRGroupCondition?? && defieldVR.getPSDEFVRGroupCondition()?? && defieldVR.getCodeName()=='Default'>
......@@ -134,13 +142,6 @@ public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable
<#if subVRCond.getMaxValue()?c!='-1'>
@Size(min = 0, max = ${subVRCond.getMaxValue()?c}, message = "${subVRCond.getRuleInfo()}")
</#if>
<#elseif subVRCond.getCondType()=='ISNOTNULL'>
<#assign notNullMsg="["+defield.getLogicName()+"]不允许为空!">
<#if srfr7javatype(defield.stdDataType)=='String'>
@NotBlank(message = "${notNullMsg}")
<#else>
@NotNull(message = "${notNullMsg}")
</#if>
</#if>
</#list>
</#if>
......
......@@ -54,6 +54,7 @@ import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
......@@ -155,7 +156,7 @@ public class ${itemCodeName}Resource {
<@SecurityAnnotation deaction/>
@ApiOperation(value = "新建${deLogicName}", tags = {"${deLogicName}" }, notes = "新建${deLogicName}")
@RequestMapping(method = RequestMethod.POST, value = "${fullPath}")
public ResponseEntity<${itemCodeName}DTO> create(${etParams}) {
public ResponseEntity<${itemCodeName}DTO> create(@Validated ${etParams}) {
${deCodeName} domain = ${itemCodeNameLC}Mapping.toDomain(${itemCodeNameLC}dto);
${deCodeNameLC}Service.create(domain);
${itemCodeName}DTO dto = ${itemCodeNameLC}Mapping.toDto(domain);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册