AssetLists.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 app\adminapi\lists\asset;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\lists\ListsSearchInterface;
  17. use app\common\model\notice\NoticeSetting;
  18. use app\common\model\asset\AssetInfo;
  19. /**
  20. * 资产管理
  21. * Class AssetLists
  22. * @package app\adminapi\lists\asset
  23. */
  24. class AssetLists extends BaseAdminDataLists implements ListsSearchInterface
  25. {
  26. /**
  27. * @notes 搜索条件
  28. * @return \string[][]
  29. * @author
  30. * @date 2025/04/12 2:21 下午
  31. */
  32. public function setSearch(): array
  33. {
  34. return [
  35. '=' => ['name', 'status']
  36. ];
  37. }
  38. /**
  39. * @notes 资产信息列表
  40. * @return array
  41. * @throws \think\db\exception\DataNotFoundException
  42. * @throws \think\db\exception\DbException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. * @author ljj
  45. * @date 2022/2/16 3:18 下午
  46. */
  47. public function lists(): array
  48. {
  49. $lists = (new AssetInfo())->field('id,name,address,images,contacts,mobile,area,content,status,create_time,sort')
  50. ->append(['status_desc'])
  51. ->where($this->searchWhere)
  52. ->limit($this->limitOffset, $this->limitLength)
  53. ->Order('sort desc')
  54. ->select()
  55. ->toArray();
  56. return $lists;
  57. }
  58. /**
  59. * @notes 资产信息数量
  60. * @return int
  61. * @author ljj
  62. * @date 2022/2/16 3:18 下午
  63. */
  64. public function count(): int
  65. {
  66. return (new AssetInfo())->where($this->searchWhere)->count();
  67. }
  68. }