Skip to content

Commit 24e85c2

Browse files
committed
feat: User 회원등급 enum 추가
1 parent c78e317 commit 24e85c2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.back.domain.user.enums;
2+
3+
public enum AbvLevel {
4+
L1(1, 0, 10, "/img/grade/1.png"),
5+
L2(2, 11, 25, "/img/grade/2.png"),
6+
L3(3, 26, 45, "/img/grade/3.png"),
7+
L4(4, 46, 65, "/img/grade/4.png"),
8+
L5(5, 66, 85, "/img/grade/5.png"),
9+
L6(6, 86, 100, "/img/grade/6.png");
10+
11+
public final int code;
12+
public final int min, max;
13+
public final String imagePath;
14+
15+
AbvLevel(int code, int min, int max, String imagePath) {
16+
this.code = code;
17+
this.min = min;
18+
this.max = max;
19+
this.imagePath = imagePath;
20+
}
21+
22+
public static AbvLevel of(int percent) {
23+
for (var lv : values()) {
24+
if (percent >= lv.min && percent <= lv.max) return lv;
25+
}
26+
return L1; // 기본값
27+
}
28+
}

0 commit comments

Comments
 (0)