package com.dsk.web.controller.business;

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

import com.dsk.common.core.domain.entity.BusinessLabel;
import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.system.domain.BusinessIdDto;
import com.dsk.system.service.IBusinessLabelService;
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.dsk.common.annotation.Log;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.enums.BusinessType;
import com.dsk.common.core.page.TableDataInfo;

/**
 * 项目标签Controller
 *
 * @author lxl
 * @date 2023-05-17
 */
@RestController
@RequestMapping("/business/label")
public class BusinessLabelController extends BaseController
{
    @Autowired
    private IBusinessLabelService businessLabelService;


    /**
     * 新增项目标签
     */
//    @PreAuthorize("@ss.hasPermi('system:label:add')")
//    @Log(title = "项目标签", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusinessLabel businessLabel)
    {
        return toAjax(businessLabelService.insertBusinessLabel(businessLabel));
    }


     /**
     * 删除项目标签
     */
//    @PreAuthorize("@ss.hasPermi('system:label:remove')")
//    @Log(title = "项目标签", businessType = BusinessType.DELETE)
    @PostMapping("/remove")
    public AjaxResult remove(@RequestBody BusinessIdDto dto)
    {
        return toAjax(businessLabelService.deleteBusinessLabelById(dto));
    }

//    /**
//     * 删除项目标签
//     */
//    @PreAuthorize("@ss.hasPermi('system:label:remove')")
//    @Log(title = "项目标签", businessType = BusinessType.DELETE)
//    @DeleteMapping("/remove/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids)
//    {
//        return toAjax(businessLabelService.deleteBusinessLabelByIds(ids));
//    }

//    /**
//     * 查询项目标签列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:label:list')")
//    @GetMapping("/list")
//    public TableDataInfo list(BusinessLabel businessLabel)
//    {
//        startPage();
//        List<BusinessLabel> list = businessLabelService.selectBusinessLabelList(businessLabel);
//        return getDataTable(list);
//    }

//    /**
//     * 导出项目标签列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:label:export')")
//    @Log(title = "项目标签", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, BusinessLabel businessLabel)
//    {
//        List<BusinessLabel> list = businessLabelService.selectBusinessLabelList(businessLabel);
//        ExcelUtil<BusinessLabel> util = new ExcelUtil<BusinessLabel>(BusinessLabel.class);
//        util.exportExcel(response, list, "项目标签数据");
//    }

//    /**
//     * 获取项目标签详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:label:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return success(businessLabelService.selectBusinessLabelById(id));
//    }


//    /**
//     * 修改项目标签
//     */
//    @PreAuthorize("@ss.hasPermi('system:label:edit')")
//    @Log(title = "项目标签", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody BusinessLabel businessLabel)
//    {
//        return toAjax(businessLabelService.updateBusinessLabel(businessLabel));
//    }
}
