package com.ruoyi.interfaces.controller.web;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.CustomQueryWrapper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.interfaces.domain.PtService;
import com.ruoyi.interfaces.service.PtServiceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/pt/web")
public class PtWebController extends BaseController {

    private final PtServiceService ptServiceService;

    public PtWebController(PtServiceService ptServiceService) {
        this.ptServiceService = ptServiceService;
    }

    @ApiOperation("根据主键获取数据")
    @GetMapping("/service/list/top20")
    public AjaxResult listOftop20() {
        QueryWrapper<PtService> wrapper = new CustomQueryWrapper<>();
        wrapper.eq("status", "1")
                .last("limit 0,20");
        List<PtService> list = ptServiceService.list(wrapper);
        return AjaxResult.success(list);
    }

}
