<?php

/**
 * Class that operate on table 'productionexecution'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2018-11-28 13:58
 */
class ProductionexecutionMySqlExtDAO extends ProductionexecutionMySqlDAO {

    public function getOtherOrders($id, $orderId) {
        $sql = 'SELECT * FROM productionexecution WHERE id != ? and orderId = ?';
        $sqlQuery = new SqlQuery($sql);
        $sqlQuery->setNumber($id);
        $sqlQuery->setNumber($orderId);
        return $this->getList($sqlQuery);
    }

    public function queryAllExt($query) {
        $sql = "SELECT productionexecution.*,sum(productionexecutionoutput.num) as num
                FROM productionexecution
                join  productionexecutionoutput  on  productionexecutionoutput.exeutionid = productionexecution.id
                where 1 $query group by exeutionid";
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllExt2($query) {
        $sql = "SELECT productionexecution.*, product.productName
                FROM productionexecution
                JOIN product ON product.productId = productionexecution.productid
                where 1 $query";
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>