package cn.estsh.i3plus.pojo.base.enumutil;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

/**
 * @Description : 模块表单枚举类
 * @Reference :
 * @Author : alwaysfrin
 * @CreateDate : 2018-12-25 21:08
 * @Modify:
 **/
public class BlockFormEnumUtil {

    /**
     * 原数据类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum FORM_TABLE_TYPE {
        TABLE(1, "TABLE", "表"),
        VIEW(2, "VIEW", "视图");

        private int value;
        private String code;
        private String description;

        private FORM_TABLE_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.toLowerCase().equals(code.toLowerCase())) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static FORM_TABLE_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 原数据状态
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum FORM_TABLE_STATUS {
        SYNCHRONOUS_UNDONE(1, "未完成", "未同步"),
        SYNCHRONOUS_COMPLETE(2, "已完成", "已同步");

        private int value;
        private String code;
        private String description;

        private FORM_TABLE_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code.toLowerCase())) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static FORM_TABLE_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 行信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum TABLE_ROW_PICK {
        SINGLE(1, "single", "单选"),
        MULTI(2, "multi", "多选");

        private int value;
        private String code;
        private String description;

        private TABLE_ROW_PICK(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static TABLE_ROW_PICK valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 显示行号信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum TABLE_ROW_NUMBER {
        SHOW(1, "show", "显示"),
        HIDE(2, "hide", "隐藏");

        private int value;
        private String code;
        private String description;

        private TABLE_ROW_NUMBER(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static TABLE_ROW_NUMBER valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }
    /**
     * 元素属性显示状态信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_SHOW_STATUS {
        ON(1, "ON", "开启"),
        OFF(2, "OFF", "关闭");

        private int value;
        private String code;
        private String description;

        private ELEMENT_SHOW_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_SHOW_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素新增信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_ADD_STATUS {
        ON(1, "ON", "开启"),
        OFF(2, "OFF", "关闭");

        private int value;
        private String code;
        private String description;

        private ELEMENT_ADD_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_ADD_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素编辑信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_EDIT_STATUS {
        ON(1, "ON", "开启"),
        OFF(2, "OFF", "关闭");

        private int value;
        private String code;
        private String description;

        private ELEMENT_EDIT_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_EDIT_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_TYPE {
        GRID(1, "TABLE", "表格"),
        TREE(2, "TREE", "树");

        private int value;
        private String code;
        private String description;

        private ELEMENT_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素删除信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_DEL_STATUS {
        ON(1, "ON", "开启"),
        OFF(2, "OFF", "关闭");

        private int value;
        private String code;
        private String description;

        private ELEMENT_DEL_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_DEL_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素查询信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_FIND_STATUS {
        ON(1, "ON", "开启"),
        OFF(2, "OFF", "关闭");

        private int value;
        private String code;
        private String description;

        private ELEMENT_FIND_STATUS(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_FIND_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }


    /**
     * 属性字段排序规则
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PROPERTY_ORDER_BY {
        ASC(1, "ASC", "升序"),
        DESC(2, "DESC", "降序");

        private int value;
        private String name;
        private String description;

        PROPERTY_ORDER_BY(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getName() {
            return name;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].getName();
                }
            }
            return tmp;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 虚拟类型信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PROPERTY_VIRTUAL_OPERATE_TYPE {
        STRING_SPLICE(10, "SPLICE", "字符串拼接",String.class),
        NUM_ADD(20, "ADD", "加法计算",Double.class),
        NUM_LESS(30, "MIN", "减法计算",Double.class),
        NUM_MAKE(40, "MUL", "乘法计算",Double.class),
        NUM_DIVISION(50, "DIVISION", "除法计算",Double.class),
        JOIN_TABLE(60, "JOIN_TABLE", "连表查询",String.class);

        private int value;
        private String code;
        private String description;
        private Class clzFullName;

        private PROPERTY_VIRTUAL_OPERATE_TYPE(int value, String code, String description,Class clzFullName) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.clzFullName = clzFullName;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public Class getClzFullName() {
            return clzFullName;
        }

        public void setClzFullName(Class clzFullName) {
            this.clzFullName = clzFullName;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static PROPERTY_VIRTUAL_OPERATE_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public Object getPropertyVirtual(Object ... objs){
            if(this.getValue() == STRING_SPLICE.getValue()){
                return getPropertyVirtualString(objs);
            }else if(this.getValue() == NUM_ADD.getValue()){
                return getPropertyVirtualDoubleAdd(objs);
            }else if(this.getValue() == NUM_LESS.getValue()){
                return getPropertyVirtualDoubleLess(objs);
            }else if(this.getValue() == NUM_MAKE.getValue()){
                return getPropertyVirtualDoubleMake(objs);
            }else if(this.getValue() == NUM_DIVISION.getValue()){
                return getPropertyVirtualDoubleDivision(objs);
            }
            return objs;
        }

        private String getPropertyVirtualString(Object ... objs){
            if(objs != null && objs.length > 0){
                StringBuffer result = new StringBuffer();
                for (Object o : objs) {
                    result.append(o == null ? "" : o.toString());
                }
                return result.toString();
            }
            return null;
        }

        private Double getPropertyVirtualDoubleAdd(Object ... objs){
            if(objs != null && objs.length > 0){
                Double result = new Double(0);
                for (Object o : objs) {
                    try {
                        if(o != null){
                            result += Double.parseDouble(o.toString());
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }
                return result;
            }
            return null;
        }

        private Double getPropertyVirtualDoubleLess(Object ... objs){
            if(objs != null && objs.length > 0){
                Double result = new Double(0);
                for (Object o : objs) {
                    try {
                        if(o != null){
                            result -= Double.parseDouble(o.toString());
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }
                return result;
            }
            return null;
        }

        private Double getPropertyVirtualDoubleMake(Object ... objs){
            if(objs != null && objs.length > 0){
                Double result = new Double(0);
                for (Object o : objs) {
                    try {
                        if(o != null){
                            result *= Double.parseDouble(o.toString());
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }
                return result;
            }
            return null;
        }

        private Double getPropertyVirtualDoubleDivision(Object ... objs){
            if(objs != null && objs.length > 0){
                Double result = new Double(0);
                for (Object o : objs) {
                    try {
                        if(o != null){
                            result /= Double.parseDouble(o.toString());
                        }
                    }catch (Exception e){
                        e.printStackTrace();
                    }
                }
                return result;
            }
            return null;
        }
    }



    /**
     * 执行类型信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum EXECUTION_TYPE {
        SQL(10, "SQL", "SQL脚本"),
        CLASS_METHOD(20, "ClassMethod", "类方法"),
        SYSTEM_JAVA(30, "SystemClassMethod", "系统类方法"),
        SCRIPT(40, "Script", "脚本");

        private int value;
        private String code;
        private String description;

        private EXECUTION_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static EXECUTION_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 拦截器类型信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum INTERCEPT_TYPE {
        ELEMENT_ADD(10, "ELEMENT_ADD", "元素新增"),
        ELEMENT_EDIT(20, "ELEMENT_EDIT", "元素修改"),
        ELEMENT_DEL(30, "ELEMENT_DEL", "元素删除"),
        ELEMENT_FIND(40, "ELEMENT_FIND", "元素查询"),
        CUSTOM_BUTTON(50, "CUSTOM_BUTTON", "自定义按钮");

        private int value;
        private String code;
        private String description;

        private INTERCEPT_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static INTERCEPT_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 拦截器位置信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum INTERCEPT_POSITION {
        BEFORE_EXECUTION(10, "BEFORE", "执行前"),
        AFTER_SUCCESS(20, "AFTER_SUCCESS", "执行成功后"),
        AFTER_FAIL(30, "AFTER_FAIL", "执行失败后");

        private int value;
        private String code;
        private String description;

        private INTERCEPT_POSITION(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static INTERCEPT_POSITION valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 拦截器业务结果处理信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum INTERCEPT_PROCESS_RESULT {
        CONTINUE_AFTER_SUCCESS(10, "CONTINUE_AFTER_SUCCESS", "成功后继续"),
        STOP_AFTER_SUCCESS(20, "STOP_AFTER_SUCCESS", "成功后停止"),
        CONTINUE_AFTER_FAIL(30, "CONTINUE_AFTER_FAIL", "失败后继续"),
        CONTINUE_AFTER_STOP(40, "CONTINUE_AFTER_STOP", "失败后停止");

        private int value;
        private String code;
        private String description;

        private INTERCEPT_PROCESS_RESULT(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static INTERCEPT_PROCESS_RESULT valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 表单功能明细 触发信息
     * <per>
     * onclick      script     元素上发生鼠标点击时触发。
     * ondblclick   script     元素上发生鼠标双击时触发。
     * ondrag       script     元素被拖动时运行的脚本。
     * ondragend    script     在拖动操作末端运行的脚本。
     * ondragenter  script     当元素元素已被拖动到有效拖放区域时运行的脚本。
     * ondragleave  script     当元素离开有效拖放目标时运行的脚本。
     * ondragover   script     当元素在有效拖放目标上正在被拖动时运行的脚本。
     * ondragstart  script     在拖动操作开端运行的脚本。
     * ondrop       script     当被拖元素正在被拖放时运行的脚本。
     * onmousedown  script     当元素上按下鼠标按钮时触发。
     * onmousemove  script     当鼠标指针移动到元素上时触发。
     * onmouseout   script     当鼠标指针移出元素时触发。
     * onmouseover  script     当鼠标指针移动到元素上时触发。
     * onmouseup    script     当在元素上释放鼠标按钮时触发。
     * onmousewheel script     当鼠标滚轮正在被滚动时运行的脚本。
     * onscroll     script     当元素滚动条被滚动时运行的脚本。
     * </per>
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum TRIGGER_EVENT {
        CLICK(10, "CLICK", "单击");
//        DB_LCLICK(20, "DB_LCLICK", "双击"),
//        MOUSE_OUT(30, "MOUSE_OUT", "鼠标指针移出"),
//        MOUSE_OVER(40, "MOUSE_OVER", "鼠标指针移入");

        private int value;
        private String code;
        private String description;

        private TRIGGER_EVENT(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static TRIGGER_EVENT valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 表单功能明细 触发效果信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum BUTTON_TRIGGER_EFFECT {
        DIALOG(10, "DIALOG", "弹出窗口"),
        NEW_WINDOW(20, "NEW_WINDOW", "新开窗口"),
        SQL(30, "SQL", "执行SQL"),
        CLASS_METHOD(40, "CLASS_METHOD", "执行类方法");

        private int value;
        private String name;
        private String description;

        BUTTON_TRIGGER_EFFECT(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getName() {
            return name;
        }

        public static BUTTON_TRIGGER_EFFECT valueOf(int val) {
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * SQL 连接关系信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum SQL_REF_TYPE {
        GT(1, ">", "大于"),
        GT_EQUAL(2, ">=", "大于等于"),
        LT(3, "<", "小于等于"),
        LT_EQUAL(4, "<=", "小于等于"),
        EQUAL(5, "=", "等于"),
        EQUAL_NOT(6, "<>", "不等于");

        private int value;
        private String name;
        private String description;

        SQL_REF_TYPE(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getName() {
            return name;
        }

        public static SQL_REF_TYPE valueOf(int val) {
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 菜单类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum MENU_TYPE {
        FORM_METHOD(1, "FORM_METHOD", "表单功能"),
        OUTER_CHAIN(2, "OUTER_CHAIN", "外链");

        private int value;
        private String name;
        private String description;

        MENU_TYPE(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getName() {
            return name;
        }

        public static MENU_TYPE valueOf(int val) {
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 数据状态
     *  1 启用
     *  2 禁用
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DATA_STATUS {
        ENABLE(1, "启用", "fa fa-success cell-fa fa-check"),
        DISABLE(2, "禁用", "fa fa-disabled cell-fa fa-times-circle");

        private int value;
        private String name;
        private String description;

        DATA_STATUS() {
        }

        DATA_STATUS(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getName() {
            return name;
        }

        public static String valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].getName();
                }
            }
            return tmp;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }


    /**
     * 按钮位置类型
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum BUTTON_POSITION_TYPE {
        FORM_METHOD(1, "FORM_METHOD", "表单功能"),
        FORM_METHOD_DETAIL(2, "FORM_ETHOD_DETAIL", "表单功能明细");

        private int value;
        private String name;
        private String description;

        BUTTON_POSITION_TYPE(int value, String name, String description) {
            this.value = value;
            this.name = name;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }

        public String getName() {
            return name;
        }

        public static BUTTON_POSITION_TYPE valueOf(int val) {
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static int descOf(String desc) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].name.equals(desc)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素树方向
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum ELEMENT_TREE_DIRECTION {
        horizontal(1, "horizontal", "横向"),
        vertical(2, "vertical", "竖向");

        private int value;
        private String code;
        private String description;

        private ELEMENT_TREE_DIRECTION (int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static ELEMENT_TREE_DIRECTION  valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 数据库连接方式
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DATA_SOURCE_TYPE {
        SOURCE_MARIA_DB(100, "MariaDB", "MariaDB 10.1","com.mysql.jdbc.Driver",3306,null),
        SOURCE_SQL_SERVER(200, "SQL Server", "SQL Server 2017","com.microsoft.sqlserver.jdbc.SQLServerDriver",1433,"dbo"),
        SOURCE_ORACLE(300, "Oracle", "Oralce 12C","oracle.jdbc.driver.OracleDriver",1521,null),
        SOURCE_POSTGRE_SQL(400, "PostgreSql", "PostgreSql 10.5","org.postgresql.Driver",5432,"public");

        private int value;
        private String code;
        private String description;
        private String driverClassName;
        private int defaultPort;
        private String defaultSchemaPattern;

        private DATA_SOURCE_TYPE (int value, String code, String description,String driverClassName,int port,String defaultSchemaPattern) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.driverClassName = driverClassName;
            this.defaultPort = port;
            this.defaultSchemaPattern = defaultSchemaPattern;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public String getDriverClassName() {
            return driverClassName;
        }

        public int getDefaultPort() {
            return defaultPort;
        }

        public String getDefaultSchemaPattern() {
            return defaultSchemaPattern;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static DATA_SOURCE_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public String getJDBCUrl(String database,String host,Integer port){
            if(this.getValue() == SOURCE_MARIA_DB.getValue()){
                return getJDBCUrlMySQL(database,host,port);
            }else if(this.getValue() == SOURCE_ORACLE.getValue()){
                return getJDBCUrlOracle(database,host,port);
            }else if(this.getValue() == SOURCE_POSTGRE_SQL.getValue()){
                return getJDBCUrlPostgreSQL(database,host,port);
            }else if(this.getValue() == SOURCE_SQL_SERVER.getValue()){
                return getJDBCUrlSQLServer(database,host,port);
            }
            return null;
        }

        public static DATA_SOURCE_TYPE getDataSourceURL(String databaseProductName){
            if(StringUtils.isNotBlank(databaseProductName)){
                if(databaseProductName.indexOf(":mysql:") != -1){
                    return SOURCE_MARIA_DB;
                }else if(databaseProductName.indexOf(":oracle:") != -1){
                    return SOURCE_ORACLE;
                }else if(databaseProductName.indexOf(":postgresql:") != -1){
                    return SOURCE_POSTGRE_SQL;
                }else if(databaseProductName.indexOf(":sqlserver:") != -1){
                    return SOURCE_SQL_SERVER;
                }
            }
            return null;
        }

        private String getJDBCUrlMySQL(String database,String host,Integer port){
            return "jdbc:mysql://"+host+":"+port+"/"+database+"?autoReconnect=true&useSSL=false&characterEncoding=utf-8";
        }

        private String getJDBCUrlOracle(String database,String host,Integer port){
            return "jdbc:oracle:thin:@"+host+":"+port+":"+database;
        }

        private String getJDBCUrlPostgreSQL(String database,String host,Integer port){
            return "jdbc:postgresql://"+host+":"+port+"/"+database;
        }

        private String getJDBCUrlSQLServer(String database,String host,Integer port){
            return "jdbc:sqlserver://" + host + ":" + port + ";database=" + database;
        }
    }

    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum DATA_SOURCE_STATUS {
        CONN_SUCCESS(10, "连接成功", "连接成功"),
        CONN_FAILURE(20, "连接失败", "连接失败");
//        TIME_OUT(30, "连接超时", "连接超时"),
//        AUTH_ERROR(40, "账号密码错误", "账号密码错误");

        private int value;
        private String code;
        private String description;

        private DATA_SOURCE_STATUS (int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }



        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static DATA_SOURCE_STATUS valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 元素控件类型信息
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PROPERTY_CONTROL_TYPE {
        RADIO(100, "RADIO", "单选"),
        CHECKBOX(110, "CHECKBOX", "复选"),
        TEXT(200, "TEXT", "文本"),
        NUMBER(210, "NUMBER", "数字"),
        PASSWORD(230, "PASSWORD", "密码"),
        DATE_TIME(300, "DATE", "日期",SQL_WHERE.BETWEEN),
        //        DATE(300, "DATE", "日期(yyyy-MM-dd)"),
//        DATE_TIME(310, "DATE_TIME", "时间(yyyy-MM-dd hh:mm:ss)"),
        //        ELEMENT(700, "DICT_SELECT", "元素"),
        DICTIONARY(800, "DICT_SELECT", "字典"),
        CASCADE(900, "CASCADE", "级联");
        //FILE(400, "file", "文件"),
        //IMAGE(410, "image", "image"),
        //OFF(500, "color", "颜色"),

        private int value;
        private String code;
        private String description;

        /**
         * 默认查询关系
         */
        private SQL_WHERE defaultWhere;

