<?php

/**
 * Class that operate on table 'employeesubgroup'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2020-11-11 22:24
 */
class EmployeesubgroupMySqlExtDAO extends EmployeesubgroupMySqlDAO {

    public function queryByNameAndGroup($name, $groupid) {
        $sql = 'SELECT * FROM employeesubgroup WHERE name LIKE "%' . $name . '%" and employeegroupid=' . $groupid;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryByNameAndGroupWithDayStatue($name, $groupid, $day) {
        $sql = 'SELECT employeesubgroup.*,employeeclosedaysubgroupstatus.status
                FROM employeesubgroup
                left join employeeclosedaysubgroupstatus on (employeeclosedaysubgroupstatus.employeesubgroupid = employeesubgroup.id and employeeclosedaysubgroupstatus.day= "' . $day . '")
                WHERE name LIKE "%' . $name . '%" and employeegroupid=' . $groupid;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryByEmployeegroupidEX($employeegroupid) {
        $sql = 'SELECT * FROM employeesubgroup WHERE employeegroupid = ' . $employeegroupid . ' and del = 0';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>