folderSql.php 1.1 KB
<?php

namespace Model;

/**
 * 文件夹
 * @author:dc
 * @time 2023/2/17 18:04
 * Class folderSql
 * @package Model
 */
class folderSql {

    public static $table = 'folders';

    /**
     * 所有文件夹
     * @param int $email_id
     * @return string
     * @author:dc
     * @time 2023/2/18 9:22
     */
    public static function all(int $email_id, $field = '`id`,`folder`,`pid`,`origin_folder`,`last_sync_time`'):string {
        return "select {$field} from `".static::$table."` where `email_id` = {$email_id} order by `id` asc";
    }


    /**
     * 是否存在,存在则返回 id
     * @param $where
     * @return string
     * @author:dc
     * @time 2023/2/18 11:48
     */
    public static function has($where):string {
        return "select `id` from `".self::$table."` where ".dbWhere($where);
    }

    /**
     * 查询一条完整的数据
     * @param $where
     * @return string
     * @author:dc
     * @time 2023/2/20 16:39
     */
    public static function first($where):string {
        return "select * from `".self::$table."` where ".dbWhere($where);
    }



}