package com.miaxis.app.controller.param;

import com.miaxis.common.constant.Constants;
import com.miaxis.common.core.controller.BaseController;
import com.miaxis.common.core.domain.Response;
import com.miaxis.common.core.page.ResponsePageInfo;
import com.miaxis.param.domain.AppParam;
import com.miaxis.param.service.IAppParamService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 【前站控制参数】Controller
 *
 * @author miaxis
 * @date 2021-12-30
 */
@RestController
@RequestMapping(Constants.OPEN_PREFIX+"/param/param")
@Api(tags={"【小程序-前端控制参数】"})
public class AppParamController extends BaseController{
    @Autowired
    private IAppParamService appParamService;

    /**
     * 查询前站控制参数列表
     */
    @GetMapping("/list")
    @ApiOperation("查询前端控制参数列表")
        @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
    })
    public ResponsePageInfo<AppParam> list(@ModelAttribute AppParam appParam){
        startPage();
        List<AppParam> list = appParamService.selectAppParamList(appParam);
        return toResponsePageInfo(list);
    }
    

    /**
     * 获取前站控制参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('param:param:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取前端控制参数详细信息")
    public Response<AppParam> getInfo(
            @ApiParam(name = "id", value = "前端控制参数参数", required = true)
            @PathVariable("id") Long id
    ){
        return Response.success(appParamService.getById(id));
    }

}
