
package com.tmerclub.cloud.user.controller.app;

import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.user.service.UserGrowthLogService;
import com.tmerclub.cloud.user.vo.UserGrowthLogVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户成长值记录
 *
 * @author YXF
 * @date 2020-12-08 10:16:53
 */
@RestController("appUserGrowthLogController")
@RequestMapping("/userGrowthLog")
@Tag(name = "app-用户成长值记录")
public class UserGrowthLogController {

    @Autowired
    private UserGrowthLogService userGrowthLogService;


    @GetMapping("/page")
    @Operation(summary = "获取用户成长值记录列表", description = "分页获取用户成长值记录列表")
    public ServerResponseEntity<PageVO<UserGrowthLogVO>> getPageByUserId(@Valid PageDTO pageDTO) {
        Long userId = AuthUserContext.get().getUserId();
        PageVO<UserGrowthLogVO> userGrowthLogPage = userGrowthLogService.getPageByUserId(pageDTO, userId);
        return ServerResponseEntity.success(userGrowthLogPage);
    }

}
