package com.ym.mec.web.controller;

import com.ym.mec.auth.api.client.SysUserFeignService;
import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.dal.dto.CashAccountDetail;
import com.ym.mec.biz.service.SysUserCoursesAccountDetailService;
import com.ym.mec.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;

@RequestMapping("userCoursesAccount")
@Api(tags = "用户课程余额服务")
@RestController
public class SysUserCoursesAccountDetailController extends BaseController {
    @Autowired
    private SysUserFeignService sysUserFeignService;
    @Autowired
    private SysUserCoursesAccountDetailService sysUserCoursesAccountDetailService;

    @ApiOperation(value = "分页查询用户交易明细")
    @GetMapping("/queryPage")
    public Object queryPage(CashAccountDetail queryInfo) {
        SysUser user = sysUserFeignService.queryUserInfo();
        SysUser sysUser = sysUserFeignService.queryUserInfo();
        if(sysUser == null){
            return failed("获取用户信息失败");
        }
        return succeed(sysUserCoursesAccountDetailService.queryPage(queryInfo));
    }
}
