package com.dsk.web.controller.business;

import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.domain.entity.BusinessLabel;
import com.dsk.system.domain.business.dto.BusinessIdDto;
import com.dsk.system.service.IBusinessLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目标签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));
//    }
}
