package cn.pluss.platform.controller.jft;


import cn.pluss.platform.api.Result;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.entity.JftBankCard;
import cn.pluss.platform.entity.JftPaymentInfo;
import cn.pluss.platform.jft.JftPaymentInfoService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

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


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

    @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) {
            JftPaymentInfo entity = baseService.getOne(new QueryWrapper<JftPaymentInfo>().eq("id",id));
            request.setAttribute("entity", entity);
        }
        return "jft/paymentDetail";
    }

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