Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

字段长度展示问题解决方案 #67

Open
onepiecefyf opened this issue Dec 21, 2021 · 0 comments
Open

字段长度展示问题解决方案 #67

onepiecefyf opened this issue Dec 21, 2021 · 0 comments

Comments

@onepiecefyf
Copy link

1、属性实体增加两个字段maximum,maxSize
public class ModelAttr implements Serializable {

private static final long serialVersionUID = -4074067438450613643L;

/** 属性名 **/
private String name = StringUtils.EMPTY;

/** 属性描述 **/
private String description;

/** 类型 **/
private String type = StringUtils.EMPTY;

/** 是否必填 **/
private String require = "否";

/** String类型最大长度 **/
private String maxLength = "";

/** Integer类型最大长度 **/
private String maximum = "";

/** 页面展示类型最大长度 **/
private String maxSize = "-";

/** 约束与说明 **/
private String remark = "";

/** 入参深度 */
private int requestDep;

/**
 * 嵌套属性列表
 */
private List<ModelAttr> properties = new ArrayList<>();

/**
 * 是否加载完成,避免循环引用
 */
private boolean isCompleted = false;

}

2、方法cn.org.bjca.swagger.word.service.impl.WordServiceImpl#getModelAttrs需要添加针对处理长度的逻辑
Object maximum = attrInfoMap.get("maximum");
Object maxLength = attrInfoMap.get("maxLength");
if (!Objects.isNull(maximum) && maximum.toString().length() < 5) {
child.setMaximum(maximum != null ? maximum.toString() : "");
}
if (!Objects.isNull(maxLength) && maxLength.toString().length() < 5) {
child.setMaxLength(maxLength != null ? maxLength.toString() : "");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant