TInspectionDataController.java 3.57 KB
Newer Older
1
package com.zehong.web.controller.deviceInspection;
2 3 4 5

import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
6
import com.zehong.common.core.page.TableDataInfo;
7
import com.zehong.common.enums.BusinessType;
8
import com.zehong.common.utils.poi.ExcelUtil;
9 10
import com.zehong.system.domain.TInspectionData;
import com.zehong.system.service.ITInspectionDataService;
11 12 13 14 15
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;
16 17 18 19 20 21 22 23

/**
 * 巡检记录Controller
 * 
 * @author zehong
 * @date 2021-07-09
 */
@RestController
24
@RequestMapping("/deviceInspection/inspectionData")
25 26 27 28 29 30 31 32
public class TInspectionDataController extends BaseController
{
    @Autowired
    private ITInspectionDataService tInspectionDataService;

    /**
     * 查询巡检记录列表
     */
33
    @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionData:list')")
34 35 36 37 38 39 40 41
    @GetMapping("/list")
    public TableDataInfo list(TInspectionData tInspectionData)
    {
        startPage();
        List<TInspectionData> list = tInspectionDataService.selectTInspectionDataList(tInspectionData);
        return getDataTable(list);
    }

42 43 44 45 46 47 48 49 50 51
    /**
     * 获取所有巡检记录
     * @param tInspectionData
     * @return
     */
    @GetMapping("/getAllTInspectionInfo")
    public AjaxResult getAllTInspectionInfo(TInspectionData tInspectionData){
        return AjaxResult.success(tInspectionDataService.selectTInspectionDataList(tInspectionData));
    }

52 53 54
    /**
     * 导出巡检记录列表
     */
55
    @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionData:export')")
56 57 58 59 60 61 62 63 64 65 66 67
    @Log(title = "巡检记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TInspectionData tInspectionData)
    {
        List<TInspectionData> list = tInspectionDataService.selectTInspectionDataList(tInspectionData);
        ExcelUtil<TInspectionData> util = new ExcelUtil<TInspectionData>(TInspectionData.class);
        return util.exportExcel(list, "巡检记录数据");
    }

    /**
     * 获取巡检记录详细信息
     */
68
    @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionData:query')")
69
    @GetMapping(value = "/{dataId}")
70
    public AjaxResult getInfo(@PathVariable("dataId") int dataId)
71 72 73 74 75 76 77
    {
        return AjaxResult.success(tInspectionDataService.selectTInspectionDataById(dataId));
    }

    /**
     * 新增巡检记录
     */
78
    @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionData:add')")
79 80 81 82 83 84 85 86 87 88
    @Log(title = "巡检记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInspectionData tInspectionData)
    {
        return toAjax(tInspectionDataService.insertTInspectionData(tInspectionData));
    }

    /**
     * 修改巡检记录
     */
89
    @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionData:edit')")
90 91 92 93 94 95 96 97 98 99
    @Log(title = "巡检记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInspectionData tInspectionData)
    {
        return toAjax(tInspectionDataService.updateTInspectionData(tInspectionData));
    }

    /**
     * 删除巡检记录
     */
100
    @PreAuthorize("@ss.hasPermi('deviceInspection:inspectionData:remove')")
101 102
    @Log(title = "巡检记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dataIds}")
103
    public AjaxResult remove(@PathVariable int[] dataIds)
104 105 106 107
    {
        return toAjax(tInspectionDataService.deleteTInspectionDataByIds(dataIds));
    }
}