<?php

/**
 * Class that operate on table 'sellbillreview'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2020-05-05 18:38
 */
class SellbillreviewMySqlExtDAO extends SellbillreviewMySqlDAO {

    public function insertEX($tableName, $obj) {
        $sql = 'INSERT INTO ' . $tableName . ' (billid, reviewType, reviewComment, reviewuserid, sysdate, del) VALUES (?, ?, ?, ?, ?, ?)';
        $sqlQuery = new SqlQuery($sql);

        $sqlQuery->setNumber((int) $obj->billid);
        $sqlQuery->setNumber($obj->reviewType);
        $sqlQuery->set($obj->reviewComment);
        $sqlQuery->setNumber($obj->reviewuserid);
        $sqlQuery->set($obj->sysdate);
        $sqlQuery->setNumber($obj->del);

        $id = $this->executeInsert($sqlQuery);
        $obj->id = $id;
        return $id;
    }

    public function queryByBillidDetailedOrdered($billid) {
        $sql = 'SELECT sellbillreview.*,user.employeename
                FROM sellbillreview
                LEFT JOIN user ON user.userid = sellbillreview.reviewuserid
                WHERE billid = ' . $billid . ' order by sellbillreview.id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>