package com.zehong.web.controller.checktask;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TRectifyPersonGroupInfo;
import com.zehong.system.service.ITRectifyPersonGroupInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;

/**
 * 整改人员分组信息Controller
 * 
 * @author zehong
 * @date 2026-07-16
 */
@RestController
@RequestMapping("/danger/group")
public class TRectifyPersonGroupInfoController extends BaseController
{
    @Autowired
    private ITRectifyPersonGroupInfoService tRectifyPersonGroupInfoService;

    /**
     * 查询整改人员分组信息列表
     */
    //@PreAuthorize("@ss.hasPermi('system:info:list')")
    @GetMapping("/list")
    public TableDataInfo list(TRectifyPersonGroupInfo tRectifyPersonGroupInfo)
    {
        startPage();
        List<TRectifyPersonGroupInfo> list = tRectifyPersonGroupInfoService.selectTRectifyPersonGroupInfoList(tRectifyPersonGroupInfo);
        return getDataTable(list);
    }

    /**
     * 导出整改人员分组信息列表
     */
    //@PreAuthorize("@ss.hasPermi('system:info:export')")
    @Log(title = "整改人员分组信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TRectifyPersonGroupInfo tRectifyPersonGroupInfo)
    {
        List<TRectifyPersonGroupInfo> list = tRectifyPersonGroupInfoService.selectTRectifyPersonGroupInfoList(tRectifyPersonGroupInfo);
        ExcelUtil<TRectifyPersonGroupInfo> util = new ExcelUtil<TRectifyPersonGroupInfo>(TRectifyPersonGroupInfo.class);
        return util.exportExcel(list, "整改人员分组信息数据");
    }

    /**
     * 获取整改人员分组信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('system:info:query')")
    @GetMapping(value = "/{groupId}")
    public AjaxResult getInfo(@PathVariable("groupId") Long groupId)
    {
        return AjaxResult.success(tRectifyPersonGroupInfoService.selectTRectifyPersonGroupInfoById(groupId));
    }

    /**
     * 新增整改人员分组信息
     */
    //@PreAuthorize("@ss.hasPermi('system:info:add')")
    @Log(title = "整改人员分组信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TRectifyPersonGroupInfo tRectifyPersonGroupInfo)
    {
        return toAjax(tRectifyPersonGroupInfoService.insertTRectifyPersonGroupInfo(tRectifyPersonGroupInfo));
    }

    /**
     * 修改整改人员分组信息
     */
   // @PreAuthorize("@ss.hasPermi('system:info:edit')")
    @Log(title = "整改人员分组信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TRectifyPersonGroupInfo tRectifyPersonGroupInfo)
    {
        return toAjax(tRectifyPersonGroupInfoService.updateTRectifyPersonGroupInfo(tRectifyPersonGroupInfo));
    }

    /**
     * 删除整改人员分组信息
     */
    //@PreAuthorize("@ss.hasPermi('system:info:remove')")
    @Log(title = "整改人员分组信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{groupIds}")
    public AjaxResult remove(@PathVariable Long[] groupIds)
    {
        return toAjax(tRectifyPersonGroupInfoService.deleteTRectifyPersonGroupInfoByIds(groupIds));
    }
}
