Files
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

49 lines
1009 B
PHP

<?php
namespace app\model;
use think\Model;
class Base extends Model {
// protected $resultSetType = 'collection';
/**
* @author 涂润
* 查询多条信息
*/
public static function getAll($where, $field = '', $order = '', $limit = '') {
return self::where($where)->field($field)->order($order)->limit($limit)->select();
}
/**
* @author 涂润
* 获取单条信息
*/
public static function getOne($where, $field, $order = []) {
return self::where($where)->field($field)->order($order)->find();
}
/**
* @author 涂润
* 获取条数
* @param $where
* @return int|string
*/
public static function getCount($where, $lock = false) {
return self::where($where)->lock($lock)->count();
}
/**
* @author 涂润
* 添加/主键更新单条记录
* @param $data
* @return false|int
*/
public function add($data) {
return $this->save($data);
}
}