private Status orderStatus; @EnumMapping(nameValuePairs="DELETE_ALREADY=0,WAIT_PAYED=1,LOSE_EFFICACY=2,WAIT_DELIVER=3,DELIVER_ALREADY=6") public enum Status { DELETE_ALREADY(0,"DELETE_ALREADY","已删除"),WAIT_PAYED(1,"WAIT_PAYED","等待付款"),LOSE_EFFICACY(2,"LOSE_EFFICACY","已失效") ,WAIT_DELIVER(3,"WAIT_DELIVER","等待发货"),DELIVER_ALREADY(6,"DELIVER_ALREADY","商家已发货"); Integer id; String name; String desc; Status(Integer id, String name, String desc){ this.id = id; this.name = name; this.desc = desc; } public Integer getId() { return id; } public String getName() { return name; } public String getDesc() { return desc; } }可以使用对象名.getOrderStatus().getDesc();来获取中文描述
ORM框架中用枚举类型enum来接收数据库中的tinyint字段
直接上代码吧