zoukankan      html  css  js  c++  java
  • shop--10.商品--添加操作--状态类、枚举类等

    ProductStateEnum

    public enum ProductStateEnum {
        SUCCESS(1, "插入成功"), INNER_ERROR(-1001, "操作失败"),NULL_PRODUCT(-1003,"店铺信息为空");
         
        private int state;
        private String stateInfo;
     
        ProductStateEnum(int state, String stateInfo) {
            this.state = state;
            this.stateInfo = stateInfo;
        }
         
        public int getState() {
            return state;
        }
     
        public String getStateInfo() {
            return stateInfo;
        }
    }

    ProductOperationException

    public class ProductOperationException extends RuntimeException {
        
     
        /**
         * 
         */
        private static final long serialVersionUID = 3731627180676484075L;
    
        public ProductOperationException(String message) {
            super( message );
        }
    }

    ProductExecution

    public class ProductExecution {
        //结果状态
        private int state;
        //状态标识
        private String stateInfo;
        //商品数量
        private int count;
        //操作的product(增删改商品的时候用)
        private Product product;
        //获取的product列表(查询商品列表的时候用)
        private List<Product> productList;
     
        public ProductExecution(){
     
        }
        //操作失败的构造器
        public ProductExecution(ProductStateEnum productStateEnum) {
            this.state = productStateEnum.getState();
            this.stateInfo = productStateEnum.getStateInfo();
        }
     
     
        //操作成功的构造器1  单个商品
        public ProductExecution(ProductStateEnum productStateEnum, Product product){
            this.state = productStateEnum.getState();
            this.stateInfo = productStateEnum.getStateInfo();
            this.product = product;
        }
     
        //操作成功的构造器2  多个商品
        public ProductExecution(ProductStateEnum productStateEnum, List<Product> productList){
            this.state = productStateEnum.getState();
            this.stateInfo = productStateEnum.getStateInfo();
            this.productList = productList;
        }
     
     
        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 Product getProduct() {
            return product;
        }
     
        public void setProduct(Product product) {
            this.product = product;
        }
     
        public List<Product> getProductList() {
            return productList;
        }
     
        public void setProductList(List<Product> productList) {
            this.productList = productList;
        }
    }
  • 相关阅读:
    (转)python字符串函数
    分享二:架构设计分享一:关于API分布式服务提供方式
    架构设计分享一:关于分布式系统的数据一致性问题(一)
    分享四:分布式事务设计-两段式提交
    分享三:mysql跨库查询
    PHP笔试题
    我的mysql学习心得
    linux分享一:进程全攻略--守护进程(服务)
    分享二:签名原理与算法
    linux命令详解:pgrep命令
  • 原文地址:https://www.cnblogs.com/windbag7/p/9412331.html
Copyright © 2011-2022 走看看