1. 程式人生 > 其它 >ThinkPHP6.0在phpstorm新增查詢構造器和模型的程式碼提示

ThinkPHP6.0在phpstorm新增查詢構造器和模型的程式碼提示

新增

* @method Query where(mixed $field, string $op = null, mixed $condition = null) static 查詢條件
 * @method Query whereTime(string $field, string $op, mixed $range = null) static 查詢日期和時間
 * @method Query whereBetweenTime(string $field, mixed $startTime, mixed $endTime) static 查詢日期或者時間範圍
 * @method Query whereBetweenTimeField(string
$startField, string $endField) static 查詢當前時間在兩個時間欄位範圍 * @method Query whereYear(string $field, string $year = 'this year') static 查詢某年 * @method Query whereMonth(string $field, string $month = 'this month') static 查詢某月 * @method Query whereDay(string $field, string $day = 'today') static 查詢某日 * @method Query whereRaw(string
$where, array $bind = []) static 表示式查詢 * @method Query whereExp(string $field, string $condition, array $bind = []) static 欄位表示式查詢 * @method Query when(mixed $condition, mixed $query, mixed $otherwise = null) static 條件查詢 * @method Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static
JOIN查詢 * @method Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 檢視查詢 * @method Query with(mixed $with) static 關聯預載入 * @method Query count(string $field) static Count統計查詢 * @method Query min(string $field) static Min統計查詢 * @method Query max(string $field) static Max統計查詢 * @method Query sum(string $field) static SUM統計查詢 * @method Query avg(string $field) static Avg統計查詢 * @method Query field(mixed $field, boolean $except = false) static 指定查詢欄位 * @method Query fieldRaw(string $field, array $bind = []) static 指定查詢欄位 * @method Query union(mixed $union, boolean $all = false) static UNION查詢 * @method Query limit(mixed $offset, integer $length = null) static 查詢LIMIT * @method Query order(mixed $field, string $order = null) static 查詢ORDER * @method Query orderRaw(string $field, array $bind = []) static 查詢ORDER * @method Query cache(mixed $key = null, integer $expire = null) static 設定查詢快取 * @method mixed value(string $field) static 獲取某個欄位的值 * @method array column(string $field, string $key = '') static 獲取某個列的值 * @method Model find(mixed $data = null) static 查詢單個記錄 不存在返回Null * @method Model findOrEmpty(mixed $data = null) static 查詢單個記錄 不存在返回空模型 * @method \think\model\Collection select(mixed $data = null) static 查詢多個記錄 * @method Model withAttr(array $name, \Closure $closure) 動態定義獲取器

找到DbManager.php

 

 

* Class DbManager
 * @package think
 * @mixin BaseQuery
 * @mixin Query
 * @method \think\db\Query master() static 從主伺服器讀取資料
 * @method \think\db\Query readMaster(bool $all = false) static 後續從主伺服器讀取資料
 * @method \think\db\Query table(string $table) static 指定資料表(含字首)
 * @method \think\db\Query name(string $name) static 指定資料表(不含字首)
 * @method \think\db\Query where(mixed $field, string $op = null, mixed $condition = null) static 查詢條件
 * @method \think\db\Query whereRaw(string $where, array $bind = []) static 表示式查詢
 * @method \think\db\Query whereExp(string $field, string $condition, array $bind = []) static 欄位表示式查詢
 * @method \think\db\Query when(mixed $condition, mixed $query, mixed $otherwise = null) static 條件查詢
 * @method \think\db\Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查詢
 * @method \think\db\Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 檢視查詢
 * @method \think\db\Query field(mixed $field, boolean $except = false) static 指定查詢欄位
 * @method \think\db\Query fieldRaw(string $field, array $bind = []) static 指定查詢欄位
 * @method \think\db\Query union(mixed $union, boolean $all = false) static UNION查詢
 * @method \think\db\Query limit(mixed $offset, integer $length = null) static 查詢LIMIT
 * @method \think\db\Query order(mixed $field, string $order = null) static 查詢ORDER
 * @method \think\db\Query orderRaw(string $field, array $bind = []) static 查詢ORDER
 * @method \think\db\Query cache(mixed $key = null , integer $expire = null) static 設定查詢快取
 * @method \think\db\Query withAttr(string $name,callable $callback = null) static 使用獲取器獲取資料
 * @method mixed value(string $field) static 獲取某個欄位的值
 * @method array column(string $field, string $key = '') static 獲取某個列的值
 * @method mixed find(mixed $data = null) static 查詢單個記錄
 * @method mixed select(mixed $data = null) static 查詢多個記錄
 * @method integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一條記錄
 * @method integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一條記錄並返回自增ID
 * @method integer insertAll(array $dataSet) static 插入多條記錄
 * @method integer update(array $data) static 更新記錄
 * @method integer delete(mixed $data = null) static 刪除記錄
 * @method boolean chunk(integer $count, callable $callback, string $column = null) static 分塊獲取資料
 * @method \Generator cursor(mixed $data = null) static 使用遊標查詢記錄
 * @method mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) static SQL查詢
 * @method integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL執行
 * @method \think\Paginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) static 分頁查詢
 * @method mixed transaction(callable $callback) static 執行資料庫事務
 * @method void startTrans() static 啟動事務
 * @method void commit() static 用於非自動提交狀態下面的查詢提交
 * @method void rollback() static 事務回滾
 * @method boolean batchQuery(array $sqlArray) static 批處理執行SQL語句
 * @method string getLastInsID(string $sequence = null) static 獲取最近插入的ID

效果