无关风月
2024-09-05 a3aa8bd77b4a9a74601238cc467cfd115b0821b6
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.ruoyi.chargingPile.controller;
 
 
import com.ruoyi.chargingPile.api.dto.TChargingGunDTO;
import com.ruoyi.chargingPile.api.model.TFaultMessage;
import com.ruoyi.chargingPile.service.TChargingPileService;
import com.ruoyi.chargingPile.service.TFaultMessageService;
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.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-08
 */
@RestController
@RequestMapping("/t-fault-message")
public class TFaultMessageController {
 
    private final TFaultMessageService faultMessageService;
 
    @Autowired
    public TFaultMessageController(TFaultMessageService faultMessageService) {
        this.faultMessageService = faultMessageService;
    }
 
    /**
     * 添加故障报修管理
     */
    @Log(title = "添加故障报修管理", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE)
    @ApiOperation(tags = {"小程序-故障报修"},value = "添加故障报修管理")
    @PostMapping(value = "/add")
    public AjaxResult<String> add(@Validated @RequestBody TFaultMessage dto) {
        faultMessageService.add(dto);
        return AjaxResult.success();
    }
    
    
    /**
     * 获取故障信息列表
     * @param siteId
     * @param basePage
     * @return
     */
    @ResponseBody
    @GetMapping("/getFaultMessageList")
    @ApiOperation(value = "获取故障信息列表数据", tags = {"管理后台-设备监控"})
    public AjaxResult<PageInfo<TFaultMessage>> getFaultMessageList(Integer siteId, BasePage basePage){
        PageInfo<TFaultMessage> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize());
        List<TFaultMessage> faultMessageList = faultMessageService.getFaultMessageList(pageInfo, siteId);
        pageInfo.setRecords(faultMessageList);
        return AjaxResult.success(pageInfo);
    }
    
    
    @ResponseBody
    @PostMapping("/addFaultMessage")
    @ApiOperation(value = "添加故障信息", tags = {"管理后台-设备监控"})
    public AjaxResult addFaultMessage(@RequestBody TFaultMessage faultMessage){
        faultMessageService.save(faultMessage);
        return AjaxResult.success();
    }
    
    
    @ResponseBody
    @DeleteMapping("/delFaultMessage/{id}")
    @ApiOperation(value = "删除故障信息", tags = {"管理后台-设备监控"})
    public AjaxResult delFaultMessage(@PathVariable Integer id){
        faultMessageService.removeById(id);
        return AjaxResult.success();
    }
}