DeptApi.php 597 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\admin\api;
  3. use app\admin\model\Depart;
  4. /**
  5. * Description of RoleApi
  6. *
  7. * @author sgq
  8. */
  9. class DeptApi {
  10. public static function getOne($id) {
  11. return Depart::findOrEmpty($id);
  12. }
  13. public static function getList($params) {
  14. $where = [];
  15. if (isset($params["condition"])) {
  16. $where[] = [["simplename", "like", "%" . $params["condition"] . "%"]];
  17. $where[] = [["fullname", "like", "%" . $params["condition"] . "%"]];
  18. }
  19. $list = Depart::whereOr($where)->select()->toArray();
  20. return $list;
  21. }
  22. }