zoukankan      html  css  js  c++  java
  • shop--8.商品类别--辅助工具

    ProductCategoryEnum

    public enum ProductCategoryEnum {
        SUCCESS(1, "创建成功"), INNER_ERROR(-1001, "操作失败"), EMPTY_LIST(-1002, "添加数少于1");
    
        private int state;
        private String stateInfo;
    
        private ProductCategoryEnum(int state, String stateInfo) {
            this.state = state;
            this.stateInfo = stateInfo;
        }
    
        public int getState() {
            return state;
        }
    
        public String getStateInfo() {
            return stateInfo;
        }
    
        /**
         * 依据传入的state返回相应的enum值
         */
        public static ProductCategoryEnum stateof(int state){
            for(ProductCategoryEnum s : values()){
                if(s.getState() == state){
                    return s;
                }
            }
            return null;
        }
    }
    

      

    ProductCategoryException

    public class ProductCategoryException extends RuntimeException{
        private static final long serialVersionUID = 3278462788156006845L;
    
        public ProductCategoryException(String message) {
            super( message );
        }
    }
    

      

    ProductCategoryExecution

    public class ProductCategoryExecution {
        private int state;
        private String stateInfo;
        private List<ProductCategory> productCategoryList;
    
        public ProductCategoryExecution() {
        }
    
        //操作失败时,使用的构造器
        public ProductCategoryExecution(ProductCategoryEnum stateEnum ){
            this.state = stateEnum.getState();
            this.stateInfo = stateEnum.getStateInfo();
        }
    
        //操作成功时,使用的构造器
        public ProductCategoryExecution(ProductCategoryEnum stateEnum, List<ProductCategory> productCategoryList){
            this.state = stateEnum.getState();
            this.stateInfo = stateEnum.getStateInfo();
            this.productCategoryList = productCategoryList;
        }
    
        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 List<ProductCategory> getProductCategoryList() {
            return productCategoryList;
        }
    
        public void setProductCategoryList(List<ProductCategory> productCategoryList) {
            this.productCategoryList = productCategoryList;
        }
    }
    

      

  • 相关阅读:
    PHP里json_encode()与json_decod()区别
    数组进行排序
    tp5利用自带上传类实现单个文件与多文件上传
    mkdir() Permission denied 报错问题
    如何快速熟悉新项目的代码?
    Tp5自定义路径写入日志
    spring解决循环依赖
    spring注解的使用
    ssm的整合
    编程知识总结
  • 原文地址:https://www.cnblogs.com/SkyeAngel/p/8916377.html
Copyright © 2011-2022 走看看