<?php
/**
 * Created by JetBrains PhpStorm.
 * User: user
 * Date: 15-6-5
 * Time: 上午11:43
 * To change this template use File | Settings | File Templates.
 */
class Service_OtherFeeConfigTable extends Common_Service
{
    private static $_model = NULL;

    private static function getModelInstance() {
        if (is_null(self::$_model)) {
            self::$_model = new Table_OtherFeeConfigTable();
        }

        return self::$_model;
    }

    /**
     * @see Table_Account::insert()
     */
    public static function add($data) {
        $model = self::getModelInstance();

        return $model->add($data);
    }

    public static function getByField($value, $field = 'ofct_id', $columns = "*"){
        $model = self::getModelInstance();
        return $model->getByField($value,$field,$columns);
    }

    /**
     * @see Table_Account::update()
     */
    public static function update($data, $value, $key = 'ofct_id') {
        $model = self::getModelInstance();

        return $model->update($data, $value, $key);
    }

    /**
     * @see Table_Account::delete()
     */
    public static function delete($value, $key = 'ofct_id') {
        $model = self::getModelInstance();

        return $model->delete($value, $key);
    }

    /**
     * @param array $condition
     * @param string $type
     * @param int $pageSize
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public static function getByCondition($condition = array(), $type = '*', $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->getByCondition($condition, $type, $pageSize, $page, $order);
    }

    /**
     * @param array $params
     * @return array
     */
    public  function getFields() {
        $row = array(
            'E0'=>'ofct_id',
            'E1'=>'fee_id',
            'E2'=>'ofaa_id',
            'E3'=>'ofct_ref_id',
            'E4'=>'ofct_ref_code',
            'E5'=>'ofct_value',
            'E6'=>'ofct_add_time',
        );
        return $row;
    }

}
