public enum AdminType {
COMMON(0, "普通管理员"),
SUPER(1, "超级管理员"),
MANAGER(2, "客户经理");
private Integer code;
private String message;
AdminType(Integer code, String message){
this.code = code;
this.message = message;
}
public enum City {
//1.定义枚举值的列表
HaErBing(1, "哈尔滨市"),
QiQiHaEr(2, "齐齐哈尔市"),
MuDanJiang(3, "牡丹江市"),
JiaMuSi(4, "佳木斯市"),
DaQing(5, "大庆市"),
JiXi(6, "鸡西市"),
ShuangYaShan(7, "双鸭山市"),
YiChun(8, "伊春市"),
QiTaiHe(9, "七台河市"),
HeGang(10, "鹤岗市"),
HeiHe(11, "黑河市"),
SuiHua(12, "绥化市"),
DaXingAnLing(13, "大兴安岭地区");
//2.定义成员变量
private Integer code;
private String name;
//3.构造函数
City(Integer code, String name){
this.code = code;
this.name = name;
}
//4.将枚举值列表转换为Map对象
public static Map<Integer, String> toMap(){
Map<Integer, String> map = new HashMap<Integer, String>();
for(City item : City.values())
map.put(item.getCode(), item.getName());
return map;
}
//省略属性的getter和setter方法
public enum FormValidate {
MOBILE_PHONE("mobile", "^1[3-8][0-9]{9}$", "不是有效的手机号码!"),
EMAIL_ADDRESS_REGEX("email", "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", "不是有效的邮箱地址!"),
CHINESE_LOWER_UPPER_UNDERLINE_NUMBER_REGEX("chinese", "^[\u4E00-\u9FA5A-Za-z0-9_]+$", "只能由汉字、英文字符、下划线或数字组成!"),
LOWER_UPPER_UNDERLINE_NUMBER_REGEX("english", "^[A-Za-z0-9_]+$", "只能字母、数字或下划线组成!"),
NUMBER_REGEX("number", "^\\d+$", "只能由数字组成!"),
NON_NEGATIVE_REGEX("positive_num", "^[1-9]\\d*|0$", "只能是非负正数!")
;
//验证类型
private String validate_type;
//验证的正则表达式
private String validate_pattern;
//验证错误时返回的结果
private String result_message;
//构造函数
FormValidate(String validate_type, String validate_pattern,String result_message) {
this.validate_type = validate_type;
this.validate_pattern = validate_pattern;
this.result_message = result_message;
}
public static Map<String, String> toPatternMap(){
Map<String, String> map = new HashMap<String, String>();
for(FormValidate item : FormValidate.values())
map.put(item.getValidate_type() , item.getValidate_pattern());
return map;
}
public static Map<String, String> toMessageMap(){
Map<String, String> map = new HashMap<String, String>();
for(FormValidate item : FormValidate.values())
map.put(item.getValidate_type() , item.getResult_message());
return map;
}
//各属性的getter和setter方法
public enum NumOfMonth {
ONE(1, "1个月"),
TWO(2, "2个月"),
THREE(3, "3个月"),
FOUR(4, "4个月"),
FIVE(5, "5个月"),
SIX(6, "6个月"),
SEVEN(7, "7个月"),
EIGHT(8, "8个月"),
NINE(9, "9个月"),
TEN(10, "10个月"),
ELEVEN(11, "11个月"),
TWELVE(12, "12个月"),
;
private Integer code;
private String message;
NumOfMonth(Integer code, String message){
this.code = code;
this.message = message;
}
public static Map<Integer, String> toMap(){
Map<Integer, String> map = new HashMap<Integer, String>();
for(NumOfMonth item : NumOfMonth.values())
map.put(item.getCode(), item.getMessage());
return map;
}
//各属性的getter和setter方法
public enum OtherPayTypes {
NONE(0,"none","未选择支付方式"),
CMPAY(1, "cmpay","和包"),
ALIPAY(2, "alipay","支付宝"),
TENPAY(3,"tenpay","财付通"),
WECHATPAY(4,"wechatpay","微信支付"),
UnionPay(5, "unionpay", "银联"),
BANK(6, "bank", "银行"),
OTHER(7, "other", "其他"),
BAITIAO(8, "blankNote","打白条");
private Integer code;
private String message;
private String name;
OtherPayTypes(Integer code, String message,String name){
this.code = code;
this.message = message;
this.name = name;
}
public static Map<Integer, String> toMap(){
Map<Integer, String> map = new HashMap<Integer, String>();
for(OtherPayTypes item : OtherPayTypes.values())
map.put(item.getCode(), item.getMessage());
return map;
}
//各属性的setter和getter方法
public enum RoleStatus {
ENABLE(0, "启用"),
DISABLE(1, "禁用");
public enum ProductStatus {
OFF(0,"下架"),
NORMAL(1, "上架");