package com.aucma.dms.controller;

//import com.hw.common.core.utils.poi.ExcelUtil;
//import com.hw.common.core.web.controller.BaseController;
//import com.hw.common.core.web.domain.AjaxResult;
//import com.hw.common.core.web.page.TableDataInfo;
//import com.hw.common.log.annotation.Log;
//import com.hw.common.log.enums.BusinessType;
//import com.hw.common.security.annotation.RequiresPermissions;
//import com.aucma.dms.domain.DmsBaseOutsrcInfo;
//import com.aucma.dms.service.IDmsBaseOutsrcInfoService;

import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.core.page.TableDataInfo;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.dms.domain.DmsBaseOutsrcInfo;
import com.aucma.dms.service.IDmsBaseOutsrcInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

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

/**
 * 外协信息Controller
 * 
 * @author Open Platform
 * @date 2024-01-11
 */
@RestController
@RequestMapping("/dms/dmsInfo")
public class DmsBaseOutsrcInfoController extends BaseController
{
    @Autowired
    private IDmsBaseOutsrcInfoService dmsBaseOutsrcInfoService;

    /**
     * 查询外协信息列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsInfo:list')" )
    @GetMapping("/list")
    public TableDataInfo list(DmsBaseOutsrcInfo dmsBaseOutsrcInfo)
    {
        startPage();
        List<DmsBaseOutsrcInfo> list = dmsBaseOutsrcInfoService.selectDmsBaseOutsrcInfoList(dmsBaseOutsrcInfo);
        return getDataTable(list);
    }

    /**
     * 导出外协信息列表
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsInfo:export')" )
    //@Log(title = "外协信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DmsBaseOutsrcInfo dmsBaseOutsrcInfo)
    {
        List<DmsBaseOutsrcInfo> list = dmsBaseOutsrcInfoService.selectDmsBaseOutsrcInfoList(dmsBaseOutsrcInfo);
        ExcelUtil<DmsBaseOutsrcInfo> util = new ExcelUtil<DmsBaseOutsrcInfo>(DmsBaseOutsrcInfo.class);
        util.exportExcel(response, list, "外协信息数据");
    }

    /**
     * 获取外协信息详细信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsInfo:query')" )
    @GetMapping(value = "/{outsrcId}")
    public AjaxResult getInfo(@PathVariable("outsrcId") Long outsrcId)
    {
        return success(dmsBaseOutsrcInfoService.selectDmsBaseOutsrcInfoByOutsrcId(outsrcId));
    }

    /**
     * 新增外协信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsInfo:add')" )
    //@Log(title = "外协信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DmsBaseOutsrcInfo dmsBaseOutsrcInfo)
    {
        return toAjax(dmsBaseOutsrcInfoService.insertDmsBaseOutsrcInfo(dmsBaseOutsrcInfo));
    }

    /**
     * 修改外协信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsInfo:edit')" )
    //@Log(title = "外协信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DmsBaseOutsrcInfo dmsBaseOutsrcInfo)
    {
        return toAjax(dmsBaseOutsrcInfoService.updateDmsBaseOutsrcInfo(dmsBaseOutsrcInfo));
    }

    /**
     * 删除外协信息
     */
    //@PreAuthorize("@ss.hasPermi('dms:dmsInfo:remove')" )
    //@Log(title = "外协信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{outsrcIds}")
    public AjaxResult remove(@PathVariable Long[] outsrcIds)
    {
        return toAjax(dmsBaseOutsrcInfoService.deleteDmsBaseOutsrcInfoByOutsrcIds(outsrcIds));
    }
}
