package com.aegis.web.controller.emergency.duty;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.aegis.common.core.controller.BaseController;
import com.aegis.common.core.domain.AjaxResult;
import com.aegis.common.core.page.TableDataInfo;
import com.aegis.emergency.alert.domain.DutyAlertLog;
import com.aegis.emergency.alert.service.DutyAlertLogService;

/**
 * 警情操作日志Controller
 * 
 * @author aegis
 */
@RestController
@RequestMapping("/duty/alerts/logs")
public class DutyAlertLogController extends BaseController {

    @Autowired
    private DutyAlertLogService dutyAlertLogService;

    /**
     * 按条件查询警情日志列表（支持分页）
     */
    @PreAuthorize("@ss.hasPermi('duty:alert:log:list')")
    @GetMapping("/list")
    public TableDataInfo list(DutyAlertLog condition) {
        startPage();
        List<DutyAlertLog> list = dutyAlertLogService.listByCondition(condition);
        return getDataTable(list);
    }

    /**
     * 根据警情ID查询操作日志
     */
    @PreAuthorize("@ss.hasPermi('duty:alert:log:query')")
    @GetMapping("/alert/{alertId}")
    public AjaxResult listByAlertId(@PathVariable Long alertId) {
        List<DutyAlertLog> logs = dutyAlertLogService.listByAlertId(alertId);
        return success(logs);
    }
}