<?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_OtherFeeAttribute extends Common_Service
{
    private static $_model = NULL;

    private static function getModelInstance() {
        if (is_null(self::$_model)) {
            self::$_model = new Table_OtherFeeAttribute();
        }

        return self::$_model;
    }

    /**
     * @see Table_Account::insert()
     */
    public static function add($row) {
        $model = self::getModelInstance();

        return $model->add($row);
    }

    public static function getByField($value, $field = 'ofa_id', $columns = "*"){
        $model = self::getModelInstance();
        return $model->getByField($value,$field,$columns);
    }

    /**
     * @see Table_Account::update()
     */
    public static function update($data, $value, $key = 'ofa_id') {
        $model = self::getModelInstance();

        return $model->update($data, $value, $key);
    }

    /**
     * @see Table_Account::delete()
     */
    public static function delete($value, $key = 'ofa_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 $condition
     * @param string $type
     * @param int $pageSize
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public static function joinConfig($condition = array(), $type = '*', $columns="*", $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->joinConfig($condition, $type, $columns, $pageSize, $page, $order);
    }

    /**
     * @param array $condition
     * @param string $type
     * @param int $pageSize
     * @param int $page
     * @param string $order
     * @return mixed
     */
    public static function leftJoinConfig($condition = array(), $type = '*', $columns="*", $pageSize = 0, $page = 1, $order = "")
    {
        $model = self::getModelInstance();
        return $model->leftJoinConfig($condition, $type, $columns, $pageSize, $page, $order);
    }

    /**
     * @param array $params
     * @return array
     */
    public  function getFields() {
        $row = array(
            'F0'=>'ofa_id',
            'F1'=>'fee_id',
            'F2'=>'ofa_name',
            'F3'=>'ofa_value_type',
            'F4'=>'ofa_template_name',
            'F5'=>'ofa_variable',
            'F6'=>'ofa_add_time',
        );
        return $row;
    }

}