        PROPERTY_CONTROL_TYPE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        PROPERTY_CONTROL_TYPE(int value, String code, String description, SQL_WHERE defaultWhere) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.defaultWhere = defaultWhere;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public SQL_WHERE getDefaultWhere() {
            return defaultWhere;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static PROPERTY_CONTROL_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 条件运算符
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum SQL_WHERE {
        EQUAL(1, "=", "等于"),
        NOT_EQUAL(2, "<>", "不等于"),
        MORE(3, ">", "大于"),
        LESS(4, "<", "小于"),
        MORE_OR_EQUAL(5, ">=", "大于等于"),
        LESS_OR_EQUAL (6, "<=", "小于等于"),
        LIKE(7, "LIKE", "全模糊"),
        START_LIKE(7, "LIKE", "前模糊"),
        END_LIKE(7, "LIKE", "后模糊"),
        IN(8, "in", "in"),
        BETWEEN(9, "BETWEEN", "区间查询(逗号区分)"),;

        private int value;
        private String code;
        private String description;

        private SQL_WHERE(int value, String code, String description) {
            this.value = value;
            this.code = code;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code.toLowerCase())) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static SQL_WHERE valueOf(int val) {
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }

    /**
     * 属性类型信息(属性转换器)
     * <per>
     * <br/>    Form 核心转换器
     * <br/>    数据库字段类型转换Java 属性类型
     * <br/>    Java 属性 转换为控件类型
     * </per>
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public enum PROPERTY_TYPE {
        STRING(10, "String", "字符串", "java.lang.String", String.class,PROPERTY_CONTROL_TYPE.TEXT,SQL_WHERE.LIKE,""),
        CHAR(11, "Character", "单字符", "java.lang.Character", Character.class,PROPERTY_CONTROL_TYPE.TEXT,SQL_WHERE.EQUAL,""),
        INTEGER(20, "Integer", "短整型", "java.lang.Integer", Integer.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL,"0"),
        LONG(21, "Long", "长整型", "java.lang.Long", Long.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL,"0"),
        DOUBLE(30, "Double", "大浮点型", "java.lang.Double", Double.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL,"0.0"),
        FLOAT(31, "Float", "小浮点型", "java.lang.Float", Float.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL,"0.0"),
        BIG_DECIMAL(32, "Double", "大浮点型", "java.math.BigDecimal", Double.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL,"0.0"),
        BOOLEAN(40, "Boolean", "布尔值", "java.lang.Boolean", Boolean.class,PROPERTY_CONTROL_TYPE.RADIO,SQL_WHERE.EQUAL,null),
        BYTE(50, "Byte", "字节", "java.lang.Byte", Byte.class,PROPERTY_CONTROL_TYPE.TEXT,SQL_WHERE.EQUAL,null),
        DATE_TIME(12, "String", "日期时分秒", "java.sql.Timestamp", String.class,PROPERTY_CONTROL_TYPE.DATE_TIME,SQL_WHERE.BETWEEN,null,"yyyy-MM-dd hh:mm:ss");

        /**
         * 属性类型值
         */
        private int value;
        /**
         * 属性类型代码
         */
        private String code;
        /**
         * 属性类型描述
         */
        private String description;
        /**
         * 属性类型ClassPath
         */
        private String classPath;
        /**
         * 属性类型 Class
         */
        private Class clzFullName;
        /**
         *  属性类型 对应的 控件类型
         */
        private PROPERTY_CONTROL_TYPE controlType;

        /**
         * 默认查询关系
         */
        private SQL_WHERE defaultWhere;

        /**
         * 默认 格式化 方式
         */
        private String defaultFormat;

        /**
         * 默认查询关系
         */
        private String defaultValue;

        private PROPERTY_TYPE(int value, String code, String description,String classPath,Class clzFullName,
                              PROPERTY_CONTROL_TYPE controlType,SQL_WHERE defaultWhere) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.classPath = classPath;
            this.clzFullName = clzFullName;
            this.controlType = controlType;
            this.defaultWhere = defaultWhere;
        }

