<?php

/**
 * Class that operate on table 'movementmanagedeleted'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2019-07-08 15:56
 */
class MovementmanagedeletedMySqlExtDAO extends MovementmanagedeletedMySqlDAO {

    public function queryAllWithDate($startDate, $endDate) {
        $sql = 'SELECT movementmanagedeleted.*, user.username
		 FROM movementmanagedeleted JOIN user
		 ON movementmanagedeleted.userid = user.userid
		where date(movementmanagedate) >= "' . $startDate . '" and date(movementmanagedate) <= "' . $endDate . '"
                    and movementmanagedeleted.userid > 0
		 order by id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryWithUserid($userid) {
        $sql = 'SELECT movementmanagedeleted.*, user.username
		 FROM movementmanagedeleted JOIN user
		 ON movementmanagedeleted.userid = user.userid
		where  movementmanagedeleted.userid = ' . $userid . '
                    and movementmanagedeleted.userid > 0
		 order by id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryWithOperationname($operationname) {
        $sql = 'SELECT movementmanagedeleted.*, user.username
		 FROM movementmanagedeleted JOIN user
		 ON movementmanagedeleted.userid = user.userid
		where  movementmanagedeleted.operationname = "' . $operationname . '"
                    and movementmanagedeleted.userid > 0
		 order by id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllWithDateAndUser($startDate, $endDate, $userid) {
        $sql = 'SELECT movementmanagedeleted.*, user.username
		 FROM movementmanagedeleted JOIN user
		 ON movementmanagedeleted.userid = user.userid
		where date(movementmanagedate) >= "' . $startDate . '" and date(movementmanagedate) <= "' . $endDate . '"
		 and movementmanagedeleted.userid = ' . $userid . '
                     and movementmanagedeleted.userid > 0
		 order by id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllWithDateAndOperationname($startDate, $endDate, $operationname) {
        $sql = 'SELECT movementmanagedeleted.*, user.username
		 FROM movementmanagedeleted JOIN user
		 ON movementmanagedeleted.userid = user.userid
		where date(movementmanagedate) >= "' . $startDate . '" and date(movementmanagedate) <= "' . $endDate . '"
		 and  movementmanagedeleted.operationname = "' . $operationname . '"
                     and movementmanagedeleted.userid > 0
		 order by id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryAllWithUserAndOperationname($userid, $operationname) {
        $sql = 'SELECT movementmanagedeleted.*, user.username
		 FROM movementmanagedeleted JOIN user
		 ON movementmanagedeleted.userid = user.userid
		where movementmanagedeleted.userid = ' . $userid . '
		 and  movementmanagedeleted.operationname = "' . $operationname . '"
                     and movementmanagedeleted.userid > 0
		 order by id desc';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>