MyInfoController.java 849 字节
Newer Older
221900223吴良杰's avatar
221900223吴良杰 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
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,"请求成功");
    }

}