package com.leromro.core.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.leromro.core.domain.vo.BusinessManagementVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import com.leromro.common.core.domain.R;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.leromro.common.annotation.Log;
import com.leromro.common.core.controller.BaseController;
import com.leromro.common.core.domain.AjaxResult;
import com.leromro.common.enums.BusinessType;
import com.leromro.core.domain.BusinessManagement;
import com.leromro.core.service.IBusinessManagementService;
import com.leromro.common.utils.poi.ExcelUtil;
import com.leromro.common.core.page.TableDataInfo;

/**
 * 业务管理(树形结构包含所有服务)Controller
 *
 * @author ruoyi
 * @date 2025-04-17
 */
@RestController
@Api(tags = "业务管理(树形结构包含所有服务)")
@RequestMapping("/core/business/management")
public class BusinessManagementController extends BaseController
{
    @Autowired
    private IBusinessManagementService businessManagementService;

    /**
     * 查询业务管理(树形结构)列表
     */
    @ApiOperation(value = "查询所有业务列表(树形结构)", notes = "获取所有业务列表，则parentId传0")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "parentId", value = "上级id", required = false)
    })
    @GetMapping("/getTreeList")
    public R<List<BusinessManagementVO>> getTreeList(@RequestParam("parentId") Long parentId)
    {
        return businessManagementService.getTreeList(parentId);
    }

//    /**
//     * 导出业务管理(树形结构包含所有服务)列表
//     */
//    @ApiOperation("导出业务管理(树形结构包含所有服务)列表")
//    @Log(title = "业务管理(树形结构包含所有服务)", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, BusinessManagement businessManagement)
//    {
//        List<BusinessManagement> list = businessManagementService.selectBusinessManagementList(businessManagement);
//        ExcelUtil<BusinessManagement> util = new ExcelUtil<BusinessManagement>(BusinessManagement.class);
//        util.exportExcel(response, list, "业务管理(树形结构包含所有服务)数据");
//    }
//
//    /**
//     * 获取业务管理(树形结构包含所有服务)详细信息
//     */
//    @ApiOperation("获取业务管理(树形结构包含所有服务)详细信息")
//    @GetMapping(value = "/{businessManagementId}")
//    public R<BusinessManagement> getInfo(@PathVariable("businessManagementId") Long businessManagementId)
//    {
//        return R.ok(businessManagementService.selectBusinessManagementByBusinessManagementId(businessManagementId));
//    }
//
//    /**
//     * 新增业务管理(树形结构包含所有服务)
//     */
//    @ApiOperation("新增业务管理(树形结构包含所有服务)")
//    @Log(title = "业务管理(树形结构包含所有服务)", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody BusinessManagement businessManagement)
//    {
//        return toAjax(businessManagementService.insertBusinessManagement(businessManagement));
//    }
//
//    /**
//     * 修改业务管理(树形结构包含所有服务)
//     */
//    @ApiOperation("修改业务管理(树形结构包含所有服务)")
//    @Log(title = "业务管理(树形结构包含所有服务)", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody BusinessManagement businessManagement)
//    {
//        return toAjax(businessManagementService.updateBusinessManagement(businessManagement));
//    }
//
//    /**
//     * 删除业务管理(树形结构包含所有服务)
//     */
//    @ApiOperation("删除业务管理(树形结构包含所有服务)")
//    @Log(title = "业务管理(树形结构包含所有服务)", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{businessManagementIds}")
//    public R<Integer> remove(@PathVariable Long[] businessManagementIds)
//    {
//        return R.ok(businessManagementService.deleteBusinessManagementByBusinessManagementIds(businessManagementIds));
//    }
}
