|
|
@@ -1,18 +1,38 @@
|
|
|
package cn.reghao.dfs.store.model.constant;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
+ * 文件类型
|
|
|
+ *
|
|
|
* @author reghao
|
|
|
- * @date 2021-11-22 10:03:14
|
|
|
+ * @date 2022-04-20 14:57:36
|
|
|
*/
|
|
|
public enum FileType {
|
|
|
- mp4("video/mp4"), mov("video/quicktime"), jpg("image/jpeg");
|
|
|
+ image(1, "图片"), audio(2, "音频"), video(3, "视频"), attachment(4, "附件");
|
|
|
+
|
|
|
+ private final Integer code;
|
|
|
+ private final String desc;
|
|
|
+
|
|
|
+ private static Map<Integer, String> descMap = new HashMap<>();
|
|
|
+ static {
|
|
|
+ for (FileType type : FileType.values()) {
|
|
|
+ descMap.put(type.code, type.desc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ FileType(Integer code, String desc) {
|
|
|
+ this.code = code;
|
|
|
+ this.desc = desc;
|
|
|
+ }
|
|
|
|
|
|
- private final String contentType;
|
|
|
- FileType(String contentType) {
|
|
|
- this.contentType = contentType;
|
|
|
+ public Integer getCode() {
|
|
|
+ return code;
|
|
|
}
|
|
|
|
|
|
- public String getContentType() {
|
|
|
- return contentType;
|
|
|
+ // TODO 第一次调用时会初始化 descMap
|
|
|
+ public static String getDescByCode(int code) {
|
|
|
+ return descMap.get(code);
|
|
|
}
|
|
|
}
|