shop--6.店铺注册--Dto的ShopExection(不知道有什么用)
创建Enum类ShopStateEnum
用来表示店铺的状态
public enum ShopStateEnum { CHECK(0, "审核中"), OFFLINE(-1, "非法店铺"), NULL_SHOPID(-1002, "shopId为空"), SUCCESS(1, "操作成功"), PASS(2, "认证通过"), INNER_ERROR(-1001, "系统内部错误"); private int state; private String stateInfo; public int getState() { return state; } public String getStateInfo() { return stateInfo; } private ShopStateEnum(int state, String stateInfo) { this.state = state; this.stateInfo = stateInfo; } /** * 依据传入的state返回相应的enum值 */ public static ShopStateEnum stateOf(int state){ for(ShopStateEnum stateEnum : values()){ if(stateEnum.getState() == state){ return stateEnum; } } return null; } }
dto中ShopExection类的创建
包含店铺的状态信息
店铺的数量
店铺的实体类
public class ShopExection { //店铺的状态 private int state; //店铺状态的描述 private String stateInfo; //店铺数量 private int count; //操作的店铺(增删改查时用到) private Shop shop; //店铺列表(查询店铺列表时用到) private List<Shop> shopList; public ShopExection() { } //店铺操作失败时使用的构造器 public ShopExection(ShopStateEnum shopStateEnum){ this.state = shopStateEnum.getState(); this.stateInfo = shopStateEnum.getStateInfo(); } //店铺操作成功时使用的构造器 public ShopExection(ShopStateEnum shopStateEnum, Shop shop){ this.state = shopStateEnum.getState(); this.stateInfo = shopStateEnum.getStateInfo(); this.shop = shop; } //店铺操作成功时使用的构造器 public ShopExection(ShopStateEnum shopStateEnum, List<Shop> shopList){ this.state = shopStateEnum.getState(); this.stateInfo = shopStateEnum.getStateInfo(); this.shopList = shopList; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getStateInfo() { return stateInfo; } public void setStateInfo(String stateInfo) { this.stateInfo = stateInfo; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public Shop getShop() { return shop; } public void setShop(Shop shop) { this.shop = shop; } public List<Shop> getShopList() { return shopList; } public void setShopList(List<Shop> shopList) { this.shopList = shopList; } }