package com.djhk.uav.sysPolice.controller;


import com.djhk.common.annotation.Log;
import com.djhk.common.core.controller.BaseController;
import com.djhk.common.core.domain.AjaxResult;
import com.djhk.common.core.page.TableDataInfo;
import com.djhk.common.enums.BusinessType;
import com.djhk.uav.sysPolice.domain.PoliceInfoEs;
import com.djhk.uav.sysPolice.service.IPoliceInfoEsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 警员信息ES
 * Controller
 *
 * @author qpc
 * @date 2025-04-14
 */
@RestController
@RequestMapping("/policeInfoEs")
public class PoliceInfoEsController extends BaseController {
    @Autowired
    private IPoliceInfoEsService policeInfoEsService;

    /**
     * 查询警员信息ES
     * 列表
     */
    @PostMapping("/list")
    public TableDataInfo list(PoliceInfoEs policeInfoEs) {
        startPage();
        List<PoliceInfoEs> list = policeInfoEsService.selectPoliceInfoEsList(policeInfoEs);
        return getDataTable(list);
    }


//    /**
//     * 获取警员信息ES
//     * 详细信息
//     */
//    @GetMapping(value = "/{fhRksj}")
//    public AjaxResult getInfo(@PathVariable("fhRksj") String fhRksj) {
//        return success(policeInfoEsService.selectPoliceInfoEsByFhRksj(fhRksj));
//    }

    /**
     * 新增警员信息ES
     */
    @Log(title = "警员信息ES", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PoliceInfoEs policeInfoEs) {
        return toAjax(policeInfoEsService.insertPoliceInfoEs(policeInfoEs));
    }

    /**
     * 修改警员信息ES
     */
    @Log(title = "警员信息ES", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PoliceInfoEs policeInfoEs) {
        return toAjax(policeInfoEsService.updatePoliceInfoEs(policeInfoEs));
    }

    /**
     * 删除警员信息ES
     */
    @Log(title = "警员信息ES ", businessType = BusinessType.DELETE)
    @DeleteMapping("/{fhRksjs}")
    public AjaxResult remove(@PathVariable String[] fhRksjs) {
        return toAjax(policeInfoEsService.deletePoliceInfoEsByFhRksjs(fhRksjs));
    }
}
