package org.dromara.elevator.controller;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.elevator.domain.bo.HomeInfoBo;
import org.dromara.elevator.domain.vo.*;
import org.dromara.elevator.service.HomeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页查询
 *
 * @author ym
 * @version 1.0.0
 * @date 2024-09-18 10:22
 */
@RequiredArgsConstructor
@RequestMapping("/home")
@RestController
public class HomeController extends BaseController {

    private final HomeService homeService;

    /**
     * 首页信息查询
     */
    @GetMapping("/info")
    public R<HomeInfoVo> info(HomeInfoBo bo) {
        return R.ok(homeService.queryHomeInfo(bo));
    }

    /**
     * 救援超时次数分页查询
     */
    @GetMapping("/rescue/list")
    public TableDataInfo<RescueOverTimeVo> pageRescueList(HomeInfoBo bo, PageQuery pageQuery) {
        return homeService.pageRescueList(bo, pageQuery);
    }

    /**
     * 故障电梯分布分页查询
     */
    @GetMapping("/fault/list")
    public TableDataInfo<ProjectFaultVo> pageFaultList(HomeInfoBo bo, PageQuery pageQuery) {
        return homeService.pageFaultList(bo, pageQuery);
    }

    /**
     * 困人排行查询
     */
    @GetMapping("/trapped/list")
    public TableDataInfo<ProjectFaultVo> pageTrappedList(HomeInfoBo bo, PageQuery pageQuery) {
        return homeService.pageTrappedList(bo, pageQuery);
    }
}
