package cn.pluss.platform.controller;

import cn.pluss.platform.SxfMccInfoService;
import cn.pluss.platform.api.PageInfo;
import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.entity.SxfMccInfo;
import cn.pluss.platform.util.PageUtils;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/mccInfo")
@Transactional
@Api(value = "MccInfo控制类", tags = {"MccInfo接口"})
public class MccInfoController {

    @Autowired
    private SxfMccInfoService sxfMccInfoService;

    @GetMapping("/pageData")
    public Result<PageInfo<SxfMccInfo>> pageData(Page<SxfMccInfo> page, String keyWord) {
        Page<SxfMccInfo> sxfMccInfoPage = sxfMccInfoService.pageData(page, keyWord);
        return ResultGenerator.genSuccessResult(PageUtils.page(sxfMccInfoPage));
    }

    @GetMapping("/treeData")
    public Result<JSONArray> treeData() {
        JSONArray resultArr = sxfMccInfoService.treeData();
        return ResultGenerator.genSuccessResult(resultArr);
    }
}

