package com.ruoyi.system.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.EpsBusinessDeploy;
import com.ruoyi.system.service.IEpsBusinessDeployService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 业务下发管理Controller
 * 
 * @author gyt
 * @date 2025-10-13
 */
@RestController
@RequestMapping("/businessDeploy")
public class EpsBusinessDeployController extends BaseController
{
    @Autowired
    private IEpsBusinessDeployService epsBusinessDeployService;

    /**
     * 查询业务下发管理列表
     */
    @RequiresPermissions("system:businessDeploy:list")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
    {
        PageDomain pageDomain = new PageDomain();
        pageDomain.setPageNum(epsBusinessDeploy.getPageNum());
        pageDomain.setPageSize(epsBusinessDeploy.getPageSize());
        startPage(pageDomain);
        List<EpsBusinessDeploy> list = epsBusinessDeployService.selectEpsBusinessDeployList(epsBusinessDeploy);
        return getDataTable(list);
    }


    /**
     * 获取业务下发管理详细信息
     */
    @RequiresPermissions("system:businessDeploy:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(epsBusinessDeployService.selectEpsBusinessDeployById(id));
    }

    /**
     * 新增业务下发管理
     */
    @RequiresPermissions("system:businessDeploy:add")
    @Log(title = "业务下发管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
    {
        return toAjax(epsBusinessDeployService.insertEpsBusinessDeploy(epsBusinessDeploy));
    }

    /**
     * 修改业务下发管理
     */
    @RequiresPermissions("system:businessDeploy:edit")
    @Log(title = "业务下发管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EpsBusinessDeploy epsBusinessDeploy)
    {
        return toAjax(epsBusinessDeployService.updateEpsBusinessDeploy(epsBusinessDeploy));
    }

    /**
     * 删除业务下发管理
     */
    @RequiresPermissions("system:businessDeploy:remove")
    @Log(title = "业务下发管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(epsBusinessDeployService.deleteEpsBusinessDeployByIds(ids));
    }

    /**
     * 审核
     * @param epsBusinessDeploy
     * @return
     */
    @RequiresPermissions("system:businessDeploy:review")
    @PostMapping("/reviewBusiness")
    public AjaxResult reviewBusiness(@RequestBody EpsBusinessDeploy epsBusinessDeploy){
        return toAjax(epsBusinessDeployService.reviewBusiness(epsBusinessDeploy));
    }
}
