where($map)->field("id,username,xzqdm,level,name")->find(); } /** * @throws ModelNotFoundException * @throws DataNotFoundException * @throws DbException */ public static function getUserInfoById($id){ return (new \app\model\User)->field("username,xzqdm,level,name")->find($id); } public static function getGridPersonInfoById($id){ return User::field("name,xzqdm,level,work_organization, phone, work_position, person_group, person_duty, person_image,id")->find($id); } public static function editPasswordById($id,$password): User { return User::update(["password"=>$password],["id"=>$id]); } public static function editUserInfoById($id,$userInfo): User { return User::update($userInfo,["id"=>$id]); } public static function saveUserInfo($userInfo): User{ return User::create($userInfo); } public static function deleteUserInfoById($id): bool{return User::destroy($id);} /** * @throws ModelNotFoundException * @throws DbException * @throws DataNotFoundException */ public static function getUserInfoList($page, $xzqdm){ switch (strlen($xzqdm) ){ case 4: $map[]=["xzqdm","like",'%'.$xzqdm.'%']; break; case 6: $map[] = ["xzqdm","like",'%'.$xzqdm.'%']; break; case 9: $map[] = ["xzqdm","like",'%'.$xzqdm.'%']; break; default: $map[]=["xzqdm","<>",'null']; } $map[]=["work_position","=","网格员"]; return (new User)->where($map)->page($page["page"],$page["size"])->select(); } }