Commit 498df91e by guojuxing

根据code获取枚举对象,默认返回CSV

parent ce298e84
......@@ -21,6 +21,26 @@ public enum ExcelExtensionEnum {
this.extension = extension;
}
/**
* 根据code获取枚举对象,默认返回CSV
* @Title: getByCode

* @Description:

* @author guojuxing
* @param code

* @return com.gic.download.constants.ExcelExtensionEnum


*/
public static ExcelExtensionEnum getByCode(Integer code) {
if (code == null) {
return ExcelExtensionEnum.CSV;
}
for (ExcelExtensionEnum extensionEnum : values()) {
if (code.intValue() == extensionEnum.getCode()) {
return extensionEnum;
}
}
return ExcelExtensionEnum.CSV;
}
public static String getExtensionByCode(Integer code) {
if (code == null) {
return ".csv";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment