package cn.pluss.platform.controller.business;

import cn.pluss.platform.api.PageInfo;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.business.BusinessInfoService;
import cn.pluss.platform.util.PageUtils;
import cn.pluss.platform.vo.BusinessInfoVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequiredArgsConstructor
@RequestMapping("businessInfo")
public class BusinessInfoController {


    private final BusinessInfoService businessInfoService;


    @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "/list")
    public String index() {
        return "business/list";
    }

    @GetMapping("/page")
    @ResponseBody
    public Result<PageInfo<BusinessInfoVo>> page(Page<BusinessInfoVo> page, BusinessInfoVo businessInfoVo) {
        Page<BusinessInfoVo> pageData = businessInfoService.pageData(page, businessInfoVo);
        return ResultGenerator.genSuccessResult(PageUtils.page(pageData));
    }

    /*@PostMapping("/delete")
    public Result<AgentInfo> del(@RequestBody AgentInfo agentInfo) {
        agentInfoService.delete(agentInfo);
        return ResultGenerator.genSuccessResult("删除成功", agentInfo);
    }*/

}
