package cn.pluss.platform.controller.jft;


import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.entity.JftBankCard;
import cn.pluss.platform.entity.RewardConfig;
import cn.pluss.platform.entity.UserRole;
import cn.pluss.platform.jft.JftBankCardService;
import cn.pluss.platform.rewardConfig.RewardConfigService;
import cn.pluss.platform.user.UserRoleService;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 缴费通银行卡 前端控制器
 * </p>
 *
 * @author bzg
 * @since 2022-02-22
 */
@Controller
@RequestMapping("/jftBankCard")
public class JftBankCardController extends BaseModelController<JftBankCardService, JftBankCard> {


    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/index")
    public String index(HttpServletRequest request) {
        return "jft/bankList";
    }

    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = {"/detail/{id}", "/detail"})
    public String detail(HttpServletRequest request, @PathVariable(value = "id", required = false) Integer id) {
        if (id != null) {
            JftBankCard entity = baseService.getOne(new QueryWrapper<JftBankCard>().eq("id",id));
            request.setAttribute("entity", entity);
        }
        return "jft/bankDetail";
    }

    @Override
    public Result<Page<JftBankCard>> page(Page<JftBankCard> page, JftBankCard condition, OrderItem orderItem) {
        orderItem.setColumn("id");
        orderItem.setAsc(false);
        return super.page(page, condition, orderItem);
    }
}
