package com.izouma.nineth.web.mobile.v1.rewardpoints;


import com.izouma.nineth.domain.User;
import com.izouma.nineth.domain.UserIntegralChangeLog;
import com.izouma.nineth.dto.PageQuery;
import com.izouma.nineth.service.rewardpoints.UserIntegralChangeLogService;
import com.izouma.nineth.web.BaseController;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户积分变动记录
 *
 */
@RestController
@RequestMapping("/userIntegralChangeLog/v1")
@AllArgsConstructor
public class UserIntegralChangeLogControllerV1 extends BaseController {
    private UserIntegralChangeLogService userIntegralChangeLogService;

    /**
     * 积分变更记录
     * @param pageQuery
     * @return
     */
    @PostMapping("changeLogList")
    public Page<UserIntegralChangeLog> changeLogList(@RequestBody  PageQuery pageQuery){
        User user = currentUser();
        pageQuery.getQuery().put("userId", user.getId());
        Page<UserIntegralChangeLog> page = userIntegralChangeLogService.all(pageQuery);
        return page;
    }




}
