
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.UserBalanceLogService;
import com.tmerclub.cloud.user.vo.UserBalanceLogVO;
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 tmerclub
 * @date 2021-04-27 15:51:36
 */
@RestController("appUserBalanceLogController")
@RequestMapping("/userBalanceLog")
@Tag(name = "余额记录")
public class UserBalanceLogController {

    @Autowired
    private UserBalanceLogService userBalanceLogService;

    @GetMapping("/page")
    @Operation(summary = "获取余额记录列表", description = "分页获取余额记录列表")
    public ServerResponseEntity<PageVO<UserBalanceLogVO>> page(@Valid PageDTO pageDTO) {
        Long userId = AuthUserContext.get().getUserId();
        PageVO<UserBalanceLogVO> userBalanceLogPage = userBalanceLogService.getPageByUserId(pageDTO, userId);
        return ServerResponseEntity.success(userBalanceLogPage);
    }
}
