Pu Zhibing
2025-05-08 5b64f31f1d35b38b51935b5fa7f4b8cf46fbf4cf
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
package com.ruoyi.other.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Operator;
import com.ruoyi.other.service.OperatorService;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 * @author zhibing.pu
 * @Date 2025/1/22 15:12
 */
@RestController
@RequestMapping("/operator")
public class OperatorController {
    
    @Resource
    private OperatorService operatorService;
    
    
    
    /**
     * 获取运营商数据
     * @param id
     * @return
     */
    @PostMapping("/getOperatorById")
    public R<Operator> getOperatorById(@RequestParam("id") Integer id){
        Operator operator = operatorService.getById(id);
        return R.ok(operator);
    }
    
    
    
    /**
     * 获取运营商数据
     * @param name
     * @return
     */
    @PostMapping("/getOperatorByName")
    public R<Operator> getOperatorByName(@RequestParam("name") String name){
        Operator operator = operatorService.getOne(new LambdaQueryWrapper<Operator>().eq(Operator::getName, name));
        return R.ok(operator);
    }
    
    
    
    
    /**
     * 获取运营商数据
     * @param operatorId
     * @return
     */
    @PostMapping("/getOperator")
    public R<Operator> getOperator(@RequestParam("operatorId") String operatorId){
        Operator operator = operatorService.getOne(new LambdaQueryWrapper<Operator>().eq(Operator::getOperatorId, operatorId));
        return R.ok(operator);
    }
    
    
    
    /**
     * 获取所有运营商
     * @return
     */
    @PostMapping("/getAllOperator")
    public R<List<Operator>> getAllOperator(){
        List<Operator> list = operatorService.list();
        return R.ok(list);
    }
    
    
    
    /**
     * 更新运营商数据
     * @return
     */
    @PostMapping("/editOperator")
    public R editOperator(@RequestBody Operator operator){
        operatorService.updateById(operator);
        return R.ok();
    }
}