public CommonModelField findCommonModelField(int fieldId) { for (CommonModel c : getCommonModelList()) { for (CommonModelField f : c.getCommonModelFieldList()) { if (f.getId() == fieldId) return f; } } return null; }
private String _getCommonModelHTML(Set<CommonModel> list) { StringBuilder html = new StringBuilder(); for (CommonModel model : list) { List<CommonModelField> fields = model.getCommonModelFieldListOrdered(); html.append("<div>") .append(model.getName()) .append("<") .append(model.getCode()) .append("></div>") .append("<table class=\"param-table\">") .append("<thead>") .append("<th class=\"th-identifier\">字段名</th>") .append("<th class=\"th-type\">类型</th>") .append("<th class=\"th-need\">必填</th>") .append("<th class=\"th-remark\">备注</th>") .append("</thead>"); getCommonModelHTMLSub(html, fields, (short) 1); html.append("</table><hr/>"); } return html.toString(); }
/** * 功能描述:增加项目的公用Model * * @param commonModel * @author <a href="mailto:[email protected]">李伟光 </a> created on: 2016-4-6 */ public void addCommonModel(CommonModel commonModel) { getCommonModelList().add(commonModel); commonModel.setProject(this); }
/** * 功能描述:查找指定的接口公用model * * @param modelId * @return * @author <a href="mailto:[email protected]">李伟光 </a> created on: 2016-4-6 */ public CommonModel findCommonModel(int modelId) { for (CommonModel c : getCommonModelList()) { if (c.getId() == modelId) return c; } return null; }
// 更新CommonModel基本属性 public void update(CommonModel commonModel) { setCode(commonModel.getCode()); setName(commonModel.getName()); }