package com.zehong.web.controller.evaluate;

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.TEnterpriseRankingRisk;
import com.zehong.system.service.ITEnterpriseRankingRiskService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;

/**
 * 薄弱跟踪Controller
 * 
 * @author zehong
 * @date 2026-03-17
 */
@RestController
@RequestMapping("/system/risk")
public class TEnterpriseRankingRiskController extends BaseController
{
    @Autowired
    private ITEnterpriseRankingRiskService tEnterpriseRankingRiskService;

    /**
     * 查询薄弱跟踪列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TEnterpriseRankingRisk tEnterpriseRankingRisk)
    {
        startPage();
        List<TEnterpriseRankingRisk> list = tEnterpriseRankingRiskService.selectTEnterpriseRankingRiskList(tEnterpriseRankingRisk);
        return getDataTable(list);
    }

    /**
     * 导出薄弱跟踪列表
     */
    @Log(title = "薄弱跟踪", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TEnterpriseRankingRisk tEnterpriseRankingRisk)
    {
        List<TEnterpriseRankingRisk> list = tEnterpriseRankingRiskService.selectTEnterpriseRankingRiskList(tEnterpriseRankingRisk);
        ExcelUtil<TEnterpriseRankingRisk> util = new ExcelUtil<TEnterpriseRankingRisk>(TEnterpriseRankingRisk.class);
        return util.exportExcel(list, "薄弱跟踪数据");
    }

    /**
     * 获取薄弱跟踪详细信息
     */
    @GetMapping(value = "/{riskId}")
    public AjaxResult getInfo(@PathVariable("riskId") Long riskId)
    {
        return AjaxResult.success(tEnterpriseRankingRiskService.selectTEnterpriseRankingRiskById(riskId));
    }

    /**
     * 新增薄弱跟踪
     */
    @Log(title = "薄弱跟踪", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TEnterpriseRankingRisk tEnterpriseRankingRisk)
    {
        return toAjax(tEnterpriseRankingRiskService.insertTEnterpriseRankingRisk(tEnterpriseRankingRisk));
    }

    /**
     * 修改薄弱跟踪
     */
    @Log(title = "薄弱跟踪", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TEnterpriseRankingRisk tEnterpriseRankingRisk)
    {
        return toAjax(tEnterpriseRankingRiskService.updateTEnterpriseRankingRisk(tEnterpriseRankingRisk));
    }

    /**
     * 删除薄弱跟踪
     */
    @Log(title = "薄弱跟踪", businessType = BusinessType.DELETE)
	@DeleteMapping("/{riskIds}")
    public AjaxResult remove(@PathVariable Long[] riskIds)
    {
        return toAjax(tEnterpriseRankingRiskService.deleteTEnterpriseRankingRiskByIds(riskIds));
    }
}
