package com.dsk.web.controller.business;

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

import com.dsk.common.core.domain.entity.BusinessBacklog;
import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.system.service.IBusinessBacklogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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
 */
@Api("项目工作待办")
@RestController
@RequestMapping("/business/backlog")
@Slf4j
public class BusinessBacklogController extends BaseController
{
    @Autowired
    private IBusinessBacklogService businessBacklogService;

    /**
     * 分页查询项目工作待办列表
     */
//    @PreAuthorize("@ss.hasPermi('system:backlog:list')")
    @GetMapping("/list")
    public TableDataInfo list(@RequestBody BusinessBacklog businessBacklog)
    {
        startPage();
        List<BusinessBacklog> list = businessBacklogService.selectBusinessBacklogList(businessBacklog);
        return getDataTable(list);
    }

    /**
     * 新增项目工作待办
     */
    @ApiOperation("新增项目工作待办")
//    @PreAuthorize("@ss.hasPermi('system:backlog:add')")
//    @Log(title = "项目工作待办", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody BusinessBacklog businessBacklog)
    {
        return toAjax(businessBacklogService.insertBusinessBacklog(businessBacklog));
    }

    /**
     * 修改项目工作待办
     */
//    @PreAuthorize("@ss.hasPermi('system:backlog:edit')")
//    @Log(title = "项目工作待办", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusinessBacklog businessBacklog)
    {
        return toAjax(businessBacklogService.updateBusinessBacklog(businessBacklog));
    }

//    /**
//     * 导出项目工作待办列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:backlog:export')")
//    @Log(title = "项目工作待办", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, BusinessBacklog businessBacklog)
//    {
//        List<BusinessBacklog> list = businessBacklogService.selectBusinessBacklogList(businessBacklog);
//        ExcelUtil<BusinessBacklog> util = new ExcelUtil<BusinessBacklog>(BusinessBacklog.class);
//        util.exportExcel(response, list, "项目工作待办数据");
//    }

//    /**
//     * 获取项目工作待办详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:backlog:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return success(businessBacklogService.selectBusinessBacklogById(id));
//    }

//    /**
//     * 删除项目工作待办
//     */
//    @PreAuthorize("@ss.hasPermi('system:backlog:remove')")
//    @Log(title = "项目工作待办", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@PathVariable Long[] ids)
//    {
//        return toAjax(businessBacklogService.deleteBusinessBacklogByIds(ids));
//    }
}
