【fix sonar】CgformEnum文件

This commit is contained in:
梁琦涛
2023-03-03 13:43:31 +08:00
parent b8efff4d56
commit 73b6231522
@@ -1,9 +1,6 @@
package com.jero.common.constant.enums; package com.jero.common.constant.enums;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* online表单枚举 代码生成器用到 * online表单枚举 代码生成器用到
@@ -13,31 +10,31 @@ public enum CgformEnum {
/** /**
* 单表 * 单表
*/ */
ONE(1, "one", "/jero/code-template-online", "default.one", "经典风格"), ONE(1, "one", Cgform.CODE_TEMPLATE_ONLINE, "default.one", "经典风格"),
/** /**
* 多表 * 多表
*/ */
MANY(2, "many", "/jero/code-template-online", "default.onetomany", "经典风格"), MANY(2, "many", Cgform.CODE_TEMPLATE_ONLINE, "default.onetomany", "经典风格"),
/** /**
* 多表 * 多表
*/ */
ERP(2, "erp", "/jero/code-template-online", "erp.onetomany", "ERP风格"), ERP(2, "erp", Cgform.CODE_TEMPLATE_ONLINE, "erp.onetomany", "ERP风格"),
/** /**
* 多表(jvxe风格) * 多表(jvxe风格)
* */ * */
JVXE_TABLE(2, "jvxe", "/jero/code-template-online", "jvxe.onetomany", "JVXE风格"), JVXE_TABLE(2, "jvxe", Cgform.CODE_TEMPLATE_ONLINE, "jvxe.onetomany", "JVXE风格"),
/** /**
* 多表(内嵌子表风格) * 多表(内嵌子表风格)
*/ */
INNER_TABLE(2, "innerTable", "/jero/code-template-online", "inner-table.onetomany", "内嵌子表风格"), INNER_TABLE(2, "innerTable", Cgform.CODE_TEMPLATE_ONLINE, "inner-table.onetomany", "内嵌子表风格"),
/** /**
* 多表(tab风格) * 多表(tab风格)
* */ * */
TAB(2, "tab", "/jero/code-template-online", "tab.onetomany", "Tab风格"), TAB(2, "tab", Cgform.CODE_TEMPLATE_ONLINE, "tab.onetomany", "Tab风格"),
/** /**
* 树形列表 * 树形列表
*/ */
TREE(3, "tree", "/jero/code-template-online", "default.tree", "树形列表"); TREE(3, "tree", Cgform.CODE_TEMPLATE_ONLINE, "default.tree", "树形列表");
/** /**
* 类型 1/单表 2/一对多 3/树 * 类型 1/单表 2/一对多 3/树
@@ -84,7 +81,7 @@ public enum CgformEnum {
* @return * @return
*/ */
public static String getTemplatePathByConfig(String code) { public static String getTemplatePathByConfig(String code) {
return getCgformEnumByConfig(code).templatePath; return Objects.requireNonNull(getCgformEnumByConfig(code)).templatePath;
} }
@@ -134,10 +131,10 @@ public enum CgformEnum {
* @return * @return
*/ */
public static List<Map<String, Object>> getJspModelList(int type) { public static List<Map<String, Object>> getJspModelList(int type) {
List<Map<String, Object>> ls = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> ls = new ArrayList<>();
for (CgformEnum e : CgformEnum.values()) { for (CgformEnum e : CgformEnum.values()) {
if (e.type == type) { if (e.type == type) {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<>();
map.put("code", e.code); map.put("code", e.code);
map.put("note", e.note); map.put("note", e.note);
ls.add(map); ls.add(map);
@@ -145,6 +142,11 @@ public enum CgformEnum {
} }
return ls; return ls;
} }
public class Cgform{
private Cgform(){
}
public static final String CODE_TEMPLATE_ONLINE = "/jero/code-template-online";
}
} }