package com.jeequan.jeepay.mgr.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.exception.ChannelException;
import com.jeequan.jeepay.core.interfaces.paychannel.IRepayApiService;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.core.model.DBPaymentConfig;
import com.jeequan.jeepay.core.model.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.core.utils.SpringBeansUtil;
import com.jeequan.jeepay.db.entity.AccountChangeInfo;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.mgr.service.ChannelApiService;
import com.jeequan.jeepay.service.impl.AccountChangeInfoService;
import com.jeequan.jeepay.service.impl.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author crystal
 * @date 2023/12/6 15:11
 */
@RestController
@RequestMapping("/api/accountChange")
public class AccountChangeInfoController extends CommonCtrl {

    @Autowired private AccountChangeInfoService accountChangeInfoService;

    @Autowired private ChannelApiService channelApiService;

    @PreAuthorize("hasAuthority('ENT_ACCOUNT_CHANGE_LIST')")
    @GetMapping
    public ApiRes list() {
        AccountChangeInfo info = getObject(AccountChangeInfo.class);
        JSONObject paramJSON = getReqParamJSON();
        LambdaQueryWrapper<AccountChangeInfo> wrapper = AccountChangeInfo.gw(info);
        Page<AccountChangeInfo> pages = accountChangeInfoService.pageList(getIPage(),wrapper,info,paramJSON);
        return ApiRes.page(pages);
    }

}
