package com.jiuqi.mobile.nigo.comeclose.bean.base; import com.jiuqi.mobile.nigo.comeclose.bean.app.collect.DealerServiceBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.collect.DrivingSchoolServiceBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.collect.GasStationServiceBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.collect.IntermediaryServiceBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.collect.PlantServiceBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.collect.RepairServiceBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.coop.CooperBean; import com.jiuqi.mobile.nigo.comeclose.bean.app.coop.SupplierBean; import com.jiuqi.mobile.nigo.comeclose.bean.master.DriverBean; import com.jiuqi.mobile.nigo.comeclose.bean.master.DriverOwnerBean; import com.jiuqi.mobile.nigo.comeclose.bean.master.OperateBean; import com.jiuqi.mobile.nigo.comeclose.bean.master.OrganizationBean; /** * 用户类型 * * @author modi * */ public enum UserType { /** * 未知角色 */ UnknowRole(-1, OrganizationBean.class, "未知角色"), /** * 组织机构管理员 */ Organization_Manager(1, OrganizationBean.class, "组织机构管理员"), /** * 组织机构操作员 */ Organization_Operator(2, OperateBean.class, "组织机构操作员"), /** * 合作社管理员 */ Cooperative(3, CooperBean.class, "合作社"), // /** // * 作业对管理员 // */ // WorkTeam(4, WorkTeamBean.class), // /** // * 跨区作业队管理员 // */ // CrossWorkTeam(5, CrossWorkTeamBean.class), /** * 机手 */ Driver(6, DriverBean.class, "机手"), /** * 机主 */ DriverOwner(61, DriverOwnerBean.class, "机主"), // 20130731 /** * 供货商 */ Supplier(20, SupplierBean.class, "供货商"), // /** * 经销商 */ Dealer(7, DealerServiceBean.class, "经销商"), /** * 驾校 */ DrivingSchool(8, DrivingSchoolServiceBean.class, "驾校"), /** * 加油站 */ GasStation(9, GasStationServiceBean.class, "加油站"), /** * 中介服务机构 */ Intermediary(10, IntermediaryServiceBean.class, "中介服务机构"), /** * 种植服务机构 */ Plant(11, PlantServiceBean.class, "种植服务机构"), /** * 修理站 */ Repair(12, RepairServiceBean.class, "维修点"), /** * 村委会 */ VillageCommittee(13, null, "村委会"), /** * 农机厂商 */ DriverSupplier(14, null, "农机厂商"), /** * 普通农户(农民) */ Peasant(15, null, "普通农户(农民)"), /** * 操作员 */ Operate(16, null, "操作员)"), /** * 审核人 */ Auditor(21, null, "审核人"), /** * 员工 */ employee(22, null, "员工"), /** * 网点 */ branch(23, null, "员工"); private int code; private Class<?> beanClass; private String name; private UserType(int code, Class<?> beanClass, String name) { this.code = code; this.beanClass = beanClass; this.name = name; } public int getCode() { return code; } public String getName() { return name; } public Class<?> getBeanClass() { return beanClass; } public static UserType getUserType(int code) { for (UserType type : UserType.values()) { if (type.getCode() == code) { return type; } } return null; } public static UserType getUserType(Class<?> beanClass) { for (UserType type : UserType.values()) { if (type.getBeanClass().equals(beanClass)) { return type; } } return null; } public static UserType getUserType(String name) { for (UserType type : UserType.values()) { if (type.getName().equalsIgnoreCase(name)) { return type; } } return null; } }