package com.zd.laboratory.controller;

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

import com.zd.common.core.domain.per.PerFun;
import com.zd.common.core.domain.per.PerPrefix;
import com.zd.common.core.web.domain.ResultData;
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.zd.common.log.annotation.Log;
import com.zd.common.log.enums.BusinessType;
import com.zd.common.security.annotation.PreAuthorize;
import com.zd.laboratory.domain.LabProcessSite;
import com.zd.laboratory.service.ILabProcessSiteService;
import com.zd.common.core.web.controller.BaseController;
import com.zd.common.core.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.zd.common.core.web.page.TableDataInfo;

/**
 * 违��-处理方式设置Controller
 *
 * @author zd
 * @date 2021-12-13
 */
@RestController
@Api(tags = "【违��-处理方式设置】")
//作者手动加入 ，在接口上加作者@ApiOperationSupport(author = "XXX")
@RequestMapping("/processSite")
public class LabProcessSiteController extends BaseController
{
    @Autowired
    private ILabProcessSiteService labProcessSiteService;

    /**
     * 查询违��-处理方式设置列表
     */
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_PROCESSSITE + PerFun.LIST)
    @GetMapping("/list")
    @ApiOperation(value = "查询违��-处理方式设置列表")
    public TableDataInfo<LabProcessSite> list(LabProcessSite labProcessSite)
    {
        startPage();
        List<LabProcessSite> list = labProcessSiteService.selectLabProcessSiteList(labProcessSite);
        return getDataTable(list);
    }

    /**
     * 导出违��-处理方式设置列表
     */
    @ApiOperation(value = "导出违��-处理方式设置列表")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_PROCESSSITE + PerFun.EXPORT)
    @Log(title = "违��-处理方式设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LabProcessSite labProcessSite) throws IOException
    {
        List<LabProcessSite> list = labProcessSiteService.selectLabProcessSiteList(labProcessSite);
        ExcelUtil<LabProcessSite> util = new ExcelUtil<LabProcessSite>(LabProcessSite.class);
        util.exportExcel(response, list, "违��-处理方式设置数据");
    }

    /**
     * 获取违��-处理方式设置详细信息
     */
    @ApiOperation(value = "获取违��-处理方式设置详细信息")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_PROCESSSITE + PerFun.QUERY)
    @GetMapping(value = "/{id}")
    public ResultData<LabProcessSite> getInfo(@PathVariable("id") Long id)
    {
        return ResultData.success(labProcessSiteService.selectLabProcessSiteById(id));
    }

    /**
     * 新增违��-处理方式设置
     */
    @ApiOperation(value = "新增违��-处理方式设置")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_PROCESSSITE + PerFun.ADD)
    @Log(title = "违��-处理方式设置", businessType = BusinessType.INSERT)
    @PostMapping
    public ResultData add(@RequestBody LabProcessSite labProcessSite)
    {
        return ResultData.result(labProcessSiteService.insertLabProcessSite(labProcessSite));
    }

    /**
     * 修改违��-处理方式设置
     */
    @ApiOperation(value = "修改违��-处理方式设置")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_PROCESSSITE + PerFun.EDIT)
    @Log(title = "违��-处理方式设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public ResultData edit(@RequestBody LabProcessSite labProcessSite)
    {
        return  ResultData.result(labProcessSiteService.updateLabProcessSite(labProcessSite));
    }

    /**
     * 删除违��-处理方式设置
     */
    @ApiOperation(value = "删除违��-处理方式设置")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_PROCESSSITE + PerFun.REMOVE)
    @Log(title = "违��-处理方式设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public ResultData remove(@PathVariable Long[] ids)
    {
        return ResultData.result(labProcessSiteService.deleteLabProcessSiteByIds(ids));
    }
}
