|
|
@@ -6,168 +6,5 @@ use Yii;
|
|
|
|
|
|
class BaseClass extends \common\base\classes\BaseClass
|
|
|
{
|
|
|
-
|
|
|
- public static $baseFile;
|
|
|
-
|
|
|
- //查询全部 ssh 2019.11.27
|
|
|
- public static function getAllList($select, $where, $order = '', $with = '')
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- $return = $model->getAllList($select, $where, $order, $with);
|
|
|
- return $return;
|
|
|
- }
|
|
|
-
|
|
|
- //分页查询 ssh 2019.9.21
|
|
|
- public static function getList($select, $where, $order = '', $with = '')
|
|
|
- {
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $page = isset($get['page']) ? $get['page'] : 1;
|
|
|
- Yii::$app->params['page'] = $page;
|
|
|
- $pageSize = isset($get['pageSize']) && !empty($get['pageSize']) ? $get['pageSize'] : Yii::$app->params['pageSize'];
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- $return = $model->getList($select, $where, $page, $pageSize, $order, $with);
|
|
|
- return $return;
|
|
|
- }
|
|
|
-
|
|
|
- //查询指定条数 ssh 2019.11.30
|
|
|
- public static function getLimitList($select, $where, $limit = 10, $order = '', $with = '')
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- $return = $model->getLimitList($select, $where, $limit, $order, $with);
|
|
|
- return $return;
|
|
|
- }
|
|
|
-
|
|
|
- public static function add($data, $returnObject = false)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->add($data, $returnObject);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量添加
|
|
|
- */
|
|
|
- public static function batchAdd($data)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- $model->batchAdd($data);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据主键ID删除一条记录
|
|
|
- */
|
|
|
- public static function deleteById($id)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->deleteById($id);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *根据条件删除一条或多条记录
|
|
|
- */
|
|
|
- public static function deleteByCondition($condition)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- $count = $model->deleteByCondition($condition);
|
|
|
- return $count;
|
|
|
- }
|
|
|
-
|
|
|
- //根据id批量删 ssh 2019.12.7
|
|
|
- public static function deleteByIds($ids)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->deleteByIds($ids);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据主键ID更新一条记录
|
|
|
- */
|
|
|
- public static function updateById($id, $data)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->updateById($id, $data);
|
|
|
- }
|
|
|
|
|
|
- //根据多个主键id更新 ssh 2019.9.3
|
|
|
- public static function updateByIds($ids, $data)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->updateByIds($ids, $data);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据条件更新一条或多条记录
|
|
|
- */
|
|
|
- public static function updateByCondition($condition, $data)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- $count = $model->updateByCondition($condition, $data);
|
|
|
- return $count;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据主键ID查出一条记录
|
|
|
- */
|
|
|
- public static function getById($id, $returnObject = false)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->getById($id, $returnObject);
|
|
|
- }
|
|
|
-
|
|
|
- //随机取一个 ssh 2020.2.10
|
|
|
- public static function getOne($returnObject = false, $order = false)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->getOne($returnObject, $order);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *根据条件查出一条记录
|
|
|
- */
|
|
|
- public static function getByCondition($condition, $returnObject = false, $order = false)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->getByCondition($condition, $returnObject, $order);
|
|
|
- }
|
|
|
-
|
|
|
- //是否存在 ssh 2019.8.30
|
|
|
- public static function exists($condition)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->exists($condition);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *根据条件查出多条记录
|
|
|
- */
|
|
|
- public static function getAllByCondition($condition, $order = null, $field, $indexBy = null)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->getAllByCondition($condition, $order, $field, $indexBy);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据多个主键ID查询多条记录
|
|
|
- */
|
|
|
- public static function getByIds($ids, $order = null, $indexBy = null)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->getByIds($ids, $order, $indexBy);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *根据条件查出数量
|
|
|
- */
|
|
|
- public static function getCount($condition)
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->getCount($condition);
|
|
|
- }
|
|
|
-
|
|
|
- //计数器+1-1 shizq 2019-12-05
|
|
|
- public static function counters($counters, $condition, $params = [])
|
|
|
- {
|
|
|
- $model = Yii::createObject(['class' => static::$baseFile]);
|
|
|
- return $model->counters($counters, $condition, $params);
|
|
|
- }
|
|
|
-
|
|
|
}
|