|
@@ -464,31 +464,31 @@ public class Category {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- public static String getCategoryCode(String code, int index) {
|
|
|
+ public static String getCategoryCode(String code, String index) {
|
|
|
Category category = Category.CATEGORY_MAP.getOrDefault(code, null);
|
|
|
if (category == null) {
|
|
|
return null;
|
|
|
}
|
|
|
switch (index) {
|
|
|
- case 1:
|
|
|
+ case "1":
|
|
|
return category.getCateFirstCode();
|
|
|
- case 2:
|
|
|
+ case "2":
|
|
|
return category.getCateSecondCode();
|
|
|
- case 3:
|
|
|
+ case "3":
|
|
|
return category.getCateThirdCode();
|
|
|
default:
|
|
|
throw new RuntimeException("不支持的索引,[1,2,3]");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static String getCategoryName(String code, int index) {
|
|
|
+ public static String getCategoryName(String code, String index) {
|
|
|
Category category = Category.CATEGORY_MAP.getOrDefault(code, Category.NONE_TYPE);
|
|
|
switch (index) {
|
|
|
- case 1:
|
|
|
+ case "1":
|
|
|
return category.getCateFirst();
|
|
|
- case 2:
|
|
|
+ case "2":
|
|
|
return category.getCateSecond();
|
|
|
- case 3:
|
|
|
+ case "3":
|
|
|
return category.getCateThird();
|
|
|
default:
|
|
|
throw new RuntimeException("不支持的索引,[1,2,3]");
|
|
@@ -519,4 +519,9 @@ public class Category {
|
|
|
public String getCateThird() {
|
|
|
return cateThird;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ System.out.println(getCategoryName("515","1"));
|
|
|
+ }
|
|
|
}
|