13693261870
2025-07-02 6708810c4de34dfb9513061432d656f91d56ee3a
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
package com.ruoyi.web.controller.manage;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.manage.domain.DpShipDevice;
import com.ruoyi.manage.domain.DpShips;
import com.ruoyi.manage.service.DpShipDeviceService;
import com.ruoyi.manage.service.DpShipsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <p>
 * 舰艇设备表 前端控制器
 * </p>
 *
 * @author sunjiawei
 * @since 2025-03-12
 */
@Tag(name = "大屏--舰船设备管理")
@RestController
@RequestMapping("/dp/dpShipDevice")
public class DpShipDeviceController {
    @Resource
    private DpShipDeviceService dpShipDeviceService;
    @Resource
    private DpShipsService dpShipsService;
 
    @Operation(summary = "新增舰船设备数据")
    @PostMapping("/insertDpShipDevice")
    public R<Boolean> insertDpShipDevice(@RequestBody DpShipDevice dpShipDevice) {
        QueryWrapper<DpShipDevice> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("DEVICE_NAME",dpShipDevice.getDeviceName());
        if(!dpShipDeviceService.exists(queryWrapper)){
            return R.ok(dpShipDeviceService.save(dpShipDevice));
        }else {
            return R.fail("名称已存在");
        }
 
    }
 
    @Operation(summary = "更新舰船设备数据")
    @PostMapping("/updateDpShipDevice")
    public R<Boolean> updateDpShipDevice(@RequestBody DpShipDevice dpShipDevice) {
        return R.ok(dpShipDeviceService.updateById(dpShipDevice));
    }
 
    @Operation(summary = "删除舰船设备数据")
    @GetMapping("/deleteDpShipDevice")
    public R<Boolean> deleteDpShipDevice( String id) {
        return R.ok(dpShipDeviceService.removeById(id));
    }
 
    @Operation(summary = "根据ID获取舰船设备数据")
    @GetMapping ("/getDpShipDeviceByID")
    public R<DpShipDevice> getDpShipDeviceByID( String id) {
        DpShipDevice dpShipDevice = dpShipDeviceService.selectDpShipDevice(id);
        return R.ok(dpShipDevice);
    }
 
    @Operation(summary = "根据名称获取舰船设备数据")
    @GetMapping ("/getDpShipDeviceByName")
    public R<DpShipDevice> getDpShipDeviceByName(String name) {
        DpShipDevice dpShipDevice = dpShipDeviceService.selectDpShipDeviceByName(name);
        return R.ok(dpShipDevice);
    }
 
    @Operation(summary = "获取舰船设备数据列表")
    @GetMapping ("/getDpShipDevices")
    public R<List<DpShipDevice>> getDpShipDevices() {
        return R.ok(dpShipDeviceService.getDpShipDevices());
    }
 
    @Operation(summary = "获取舰船设备分页列表")
    @GetMapping ("/getDpShipDevicesPage")
    public TableDataInfo getDpShipDevicesPage(DpShipDevice shipDevice) {
        return dpShipDeviceService.getDpShipDevicesPage(shipDevice);
    }
 
    @Operation(summary = "根据舰船编号查询设备列表")
    @GetMapping("/selectDpShipDeviceByShipId")
    public R<List<DpShipDevice>> selectDpShipDeviceByShipId( String deviceShipId) {
        return R.ok(dpShipDeviceService.selectDpShipDeviceByShipId(deviceShipId));
    }
 
 
}