        private PROPERTY_TYPE(int value, String code, String description,String classPath,Class clzFullName,
                              PROPERTY_CONTROL_TYPE controlType,SQL_WHERE defaultWhere,String defaultValue) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.classPath = classPath;
            this.clzFullName = clzFullName;
            this.controlType = controlType;
            this.defaultWhere = defaultWhere;
            this.defaultValue = defaultValue;
            this.defaultFormat = defaultFormat;
        }

        private PROPERTY_TYPE(int value, String code, String description,String classPath,Class clzFullName,
                              PROPERTY_CONTROL_TYPE controlType,SQL_WHERE defaultWhere,String defaultValue,String defaultFormat) {
            this.value = value;
            this.code = code;
            this.description = description;
            this.classPath = classPath;
            this.clzFullName = clzFullName;
            this.controlType = controlType;
            this.defaultWhere = defaultWhere;
            this.defaultValue = defaultValue;
            this.defaultFormat = defaultFormat;
        }

        public int getValue() {
            return value;
        }

        public String getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public String getClassPath() {
            return classPath;
        }

        public Class getClzFullName() {
            return clzFullName;
        }

        public PROPERTY_CONTROL_TYPE getControlType() {
            return controlType;
        }

        public SQL_WHERE getDefaultWhere() {
            return defaultWhere;
        }

        public String getDefaultFormat() {
            return defaultFormat;
        }

        public String getDefaultValue() {
            return defaultValue;
        }

        public static String valueOfCode(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].code;
                }
            }
            return tmp;
        }

        public static PROPERTY_TYPE valueOfClzFullName(int val) {
            PROPERTY_TYPE tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i];
                }
            }
            return tmp;
        }


        public static PROPERTY_CONTROL_TYPE valueOfControlType(int val) {
            PROPERTY_CONTROL_TYPE tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].controlType;
                }
            }
            return tmp;
        }

        public static int codeOfValue(String code) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static int codeOfClzFullName(Class clzFullName) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].clzFullName.equals(clzFullName)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static int codeOfClassPath(String classPath) {
            int tmp = 1;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].classPath.equals(classPath)) {
                    tmp = values()[i].value;
                }
            }
            return tmp;
        }

        public static String valueOfDescription(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }

        public static PROPERTY_TYPE valueOfClassPath(String classPath) {
            PROPERTY_TYPE tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].classPath.equals(classPath)) {
                    tmp = values()[i];
                }
            }
            return tmp;
        }

        public static PROPERTY_TYPE valueOf(int val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].value == val) {
                    return values()[i];
                }
            }
            return null;
        }

        public static PROPERTY_TYPE indexOf(String val) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (val.indexOf(values()[i].value) >= 0) {
                    return values()[i];
                }
            }
            return null;
        }

        public static String codeOfDescription(String code) {
            String tmp = null;
            for (int i = 0; i < values().length; i++) {
                if (values()[i].code.equals(code)) {
                    tmp = values()[i].description;
                }
            }
            return tmp;
        }
    }
}
