// +---------------------------------------------------------------------- namespace app\common\repositories\system\admin; //附件 use app\common\dao\system\admin\PartnerDao; use app\common\model\system\admin\Partner; use app\common\repositories\BaseRepository; use app\common\repositories\system\auth\RoleRepository; use crmeb\exceptions\AuthException; use crmeb\services\JwtTokenService; use FormBuilder\Exception\FormBuilderException; use FormBuilder\Factory\Elm; use FormBuilder\Form; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; use think\exception\ValidateException; use think\facade\Cache; use think\facade\Config; use think\facade\Route; use think\Model; /** * Class BaseRepository * @package common\repositories * @mixin AdminDao */ class PartnerRepository extends BaseRepository { public function __construct(PartnerDao $dao) { /** * @var AdminDao */ $this->dao = $dao; } /** * @param array $where * @param $page * @param $limit * @return array * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public function getList(array $where, $page, $limit) { $query = $this->dao->search($where); $count = $query->count(); $list = $query->page($page, $limit)->select(); return compact('list', 'count'); } public function create(array $data) { return $this->dao->create($data); } /** * @param int $id * @return Form * @throws DataNotFoundException * @throws DbException * @throws FormBuilderException * @throws ModelNotFoundException * @author xaboy * @day 2020-04-09 */ public function getDetail(int $id) { return $this->dao->get($id)->toArray(); } /** * * 更新 * @param int $id id * @param array $data 数组 * @return int * @throws DbException * @author 张先生 * @date 2020-03-26 */ public function update(int $id, array $data) { return $this->dao->update($id, $data); } //删除 public function delete(int $id) { return $this->dao->delete($id); } //检测角色绑定用户 public function existsUser(int $id) { return $this->dao->existsUser($id); } }