package com.bonus.zlpt.home.controller;

import com.bonus.zlpt.common.core.domain.equip.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 org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/hotSearch")
public class MaHotSearchController extends BaseController {

    @Resource
    private MaHotSearchService maHotSearchService;

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