package com.buy507.mall.controller;

import com.buy507.mall.common.api.CommonPage;
import com.buy507.mall.common.api.CommonResult;
import com.buy507.mall.model.UmsMember;
import com.buy507.mall.model.UmsTransferrecord;
import com.buy507.mall.service.UmsTransferrecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@Api(tags = "UmsTransferrecordController", description = "会员转账记录")
@RequestMapping("/memberTransferRecord")
public class UmsTransferrecordController {

    @Autowired
    private UmsTransferrecordService service;

    private HttpServletRequest request;



//    @ApiOperation("会员转账查询")
//    @RequestMapping(value = "/List" , method = RequestMethod.GET)
//    public CommonResult<List<UmsTransferrecord>> list(){
//        List<UmsTransferrecord> list = service.list();
//        return CommonResult.success(list);
//    }

    @ApiOperation("分页查询会员信息")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<UmsTransferrecord>> list(
            @RequestParam(value = "memberName", required = false) String memberName,
            @RequestParam(value = "receiverName", required = false) String receiverName,
            @RequestParam(value = "startTime", required = false) String startTime,
            @RequestParam(value = "endTime", required = false) String endTime,
            @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum
            )

    {
        List<UmsTransferrecord> list = service.list(pageSize, pageNum, memberName, receiverName, startTime,endTime);
        return CommonResult.success(CommonPage.restPage(list));
    }

}

