SystemCrudDataService.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * +----------------------------------------------------------------------
  4. * | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  5. * +----------------------------------------------------------------------
  6. * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  7. * +----------------------------------------------------------------------
  8. * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  9. * +----------------------------------------------------------------------
  10. * | Author: CRMEB Team <admin@crmeb.com>
  11. * +----------------------------------------------------------------------
  12. */
  13. namespace app\services\system;
  14. use app\dao\system\SystemCrudDataDao;
  15. use app\services\BaseServices;
  16. /**
  17. * Class SystemCrudDataService
  18. * @author 等风来
  19. * @email 136327134@qq.com
  20. * @date 2023/7/28
  21. * @package app\services\system
  22. */
  23. class SystemCrudDataService extends BaseServices
  24. {
  25. /**
  26. * SystemCrudDataService constructor.
  27. * @param SystemCrudDataDao $dao
  28. */
  29. public function __construct(SystemCrudDataDao $dao)
  30. {
  31. $this->dao = $dao;
  32. }
  33. /**
  34. * 获取全部数据
  35. * @return array
  36. * @throws \ReflectionException
  37. * @throws \think\db\exception\DataNotFoundException
  38. * @throws \think\db\exception\DbException
  39. * @throws \think\db\exception\ModelNotFoundException
  40. * @author 等风来
  41. * @email 136327134@qq.com
  42. * @date 2023/8/1
  43. */
  44. public function getlistAll(string $name = '')
  45. {
  46. [$page, $limit] = $this->getPageValue();
  47. $list = $this->dao->selectList(['name' => $name], '*', $page, $limit, '', [], true)->toArray();
  48. $count = $this->dao->count(['name' => $name]);
  49. if ($page && $limit) {
  50. return compact('list', 'count');
  51. } else {
  52. return $list;
  53. }
  54. }
  55. }