package com.ruoyi.web.app;

import com.fasterxml.jackson.annotation.JsonView;
import com.github.pagehelper.PageHelper;
import com.ruoyi.bst.changeRecord.domain.ChangeRecordQuery;
import com.ruoyi.bst.changeRecord.domain.enums.ChangeRecordBstType;
import com.ruoyi.bst.changeRecord.service.ChangeRecordService;
import com.ruoyi.bst.channel.domain.ChannelQuery;
import com.ruoyi.bst.channel.service.ChannelService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.domain.JsonViewProfile;
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;

@RestController
@RequestMapping("/app/changeRecord")
public class AppChangRecordController extends BaseController {

    @Autowired
    private ChangeRecordService changeRecordService;

    @ApiOperation("获取使用记录列表")
    @GetMapping("/lightingRecord")
    public TableDataInfo lightingRecord(ChangeRecordQuery query) {
        startPage();
        PageHelper.orderBy("create_time desc");
        query.setUserId(getUserId());
        query.setBstType(ChangeRecordBstType.LIGHTING.getCode());
        return getDataTable(changeRecordService.selectChangeRecordList(query));
    }

    @ApiOperation("获取充值记录列表")
    @GetMapping("/rechargeRecord")
    public TableDataInfo rechargeRecord(ChangeRecordQuery query) {
        startPage();
        PageHelper.orderBy("create_time desc");
        query.setUserId(getUserId());
        query.setBstTypeList(ChangeRecordBstType.numIncrease());
        return getDataTable(changeRecordService.selectChangeRecordList(query));
    }



}
