All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.lkk.web.util.Consts Maven / Gradle / Ivy

The newest version!
package cn.lkk.web.util;

import javax.annotation.PostConstruct;

import org.springframework.stereotype.Component;

import cn.hutool.core.util.URLUtil;
import cn.lkk.web.exception.DataModelException;
import lombok.Getter;

/**
 * @author wangfujun
 * @date 2018/12/18
 */
public class Consts {

    public static final String BREAKLINE = System.getProperty("line.separator");
    public static final String TABLELINE = "\t";

    public class Structure {

        /**
         * 一般组件可选的参数
         */
    }

    public class SysParam {
        public static final String FILENAME = "fileName";
        public static final String VIEWNAME = "viewName";
        public static final String DATASET = "dataSet";
        public static final String USER = "systemUser";
        public static final String SYSTEMINFO = "systemInfo";
        public static final String SYSTEMAUTH = "systemAuth";
        public static final String CONTEXTPATH = "ctx";
    }

    public class ViewParam {

        public static final String TITLE = "title";
        public static final String COMPONENT = "component";
        public static final String BODY = "body";
        public static final String DATABIND = "dataBind";
        public static final String FKDATABIND = "fkDataBind";
        public static final String DBPOOL = "dbPool";
    }

    public class ComponentParam {

        public static final String CSS = "css";
        public static final String CSSLINK = "cssLink";
        public static final String JS = "js";
        public static final String JSLINK = "jsLink";
        public static final String AFTERBODY = "afterBody";
        public static final String BEFOREBODY = "beforeBody";
        public static final String BODY = "body";
        public static final String COMPRO = "_comPro";

        public static final String VIEW = "view";
        public static final String LABEL = "label";
        public static final String LAYOUT_MANAGER = "layoutManager";
        public static final String LAYOUT_PROPERTIES = "layoutManager-properties";
        public static final String COMPOENT = "component";
    }

    public class DataSetParam {

        // SQL
        public static final String SQL = "sql";
        public static final String DATASOURCE = "dataSource";
        public static final String ISSPLITEPAGE = "isSplitPage";
        public static final String ISSPLITEPAGE_CURPAGE = "page";
        public static final String ISSPLITEPAGE_PAGESIZE = "limit";

        // COMMON
        public static final String CONVERT = "convert";
        public static final String ADAPTER = "adapter";
        public static final String TABLENAME = "tableName";
        public static final String PKNAME = "pkName";
    }

    public class ActionParam {
        public static final String ACTION = "action";
    }

    public class ActionHandlerParam {
        public static final String METHOD = "__method";
        public static final String ACTION = "__action";
    }

    @Component
    public static class Path {
        private static String SYS_TEMPLATE_ROOT = "/templates/sys/";

        // @Value("${app.ui}")
        private String UI_ROOT = "smart/";

        @PostConstruct
        private void getFootPath() {
            SYS_TEMPLATE_ROOT += UI_ROOT;
        }

        public static String getSysTemplate(String fileName) {
            return SYS_TEMPLATE_ROOT.concat(fileName);
        }

        public static String getClassTemplate(Class clazz) {
            try {
                String path = clazz.getResource(clazz.getSimpleName() + ".xml").getPath();
                if (path.contains("%")) {
                    return URLUtil.decode(path);
                } else {
                    return path;
                }
            } catch (Exception ex) {
                throw new DataModelException(ex);
            }
        }
    }

    public class DataBind {
        public static final String FIELD = "field";
        public static final String DEFAULT_PK = "id";
        public static final String VALUE = "value";
        public static final String TYPE = "type";
        public static final String SKIP = "skip";
    }

    public class FkDataBind {
        public static final String DATASOURCE = "dataSource";
        public static final String FKKEY = "fkKey";
        public static final String FKFIELD = "fkField";
        public static final String VALUE = "value";
        public static final String DATABIND = "dataBind";
    }

    public class ConvertType {
        public static final String TABLE = "table";
        public static final String NUMBER = "number";
        public static final String DATE = "date";
        public static final String TEMPLATE = "template";
    }

    public class AdapterType {
        public static final String TREE = "tree";
    }

    @Getter
    public enum ResultEnum {
        SUCCESS(0, "成功"), ERROR(500, "错误");

        private Integer code;

        private String message;

        ResultEnum(Integer code, String message) {
            this.code = code;
            this.message = message;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy