package com.usky.park.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.park.domain.EventLc;
import com.usky.park.service.EventLcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 梯控历史事件表 前端控制器
 * </p>
 *
 * @author zyj
 * @since 2023-04-10
 */
@RestController
@RequestMapping("/eventLc")
public class EventLcController {

    @Autowired
    private EventLcService eventLcService;

    /**
     * 数据中心-梯控系统人员通行列表查询
     *
     * @param personName 人员名称
     * @param cardNo 卡号
     * @param liftName 电梯名称
     * @param startDate 开始时间  格式 yyyy-MM-dd HH:mm:ss
     * @param endDate  结束时间  格式 yyyy-MM-dd HH:mm:ss
     * @param pageNum  当前页
     * @param pageSize  每页条数
     * @return
     */
    @GetMapping("eventLcList")
    public ApiResult<CommonPage<EventLc>> eventLcList(@RequestParam(value = "personName",required = false) String personName,
                                                      @RequestParam(value = "cardNo",required = false) String cardNo,
                                                      @RequestParam(value = "liftName",required = false) String liftName,
                                                      @RequestParam(value = "startDate",required = false) String startDate,
                                                      @RequestParam(value = "endDate",required = false) String endDate,
                                                      @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                      @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize){
        return ApiResult.success(eventLcService.eventLcList(personName,cardNo,liftName,startDate,endDate,pageNum,pageSize));
    }

}

