package com.aucma.dms.controller;

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.DmsBaseStationProject;
import com.aucma.dms.service.IDmsBaseStationProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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


/**
 * 保养部位关联项目信息Controller
 * 
 * @author zangch
 * @date 2024-09-23
 */
@RestController
@RequestMapping("/dms/baseStationProject")
public class DmsBaseStationProjectController extends BaseController
{
    @Autowired
    private IDmsBaseStationProjectService dmsBaseStationProjectService;

    /**
     * 查询保养部位关联项目信息列表
     */
/*    //@PreAuthorize("@ss.hasPermi('dms:baseStationProject:list')" )*/
    @GetMapping("/list")
    public TableDataInfo list(DmsBaseStationProject dmsBaseStationProject)
    {
        startPage();
        List<DmsBaseStationProject> list = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject);
        return getDataTable(list);
    }

    /**
     * 导出保养部位关联项目信息列表
     */
/*    //@PreAuthorize("@ss.hasPermi('dms:baseStationProject:export')" )*/
    ////@Log(title = "保养部位关联项目信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DmsBaseStationProject dmsBaseStationProject)
    {
        List<DmsBaseStationProject> list = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject);
        ExcelUtil<DmsBaseStationProject> util = new ExcelUtil<DmsBaseStationProject>(DmsBaseStationProject.class);
        util.exportExcel(response, list, "保养部位关联项目信息数据");
    }

    /**
     * 获取保养部位关联项目信息详细信息
     */
/*    //@PreAuthorize("@ss.hasPermi('dms:baseStationProject:query')" )*/
    @GetMapping(value = "/{maintStationId}")
    public AjaxResult getInfo(@PathVariable("maintStationId") Long maintStationId)
    {
        return success(dmsBaseStationProjectService.selectDmsBaseStationProjectByMaintStationId(maintStationId));
    }

    /**
     * 新增保养部位关联项目信息
     */
/*    //@PreAuthorize("@ss.hasPermi('dms:baseStationProject:add')" )*/
    ////@Log(title = "保养部位关联项目信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DmsBaseStationProject dmsBaseStationProject)
    {
        return toAjax(dmsBaseStationProjectService.insertDmsBaseStationProject(dmsBaseStationProject));
    }

    /**
     * 修改保养部位关联项目信息
     */
/*    //@PreAuthorize("@ss.hasPermi('dms:baseStationProject:edit')" )*/
    ////@Log(title = "保养部位关联项目信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DmsBaseStationProject dmsBaseStationProject)
    {
        return toAjax(dmsBaseStationProjectService.updateDmsBaseStationProject(dmsBaseStationProject));
    }

    /**
     * 删除保养部位关联项目信息
     */
/*    //@PreAuthorize("@ss.hasPermi('dms:baseStationProject:remove')" )*/
    ////@Log(title = "保养部位关联项目信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{maintStationIds}")
    public AjaxResult remove(@PathVariable Long[] maintStationIds)
    {
        return toAjax(dmsBaseStationProjectService.deleteDmsBaseStationProjectByMaintStationIds(maintStationIds));
    }

/*    @GetMapping("/treeselect")
    public AjaxResult stationProjectTreeselect(DmsBaseStationProject dmsBaseStationProject)
    {
        List<DmsBaseStationProject> dmsBaseStationProjects = dmsBaseStationProjectService.selectDmsBaseStationProjectList(dmsBaseStationProject);
        return success(dmsBaseStationProjects);
    }*/
}
