package com.ruoyi.bid.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bid.domain.BidMyZizhi;
import com.ruoyi.bid.service.IBidMyZizhiService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 资质管理Controller
 * 
 * @author ruoyi
 * @date 2025-12-11
 */
@RestController
@RequestMapping("/bid/myzizhi")
public class BidMyZizhiController extends BaseController
{
    @Autowired
    private IBidMyZizhiService bidMyZizhiService;

    /**
     * 查询资质管理列表
     */
    @PreAuthorize("@ss.hasPermi('bid:myzizhi:list')")
    @GetMapping("/list")
    public TableDataInfo list(BidMyZizhi bidMyZizhi)
    {
        startPage();
        List<BidMyZizhi> list = bidMyZizhiService.selectBidMyZizhiList(bidMyZizhi);
        return getDataTable(list);
    }

    /**
     * 导出资质管理列表
     */
    @PreAuthorize("@ss.hasPermi('bid:myzizhi:export')")
    @Log(title = "资质管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BidMyZizhi bidMyZizhi)
    {
        List<BidMyZizhi> list = bidMyZizhiService.selectBidMyZizhiList(bidMyZizhi);
        ExcelUtil<BidMyZizhi> util = new ExcelUtil<BidMyZizhi>(BidMyZizhi.class);
        util.exportExcel(response, list, "资质管理数据");
    }

    /**
     * 获取资质管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('bid:myzizhi:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bidMyZizhiService.selectBidMyZizhiById(id));
    }

    /**
     * 新增资质管理
     */
    @PreAuthorize("@ss.hasPermi('bid:myzizhi:add')")
    @Log(title = "资质管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BidMyZizhi bidMyZizhi)
    {
        return toAjax(bidMyZizhiService.insertBidMyZizhi(bidMyZizhi));
    }

    /**
     * 修改资质管理
     */
    @PreAuthorize("@ss.hasPermi('bid:myzizhi:edit')")
    @Log(title = "资质管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BidMyZizhi bidMyZizhi)
    {
        return toAjax(bidMyZizhiService.updateBidMyZizhi(bidMyZizhi));
    }

    /**
     * 删除资质管理
     */
    @PreAuthorize("@ss.hasPermi('bid:myzizhi:remove')")
    @Log(title = "资质管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bidMyZizhiService.deleteBidMyZizhiByIds(ids));
    }
}
