package com.jeequan.jeepay.mch.ctrl.account;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.db.entity.AccountFundInfo;
import com.jeequan.jeepay.mch.ctrl.CommonCtrl;
import com.jeequan.jeepay.service.impl.AccountFundInfoService;
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;

/**
 * TODO
 * 账户资金明细
 * @author crystal
 * @date 2024/3/28 16:18
 */
@RestController
@RequestMapping("/api/accountFund")
public class AccountFundInfoController extends CommonCtrl {

    @Autowired
    private AccountFundInfoService accountFundInfoService;


//    @PreAuthorize("hasAuthority('ENT_ACCOUNT_FUND_LIST')")
    @GetMapping
    public ApiRes list() {
        AccountFundInfo info = getObject(AccountFundInfo.class);
        JSONObject paramJSON = getReqParamJSON();
        LambdaQueryWrapper<AccountFundInfo> wrapper = AccountFundInfo.gw(info);
        wrapper.eq(AccountFundInfo::getMchNo, getCurrentMchNo());
        Page<AccountFundInfo> pages = accountFundInfoService.pageList(getIPage(),wrapper,info,paramJSON);
        return ApiRes.page(pages);
    }
}
