package com.bonus.zlpt.home.controller;

import com.bonus.zlpt.equip.api.domain.vo.DevInfoVo;
import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.page.TableDataInfo;
import com.bonus.zlpt.home.service.MaHotSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.websocket.server.PathParam;
import java.util.List;

/**
 * 首页热搜装备
 */
@Api(value = "首页热搜装备",tags = {"首页热搜装备"})
@RestController
@RequestMapping("/hotSearch")
public class MaHotSearchController extends BaseController {

    @Resource
    private MaHotSearchService maHotSearchService;

    /**
     * 热搜装备
     * @return
     */
    @ApiOperation("热搜装备和更多")
    @GetMapping("/getHotEquipList")
    public TableDataInfo getHotEquipList(@PathParam("more")String more) {
        //获取更多
        if (more!=null && more != ""){
            List<DevInfoVo> list = maHotSearchService.getHotEquipList();
            return getDataTable(list);
        }
        //获取热搜前四的装备
        List<DevInfoVo> list = maHotSearchService.getHotEquipFourList();
        return getDataTable(list);
    }
}
