package com.nav.controller; import com.nav.common.api.CommonResult; import com.nav.service.PostService; import com.nav.service.UserService; import com.nav.vo.result.MyInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * @ClassName MyInfoController * @Description 个人信息以及动态 * @Date 2022/4/29 21:30 * @Author wlj */ @RestController public class MyInfoController { @Autowired PostService postService; @Autowired UserService userService; @GetMapping("/myinfo/{id}") public CommonResult getMyInfo(@PathVariable long id) { MyInfo myInfo=new MyInfo(); myInfo.setUser(userService.getUser(id)); myInfo.setPosts(postService.getLifePostById(id)); return CommonResult.success(myInfo,"请求成功"); } }