zhibing.pu
2024-08-10 1916f55359bb6c8f34548c26767569b000decbfc
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package com.ruoyi.chargingPile.controller;
 
 
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.query.TChargingGunQuery;
import com.ruoyi.chargingPile.api.vo.TChargingGunVO;
import com.ruoyi.chargingPile.service.TChargingGunService;
import com.ruoyi.chargingPile.service.TChargingPileService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO;
import com.ruoyi.chargingPile.api.model.TChargingPile;
import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy;
import com.ruoyi.chargingPile.service.TChargingPileService;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.chargingPile.api.query.PageChargingPileList;
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.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <p>
 * 充电桩 前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-08-06
 */
@Api(tags = "充电桩")
@RestController
@RequestMapping("/t-charging-pile")
public class TChargingPileController {
 
    private final TChargingPileService chargingPileService;
 
    @Autowired
    public TChargingPileController(TChargingPileService chargingPileService) {
        this.chargingPileService = chargingPileService;
    }
 
    /**
     * 查询充电桩列表
     */
    @ApiOperation(tags = {"小程序-充电桩"},value = "查询充电桩列表")
    @PostMapping(value = "/list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "siteId", value = "站点id")
    })
    public AjaxResult<List<TChargingPile>> list(@RequestParam("siteId") Integer siteId) {
        return AjaxResult.ok(chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class)
                .eq(TChargingPile::getSiteId,siteId)));
    }
    
    
    
    @ResponseBody
    @GetMapping("/pageChargingPileList")
    @ApiOperation(value = "获取充电桩列表数据", tags = {"管理后台-充电桩信息"})
    public AjaxResult<PageInfo<PageChargingPileListDTO>> pageChargingPileList(@RequestBody PageChargingPileList page){
        PageInfo<PageChargingPileListDTO> list = chargingPileService.pageChargingPileList(page);
        return AjaxResult.success(list);
    }
    
    @ResponseBody
    @Log(title = "添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
    @PostMapping("/addChargingPile")
    @ApiOperation(value = "添加充电桩数据", tags = {"管理后台-充电桩信息"})
    public AjaxResult addChargingPile(@RequestBody TChargingPile chargingPile){
        return chargingPileService.addChargingPile(chargingPile);
    }
    
    
    @ResponseBody
    @GetMapping("/getChargingPile/{id}")
    @ApiOperation(value = "获取充电桩详情数据", tags = {"管理后台-充电桩信息"})
    public AjaxResult<TChargingPile> getChargingPile(@PathVariable Integer id){
        TChargingPile chargingPile = chargingPileService.getChargingPile(id);
        return AjaxResult.success(chargingPile);
    }
    
    
    @ResponseBody
    @Log(title = "编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
    @PostMapping("/editChargingPile")
    @ApiOperation(value = "编辑充电桩数据", tags = {"管理后台-充电桩信息"})
    public AjaxResult editChargingPile(@RequestBody TChargingPile chargingPile){
        return chargingPileService.editChargingPile(chargingPile);
    }
    
    
    
    @ResponseBody
    @DeleteMapping("/delChargingPile/{id}")
    @Log(title = "删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
    @ApiOperation(value = "删除充电桩", tags = {"管理后台-充电桩信息"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "充电桩id", name = "id", dataTypeClass = Integer.class, required = true)
    })
    public AjaxResult delChargingPile(@PathVariable Integer[] id){
        return chargingPileService.delChargingPile(id);
    }
    
    
    @ResponseBody
    @Log(title = "批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
    @PostMapping("/batchSetAccountingStrategy")
    @ApiOperation(value = "批量设置计费策略", tags = {"管理后台-充电桩信息"})
    public AjaxResult batchSetAccountingStrategy(@RequestBody BatchSetAccountingStrategy setAccountingStrategy){
        chargingPileService.batchSetAccountingStrategy(setAccountingStrategy);
        return AjaxResult.success();
    }
    
    
    
    
}