lists.stub 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. {NAMESPACE}
  15. {USE}
  16. use app\common\lists\ListsSearchInterface;
  17. /**
  18. * {CLASS_COMMENT}
  19. * Class {UPPER_CAMEL_NAME}Lists
  20. * @package app\{MODULE_NAME}\lists{PACKAGE_NAME}
  21. */
  22. class {UPPER_CAMEL_NAME}Lists extends {EXTENDS_LISTS} implements ListsSearchInterface
  23. {
  24. /**
  25. * @notes 设置搜索条件
  26. * @return \string[][]
  27. * @author {AUTHOR}
  28. * @date {DATE}
  29. */
  30. public function setSearch(): array
  31. {
  32. return [
  33. {QUERY_CONDITION}
  34. ];
  35. }
  36. /**
  37. * @notes 获取{NOTES}列表
  38. * @return array
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. * @author {AUTHOR}
  43. * @date {DATE}
  44. */
  45. public function lists(): array
  46. {
  47. return {UPPER_CAMEL_NAME}::where($this->searchWhere)
  48. ->field([{FIELD_DATA}])
  49. ->limit($this->limitOffset, $this->limitLength)
  50. ->order(['{PK}' => 'desc'])
  51. ->select()
  52. ->toArray();
  53. }
  54. /**
  55. * @notes 获取{NOTES}数量
  56. * @return int
  57. * @author {AUTHOR}
  58. * @date {DATE}
  59. */
  60. public function count(): int
  61. {
  62. return {UPPER_CAMEL_NAME}::where($this->searchWhere)->count();
  63. }
  64. }