package com.ruoyi.web.controller.api;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.mall.domain.BusinessQuestion;
import com.ruoyi.mall.domain.BusinessTutorial;
import com.ruoyi.mall.domain.Vo.BusinessQuestionVo;
import com.ruoyi.mall.service.IBusinessQuestionService;
import com.ruoyi.mall.service.IBusinessTutorialService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
import java.util.List;

/**首页
 *
 */
@RestController
@RequestMapping("/api/index")
public class ApiQuestionController extends BaseController {

    @Resource
    private IBusinessQuestionService questionService;

    /**助手问题列表
     *
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/getQuestionList")
    public AjaxResult getOfflineServicesList(@RequestParam(defaultValue = "1") Integer pageNum,
                                            @RequestParam(defaultValue = "10") Integer pageSize) {
        try{
            PageHelper.startPage(pageNum, pageSize);
            BusinessQuestion businessQuestion = new BusinessQuestion();
            List<BusinessQuestionVo> businessQuestionVos = questionService.selectBusinessQuestionList(businessQuestion);
            PageInfo<BusinessQuestionVo> pageInfo = new PageInfo<>(businessQuestionVos);
            return AjaxResult.success().put("data",pageInfo);
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error("助手问题列表异常");
        }
    }




}
