package com.zd.laboratory.controller;

import com.zd.common.core.web.controller.BaseController;
import com.zd.common.core.web.domain.AjaxResult;
import com.zd.common.core.web.page.TableDataInfo;
import com.zd.laboratory.domain.LabSubjectDengerRelation;
import com.zd.laboratory.service.ILabSubjectDengerRelationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 实验室安全隐患关联Controller
 *
 * @author liubo
 * @date 2021-11-13
 */
@RestController
@Api(tags = "【实验室安全隐患关联】")
@RequestMapping("/denger")
public class LabSubjectDengerRelationController extends BaseController {
    @Autowired
    private ILabSubjectDengerRelationService labSubjectDengerRelationService;

    /**
     * 查询实验室安全隐患关联列表
     */
    @PostMapping("/list")
    @ApiOperation(value = "查询实验室安全隐患关联列表")
    public TableDataInfo<LabSubjectDengerRelation> list(@RequestBody LabSubjectDengerRelation labSubjectDengerRelation) {
        startPage();
        List<LabSubjectDengerRelation> list = labSubjectDengerRelationService.selectSubjectDengerRelationInfo(labSubjectDengerRelation);
        return getDataTable(list);
    }

    /**
     * 查询实验室安全隐患统计
     */
    @PostMapping("/statistics")
    @ApiOperation(value = "查询实验室安全隐患统计")
    public AjaxResult statistics(@RequestBody LabSubjectDengerRelation labSubjectDengerRelation) {
        List<Map<String, Object>> datas = labSubjectDengerRelationService.selectLabSubjectDengerRelationStatistics(labSubjectDengerRelation);
        return AjaxResult.success(datas);
    }


}
