zhibing.pu
2024-09-11 aa7727d8ed9eca34f8126c3dc5a80fbdf9ad56cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.ruoyi.chargingPile.controller;
 
 
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.api.model.TRepair;
import com.ruoyi.chargingPile.service.TRepairService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.BasePage;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.log.enums.OperatorType;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-08
 */
@RestController
@RequestMapping("/t-repair")
public class TRepairController {
 
    @Resource
    private TRepairService repairService;
    
    
    @ResponseBody
    @GetMapping("/getRepairList")
    @ApiOperation(value = "获取报修记录列表数据", tags = {"管理后台-设备监控"})
    public AjaxResult<PageInfo<TRepair>> getRepairList(String name, String siteId, BasePage basePage){
        PageInfo<TRepair> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize());
        List<TRepair> repairList = repairService.getRepairList(pageInfo, name, siteId);
        pageInfo.setRecords(repairList);
        return AjaxResult.success(pageInfo);
    }
    
    
    
    
    @ResponseBody
    @PostMapping("/addRepair")
    @ApiOperation(value = "添加报修记录", tags = {"管理后台-设备监控"})
    @Log(title = "【设备监控】添加报修记录", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
    public AjaxResult addRepair(@RequestBody TRepair repair){
        repairService.save(repair);
        return AjaxResult.success();
    }
    
    
    @ResponseBody
    @DeleteMapping("/delRepair/{id}")
    @ApiOperation(value = "删除报修记录", tags = {"管理后台-设备监控"})
    @Log(title = "【设备监控】删除报修记录", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
    public AjaxResult delRepair(@PathVariable Integer id){
        repairService.removeById(id);
        return AjaxResult.success();
    }
}