package com.muchinfo.mtp3century.controller;

import com.muchinfo.mtp3century.service.ISystemSetUpService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.entity.Errorcode;
import com.muchinfo.mtp3pojos.entity.Systemparam;
import com.muchinfo.mtp3pojos.vo.systemsetup.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/setup")
@Api(value = "基础数据API", description = "基础数据管理")
public class SystemSetUpController {

    @Resource
    private ISystemSetUpService iSystemSetUpService;

    @ApiOperation("基础数据管理-->系统参数管理-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryParam")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<Systemparam> query(Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iSystemSetUpService.queryByPage(pageNum, pageSize, request);
    }

    @ApiOperation("基础数据管理-->系统参数管理-->修改")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/dealParam")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult query(@RequestBody SystemParamUpdate paramUpdate, HttpServletRequest request) {
        return iSystemSetUpService.dealParam(paramUpdate, request);
    }

    @ApiOperation("基础数据管理-->错误码管理-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryErr")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<Errorcode> queryErr(SystemErrorCodeParam param, HttpServletRequest request) {
        return iSystemSetUpService.queryErr(param, request);
    }

    @ApiOperation("基础数据管理-->错误码管理-->修改")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/dealErr")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult dealErr(@RequestBody SystemErrorCodeParam param, HttpServletRequest request) {
        return iSystemSetUpService.dealErr(param, request);
    }

    @ApiOperation("基础数据管理-->市场板块设置-->获取列表")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/queryMarketSet")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    private PageResult<SystemMarketSectionResult> queryMarketSet(SystemMarketSectionParam param, Integer pageNum, Integer pageSize, HttpServletRequest request) {
        return iSystemSetUpService.queryMarketSet(param, pageNum, pageSize, request);
    }

    @ApiOperation("基础数据管理-->市场板块设置-->详情")
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET, value = "/marketSetDetail")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    private AjaxResult<SystemMarketSetDetail> marketSetDetail(Integer marketsectionid, HttpServletRequest request) {
        return iSystemSetUpService.marketSetDetail(marketsectionid, request);
    }

}
