package com.engine.kq.biz;

import weaver.cache.CacheBase;
import weaver.cache.CacheColumn;
import weaver.cache.CacheColumnType;
import weaver.cache.PKColumn;

/**
 * 出差规则缓存类
 */
public class KQTravelRulesComInfo extends CacheBase {

    /**
     * 数据来源
     */
    protected static String TABLE_NAME = "kq_TravelRules";
    /**
     * sql中的where信息，不要以where开始
     */
    protected static String TABLE_WHERE = " (isDelete is null or isDelete<>1) ";
    /**
     * sql中的order by信息，不要以order by开始
     */
    protected static String TABLE_ORDER = "id";

    /** 主键ID */
    @PKColumn(type = CacheColumnType.NUMBER)
    protected static String PK_NAME = "id";

    /**
     * 获取最小出差单位
     * 1-按天出差
     * 2-按半天出差
     * 3-按小时出差
     * 4-按整天出差
     * 其他：无效数据
     */
    @CacheColumn(name = "minimumUnit")
    protected static int minimumUnit;

    /**
     * 获取换算比例
     * 当公出单位由天、半天、整天切换成小时或者由小时切换成天、半天、整天时，历史数据会按照此换算比例自动进行换算
     */
    @CacheColumn(name = "proportion")
    protected static int proportion;

    /**
     * 获取计算出差时长方式
     * 1-按工作日计算出差时长
     * 2-按自然日计算出差时长
     * 其他：无效数据
     */
    @CacheColumn(name = "computingMode")
    protected static int computingMode;

    /**
     * 获取日折算时长
     * 只有当按天出差、按半天出差、按整天出差并且按照自然日计算出差时长的时候才有效
     * -1：无效数据
     */
    @CacheColumn(name = "hoursToDay")
    protected static int hoursToDay;

    /**
     * 半天单位 时间选择方式：1-下拉框选择 、2-具体时间
     */
    @CacheColumn(name = "timeselection")
    protected static int timeselection;

    public String getId() {
        return (String) getRowValue(PK_INDEX);
    }

    public String getMinimumUnit() {
        return (String) getRowValue(minimumUnit);
    }

    public String getMinimumUnit(String key) {
        return (String) getValue(minimumUnit, key);
    }

    public String getProportion() {
        return (String) getRowValue(proportion);
    }

    public String getProportion(String key) {
        return (String) getValue(proportion, key);
    }

    public String getComputingMode() {
        return (String) getRowValue(computingMode);
    }

    public String getComputingMode(String key) {
        return (String) getValue(computingMode, key);
    }

    public String getHoursToDay() {
        return (String) getRowValue(hoursToDay);
    }

    public String getHoursToDay(String key) {
        return (String) getValue(hoursToDay, key);
    }

    public String getTimeSelection() {
        String value = (String) getRowValue(timeselection);
        if (value == null || value.equals("")) {
            value = "1";
        }
        return value;
    }

    public String getTimeSelection(String key) {
        String value = (String) getValue(timeselection, key);
        if (value == null || value.equals("")) {
            value = "1";
        }
        return value;
    }
}
