CommentScoreModel.class.php 1.21 KB
<?php
/**
 * 培训评价评分表
 * @author: houyingcai
 * @email:    594609175@qq.com
 * @date :  2017-08-29 16:07:27
 * @version $Id$
 */

namespace Common\Model;

class CommentScoreModel extends AbstractModel
{
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 培训评价统计评分计算
     *
     * @author: 蔡建华
     * @param $conds array 查询条件
     * @param string $fields 查询的字段
     * @param string $group 分组字段
     * @return array|bool
     */
    public function list_group_score($conds = [], $fields = '*', $group = '')
    {
        $params = [];
        // 条件
        $wheres = [];
        if (!$this->_parse_where($wheres, $params, $conds)) {
            return false;
        }
        // 企业标记
        $wheres[] = "`{$this->prefield}domain`=?";
        $params[] = QY_DOMAIN;
        // 状态条件
        $wheres[] = "`{$this->prefield}status`<?";
        $params[] = $this->get_st_delete();
        if ($group) {
            $group = "group by {$group}";
        }
        $sql = "select {$fields} from  __TABLE__  WHERE  " . implode(" AND ", $wheres) . " {$group} ";
        return $this->_m->fetch_array($sql, $params);
    }
}