package com.ruoyi.web.controller.project;

import java.util.List;

import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.project.BmConstructionEq;
import com.ruoyi.system.service.project.IBmConstructionEqService;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 项目设备安装
(最少一条记录)Controller
 * 
 * @author ruoyi
 * @date 2021-03-08
 */
@RestController
@RequestMapping("/constructionEq/constructionEq")
public class BmConstructionEqController extends BaseController
{
    @Autowired
    private IBmConstructionEqService bmConstructionEqService;

    /**
     * 查询项目设备安装
(最少一条记录)列表
     */
    @PreAuthorize("@ss.hasPermi('constructionEq:constructionEq:list')")
    @GetMapping("/list")
    public TableDataInfo list(BmConstructionEq bmConstructionEq)
    {
        startPage();
        List<BmConstructionEq> list = bmConstructionEqService.selectBmConstructionEqList(bmConstructionEq);
        return getDataTable(list);
    }

    /**
     * 导出项目设备安装
(最少一条记录)列表
     */
    @PreAuthorize("@ss.hasPermi('constructionEq:constructionEq:export')")
    @Log(title = "项目设备安装 (最少一条记录)", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BmConstructionEq bmConstructionEq)
    {
        List<BmConstructionEq> list = bmConstructionEqService.selectBmConstructionEqList(bmConstructionEq);
        ExcelUtil<BmConstructionEq> util = new ExcelUtil<BmConstructionEq>(BmConstructionEq.class);
        return util.exportExcel(list, "constructionEq");
    }

    /**
     * 获取项目设备安装
(最少一条记录)详细信息
     */
    @PreAuthorize("@ss.hasPermi('constructionEq:constructionEq:query')")
    @GetMapping(value = "/{bmProjectId}")
    public AjaxResult getInfo(@PathVariable("bmProjectId") Long id)
    {
        return AjaxResult.success(bmConstructionEqService.selectBmConstructionEqById(id));
    }

    /**
     * 新增项目设备安装
(最少一条记录)
     */
    @PreAuthorize("@ss.hasPermi('constructionEq:constructionEq:add')")
    @Log(title = "项目设备安装 (最少一条记录)", businessType = BusinessType.INSERT)
    @PostMapping
    @RepeatSubmit
    public AjaxResult add(@RequestBody BmConstructionEq bmConstructionEq)
    {
        return toAjax(bmConstructionEqService.insertBmConstructionEq(bmConstructionEq));
    }

    /**
     * 修改项目设备安装
(最少一条记录)
     */
    @PreAuthorize("@ss.hasPermi('constructionEq:constructionEq:edit')")
    @Log(title = "项目设备安装 (最少一条记录)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BmConstructionEq bmConstructionEq)
    {
        return toAjax(bmConstructionEqService.updateBmConstructionEq(bmConstructionEq));
    }

    /**
     * 删除项目设备安装
(最少一条记录)
     */
    @PreAuthorize("@ss.hasPermi('constructionEq:constructionEq:remove')")
    @Log(title = "项目设备安装 (最少一条记录)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bmConstructionEqService.deleteBmConstructionEqByIds(ids));
    }
}
