正在显示
1 个修改的文件
包含
30 行增加
和
10 行删除
| @@ -30,20 +30,40 @@ class ProjectUserController extends BaseController | @@ -30,20 +30,40 @@ class ProjectUserController extends BaseController | ||
| 30 | */ | 30 | */ |
| 31 | public function lists(){ | 31 | public function lists(){ |
| 32 | $userModel = new UserModel(); | 32 | $userModel = new UserModel(); |
| 33 | - $this->map['role_id'] = $this::ROLE_ID;//超级管理员管理 | ||
| 34 | - $lists = $userModel->lists($this->map,$this->page,$this->row,$this->order); | ||
| 35 | - if(!empty($lists)){ | ||
| 36 | - foreach ($lists['list'] as $k => $v){ | ||
| 37 | - $userModel = new UserModel(); | ||
| 38 | - $lists['list'][$k]['operator_name'] = $userModel->read(['id'=>$v['operator_id']],['name'])['name']; | ||
| 39 | - $lists['list'][$k]['project_name'] = (new Project())->read(['id'=>$v['project_id']],['title'])['title']; | ||
| 40 | - } | ||
| 41 | - } | 33 | + $query = $userModel->leftJoin('gl_project', 'gl_project_user.project_id', '=', 'gl_project.id')->where('gl_project_role.role_id',$this::ROLE_ID); |
| 34 | + $query = $query->searchParam($query); | ||
| 35 | + $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page); | ||
| 42 | $this->response('列表',Code::SUCCESS,$lists); | 36 | $this->response('列表',Code::SUCCESS,$lists); |
| 43 | } | 37 | } |
| 44 | 38 | ||
| 45 | /** | 39 | /** |
| 46 | - * @param UserLogic $userLogic | 40 | + * @remark :查询字段 |
| 41 | + * @name :selectParam | ||
| 42 | + * @author :lyh | ||
| 43 | + * @method :post | ||
| 44 | + * @time :2023/8/4 11:44 | ||
| 45 | + */ | ||
| 46 | + public function selectParam(){ | ||
| 47 | + $select = [ | ||
| 48 | + 'gl_project_user.id AS id', | ||
| 49 | + 'gl_project.title AS title', | ||
| 50 | + 'gl_project_user.project_id AS project_id', | ||
| 51 | + 'gl_project_user.mobile AS mobile', | ||
| 52 | + 'gl_project_user.email AS email', | ||
| 53 | + 'gl_project_user.status AS status', | ||
| 54 | + ]; | ||
| 55 | + return $select; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public function searchParam(&$query){ | ||
| 59 | + //搜索条件处理 | ||
| 60 | + if(isset($this->map['title'])){ | ||
| 61 | + $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); | ||
| 62 | + } | ||
| 63 | + return $query; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 47 | * @remark :用户详情 | 67 | * @remark :用户详情 |
| 48 | * @name :info | 68 | * @name :info |
| 49 | * @author :lyh | 69 | * @author :lyh |
-
请 注册 或 登录 后发表评论