package com.sifang.modules.customer.controller;

import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.customer.Service.YueXiuBankCardService;
import com.sifang.modules.sunshine.partnerManagement.service.PartnerService;
import com.sifang.modules.sys.util.LayuiPage;
import com.sifang.modules.sys.web.BaseExceptionController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 开卡管理
 */
@Controller
@RequestMapping(value = "${adminPath}/bankCard")
public class YueXiuCardController extends BaseExceptionController {

    @Autowired
    private YueXiuBankCardService yueXiuBankCardService;

    @Autowired
    PartnerService partnerService;

    //开卡页面
    @RequestMapping(value = "findBankCardList")
    public String customerContractList(Model model) {
        model.addAttribute("paterns", partnerService.partnerList());
        return "modules/yx/bankCardListPage";
    }


    //列表数据
    @ResponseBody
    @RequestMapping(value = "bankCardListDate")
    public Object bankCardListDate(HttpServletRequest request) {
        LayuiPage<Record> page = new LayuiPage<>(request);
        Map<String, String> map = getParams(request);
        yueXiuBankCardService.listDate(page, map);
        return page.renderJson();
    }


}
