whycxzp
2024-07-23 c33de1c323ecf239706fe79c25044236ebc827a8
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
package com.whyc.controller;
 
import com.whyc.dto.Response;
import com.whyc.pojo.EleTmp;
import com.whyc.service.EleTmpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@RequestMapping("eleTmp")
@RestController
@Api(tags = "数据管理-电价分布模板")
public class EleTmpController extends BaseController{
    @Resource
    private EleTmpService service;
 
    @PostMapping
    @ApiOperation(value = "添加",notes = "添加到模板表")
    public Response add(@RequestBody EleTmp eleTmp){
        EleTmp tmp = service.judgeByTmpName(eleTmp.getTmpName());
        if (tmp!=null){
            return new Response().set(0,"该模板已存在");
        }else {
            return service.add(eleTmp);
        }
    }
    @PostMapping("update")
    @ApiOperation(value = "更新")
    public Response update(@RequestBody EleTmp eleTmp){
        return service.update(eleTmp);
    }
    @PostMapping("delete")
    @ApiOperation(value = "删除")
    public Response delete(int tmpId){
        return service.deleteByTmpId(tmpId);
    }
 
    @GetMapping("/getAllEleTmpList")
    @ApiOperation(value = "获取列表")
    public Response getAllEleTmpList(){
        return service.getAllEleTmpList();
    }
 
 
}