Forráskód Böngészése

增加平台 pt 目录

shish 5 éve
szülő
commit
d2c8f1922f

+ 173 - 0
biz-pt/base/classes/BaseClass.php

@@ -0,0 +1,173 @@
+<?php
+
+namespace bizPt\base\classes;
+
+use Yii;
+
+class BaseClass
+{
+	
+	public static $baseFile;
+	
+	//查询全部 shish 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;
+	}
+	
+	//分页查询 shish 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;
+	}
+	
+	//查询指定条数 shish 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批量删 shish 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更新 shish 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);
+	}
+	
+	//随机取一个 shish 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);
+	}
+	
+	//是否存在  shish 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);
+	}
+	
+}

+ 13 - 0
biz-pt/base/models/Base.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizPt\base\models;
+
+use common\components\util;
+use Yii;
+use yii\db\ActiveRecord;
+use yii\data\Pagination;
+use yii\db\Exception;
+
+class Base extends ActiveRecord
+{
+
+}

+ 167 - 0
biz-pt/base/services/BaseService.php

@@ -0,0 +1,167 @@
+<?php
+
+namespace bizPt\base\services;
+
+use common\components\page;
+use Yii;
+
+class BaseService
+{
+	public static $baseFile;
+	public static $requireParams;
+	
+	//查询全部 shish 2019.11.27
+	public static function getAllList($select, $where, $order = '', $with = '')
+	{
+		$class = static::$baseFile;
+		$result = $class::getAllList($select, $where, $order, $with);
+		return $result;
+	}
+	
+	//分页查询 shish 2019.9.21
+	public static function getList($select, $where, $order = '', $with = '')
+	{
+		$class = static::$baseFile;
+		return $class::getList($select, $where, $order, $with);
+	}
+	
+	//查询指定条数 shish 2019.11.30
+	public static function getLimitList($select, $where, $limit, $order = '', $with = '')
+	{
+		$class = static::$baseFile;
+		return $class::getLimitList($select, $where, $limit, $order, $with);
+	}
+	
+	public static function add($data, $returnObject = false)
+	{
+		$class = static::$baseFile;
+		return $class::add($data, $returnObject);
+	}
+	
+	/**
+	 * 批量添加
+	 */
+	public static function batchAdd($data)
+	{
+		$class = static::$baseFile;
+		return $class::batchAdd($data);
+	}
+	
+	/**
+	 * 根据主键ID删除一条记录
+	 */
+	public static function deleteById($id)
+	{
+		$class = static::$baseFile;
+		return $class::deleteById($id);
+	}
+	
+	/**
+	 *根据条件删除一条或多条记录
+	 */
+	public static function deleteByCondition($condition)
+	{
+		$class = static::$baseFile;
+		$count = $class::deleteByCondition($condition);
+		return $count;
+	}
+	
+	//根据id批量删除 shish 2019.12.7
+	public static function deleteByIds($ids)
+	{
+		$class = static::$baseFile;
+		return $class::deleteByIds($ids);
+	}
+	
+	/**
+	 * 根据主键ID更新一条记录
+	 */
+	public static function updateById($id, $data)
+	{
+		$class = static::$baseFile;
+		return $class::updateById($id, $data);
+	}
+	
+	//根据多个主键id更新 shish 2019.9.3
+	public static function updateByIds($ids, $data)
+	{
+		$class = static::$baseFile;
+		return $class::updateByIds($ids, $data);
+	}
+	
+	/**
+	 * 根据条件更新一条或多条记录
+	 */
+	public static function updateByCondition($condition, $data)
+	{
+		$class = static::$baseFile;
+		return $class::updateByCondition($condition, $data);
+	}
+	
+	/**
+	 * 根据主键ID查出一条记录
+	 */
+	public static function getById($id, $returnObject = false)
+	{
+		$class = static::$baseFile;
+		return $class::getById($id, $returnObject);
+	}
+	
+	/**
+	 *根据条件查出一条记录
+	 */
+	public static function getByCondition($condition, $returnObject = false, $order = false)
+	{
+		$class = static::$baseFile;
+		return $class::getByCondition($condition, $returnObject, $order);
+	}
+	
+	//是否存在 shish 2019.8.30
+	public static function exists($condition)
+	{
+		$class = static::$baseFile;
+		return $class::exists($condition);
+	}
+	
+	/**
+	 *根据条件查出多条记录
+	 */
+	public static function getAllByCondition($condition, $order = null, $field, $indexBy = null)
+	{
+		$class = static::$baseFile;
+		return $class::getAllByCondition($condition, $order, $field, $indexBy);
+	}
+	
+	/**
+	 * 根据多个主键ID查询多条记录
+	 */
+	public static function getByIds($ids, $order = null, $indexBy = null)
+	{
+		$class = static::$baseFile;
+		return $class::getByIds($ids, $order, $indexBy);
+	}
+	
+	/**
+	 *根据条件查出数量
+	 */
+	public static function getCount($condition)
+	{
+		$class = static::$baseFile;
+		return $class::getCount($condition);
+	}
+	
+	//计数器+1-1 shizq 2019-12-05
+	public static function counters($counters, $condition, $params = [])
+	{
+		$class = static::$baseFile;
+		return $class::counters($counters, $condition, $params);
+	}
+	
+	//随机取一个 shish 2020.3.12
+	public static function getOne($returnObject = false, $order = false)
+	{
+		$class = static::$baseFile;
+		return $class::getOne($returnObject = false, $order = false);
+	}
+	
+}

