package com.usky.fire.controller.web;


import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.usky.common.core.bean.ApiResult;
import com.usky.common.core.bean.CommonPage;
import com.usky.common.log.annotation.Log;
import com.usky.common.log.enums.BusinessType;
import com.usky.fire.domain.DemPoliceRecord;
import com.usky.fire.service.DemPoliceRecordService;
import com.usky.fire.service.vo.DemPoliceRecordExportVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 处警记录 前端控制器
 * </p>
 *
 * @author JCB
 * @since 2022-10-24
 */
@RestController
@RequestMapping("/demPoliceRecord")
public class DemPoliceRecordController {

    @Autowired
    private DemPoliceRecordService demPoliceRecordService;

//    /**
//     * 接处警数据-列表
//     *
//     * @param caseCode 案件编号
//     * @param branch   主管支队
//     * @param id       主键ID
//     * @param pageNum  当前页面
//     * @param pageSize 每页条数
//     * @return
//     */
//    @GetMapping("policeRecordList")
//    public ApiResult<CommonPage<Object>> policeRecordList(@RequestParam(value = "caseCode", required = false) String caseCode,
//                                                          @RequestParam(value = "branch", required = false) String branch,
//                                                          @RequestParam(value = "id", required = false, defaultValue = "0") Integer id,
//                                                          @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
//                                                          @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
//        return ApiResult.success(demPoliceRecordService.policeRecordList(caseCode, branch, id, pageNum, pageSize));
//    }
//
//    /**
//     * 接处警数据-列表-导出
//     *
//     * @param caseCode 案件编号
//     * @param branch   主管支队
//     * @param exportTitle   文件名
//     * @throws IOException
//     */
//    @PostMapping("policeRecordListExport")
//    public void export(HttpServletResponse response,
//                       @RequestParam(value = "caseCode", required = false) String caseCode,
//                       @RequestParam(value = "branch", required = false) String branch,
//                       @RequestParam(value = "exportTitle") String exportTitle)throws IOException{
//        List<DemPoliceRecordExportVO> list = demPoliceRecordService.policeRecordListExport(caseCode, branch);
//        ExcelUtil<DemPoliceRecordExportVO> util = new ExcelUtil<DemPoliceRecordExportVO>(DemPoliceRecordExportVO.class);
//        util.exportExcel(response, list, exportTitle, exportTitle);
//    }

//    /**
//     * 接处警数据-修改
//     *
//     * @param demPoliceRecord
//     */
//    @Log(title = "接处警数据-修改", businessType = BusinessType.UPDATE)
//    @PutMapping("updatePoliceRecord")
//    public ApiResult<Void> updatePoliceRecord(@RequestBody DemPoliceRecord demPoliceRecord) {
//        demPoliceRecordService.updatePoliceRecord(demPoliceRecord);
//        return ApiResult.success();
//    }

    /**
     * 接处警数据-删除
     *
     * @param id 主键ID
     */
    @Log(title = "接处警数据-删除", businessType = BusinessType.DELETE)
    @DeleteMapping("delPoliceRecord")
    public ApiResult<Void> delPoliceRecord(@RequestParam(value = "id") Integer id) {
        demPoliceRecordService.delPoliceRecord(id);
        return ApiResult.success();
    }

}

