package cn.pluss.platform.controller.jft;


import cn.pluss.platform.api.Result;
import cn.pluss.platform.base.BaseModelController;
import cn.pluss.platform.entity.JftReceiptOrder;
import cn.pluss.platform.entity.JftSmallClass;
import cn.pluss.platform.jft.JftSmallClassService;
import cn.pluss.platform.util.Base64Util;
import cn.pluss.platform.util.OssOperatUtil;
import cn.pluss.platform.util.StringUtil;
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 org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;

/**
 * <p>
 * 缴费通小课堂信息表 前端控制器
 * </p>
 *
 * @author bzg
 * @since 2022-07-06
 */
@Controller
@RequestMapping("/jftSmallClass")
public class JftSmallClassController extends BaseModelController<JftSmallClassService, JftSmallClass> {

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

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

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