+ 12 - 0
biz-pt/item/classes/ItemClass.php

@@ -0,0 +1,12 @@
+<?php
+namespace bizPt\item\classes;
+
+use bizGhs\base\classes\BaseClass;
+use common\components\util;
+
+class ItemClass extends BaseClass
+{
+
+    public static $baseFile = '\bizPt\item\models\Item';
+
+}

+ 11 - 0
biz-pt/item/classes/ItemClassClass.php

@@ -0,0 +1,11 @@
+<?php
+namespace bizPt\item\classes;
+
+use bizGhs\base\classes\BaseClass;
+
+class ItemClassClass extends BaseClass
+{
+
+    public static $baseFile = '\bizPt\item\models\ItemClass';
+
+}

+ 11 - 0
biz-pt/item/models/Item.php

@@ -0,0 +1,11 @@
+<?php
+namespace bizPt\item\models;
+use bizGhs\base\models\Base;
+
+class Item extends Base
+{
+    public static function tableName()
+    {
+        return 'xhItem';
+    }
+}

+ 10 - 0
biz-pt/item/models/ItemClass.php

@@ -0,0 +1,10 @@
+<?php
+namespace bizPt\item\models;
+use bizGhs\base\models\Base;
+class ItemClass extends Base
+{
+    public static function tableName()
+    {
+        return 'xhItemClass';
+    }
+}

+ 10 - 0
biz-pt/item/services/ItemClassService.php

@@ -0,0 +1,10 @@
+<?php
+namespace bizPt\item\services;
+
+use bizGhs\base\services\BaseService;
+use common\components\util;
+
+class ItemClassService extends BaseService
+{
+
+}

+ 10 - 0
biz-pt/item/services/ItemService.php

@@ -0,0 +1,10 @@
+<?php
+namespace bizPt\item\services;
+
+use bizGhs\base\services\BaseService;
+use Yii;
+
+class ItemService extends BaseService
+{
+
+}

+ 1 - 0
common/config/bootstrap.php

@@ -7,3 +7,4 @@ Yii::setAlias('@saas', dirname(dirname(__DIR__)) . '/app/saas');
 Yii::setAlias('@ghs', dirname(dirname(__DIR__)) . '/app/ghs');
 Yii::setAlias('@biz', dirname(dirname(__DIR__)) . '/biz');
 Yii::setAlias('@bizGhs', dirname(dirname(__DIR__)) . '/biz-ghs');
+Yii::setAlias('@bizPt', dirname(dirname(__DIR__)) . '/biz-pt');