提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.data.point.controller.admin; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
6bf63b
|
4 |
import com.iailab.framework.common.pojo.PageResult; |
L |
5 |
import com.iailab.framework.common.util.object.BeanUtils; |
a6de49
|
6 |
import com.iailab.module.data.point.dto.DaPointDTO; |
6bf63b
|
7 |
import com.iailab.module.data.point.entity.DaPointEntity; |
a6de49
|
8 |
import com.iailab.module.data.point.service.DaPointService; |
6bf63b
|
9 |
import com.iailab.module.data.point.vo.DaPointPageReqVO; |
L |
10 |
import com.iailab.module.data.point.vo.DaPointRespVO; |
a6de49
|
11 |
import io.swagger.v3.oas.annotations.Operation; |
H |
12 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
13 |
import org.springframework.transaction.annotation.Transactional; |
|
14 |
import org.springframework.validation.annotation.Validated; |
|
15 |
import org.springframework.web.bind.annotation.*; |
|
16 |
|
6bf63b
|
17 |
import javax.annotation.Resource; |
L |
18 |
import javax.validation.Valid; |
a6de49
|
19 |
import java.util.List; |
H |
20 |
import java.util.Map; |
6bf63b
|
21 |
import java.util.UUID; |
a6de49
|
22 |
|
H |
23 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
24 |
|
|
25 |
|
|
26 |
/** |
6bf63b
|
27 |
* @author lirm |
a6de49
|
28 |
* @Description |
6bf63b
|
29 |
* @createTime 2024年09月2日 |
a6de49
|
30 |
*/ |
H |
31 |
@Tag(name = "数据采集,测点") |
|
32 |
@RestController |
|
33 |
@RequestMapping("/data/da/point") |
|
34 |
@Validated |
|
35 |
public class DaPointController { |
|
36 |
|
|
37 |
@Resource |
|
38 |
private DaPointService daPointService; |
|
39 |
|
|
40 |
@GetMapping("page") |
6bf63b
|
41 |
public CommonResult<PageResult<DaPointRespVO>> page(@Valid DaPointPageReqVO reqVO){ |
L |
42 |
PageResult<DaPointEntity> page = daPointService.queryPage(reqVO); |
|
43 |
return success(BeanUtils.toBean(page, DaPointRespVO.class)); |
a6de49
|
44 |
} |
H |
45 |
|
|
46 |
@GetMapping("/list") |
|
47 |
@Operation(summary = "列表") |
|
48 |
public CommonResult<List<DaPointDTO>> list(@Valid @RequestParam Map<String, Object> params) { |
|
49 |
List<DaPointDTO> list = daPointService.list(params); |
|
50 |
return success(list); |
|
51 |
} |
|
52 |
|
6bf63b
|
53 |
@GetMapping("/info/{id}") |
L |
54 |
public CommonResult<DaPointDTO> info(@PathVariable("id") String id){ |
|
55 |
DaPointDTO info= daPointService.info(id); |
|
56 |
return success(info); |
a6de49
|
57 |
} |
H |
58 |
|
6bf63b
|
59 |
@PostMapping("/add") |
L |
60 |
public CommonResult<Boolean> add(@RequestBody DaPointDTO daPointDTO){ |
|
61 |
String id = UUID.randomUUID().toString(); |
|
62 |
daPointDTO.setId(id); |
|
63 |
daPointService.add(daPointDTO); |
|
64 |
return success(true); |
a6de49
|
65 |
} |
H |
66 |
|
6bf63b
|
67 |
@PutMapping("/update") |
L |
68 |
public CommonResult<Boolean> update(@RequestBody DaPointDTO daPointDTO) { |
|
69 |
daPointService.update(daPointDTO); |
|
70 |
return success(true); |
|
71 |
} |
|
72 |
|
|
73 |
@DeleteMapping("/delete") |
|
74 |
public CommonResult<Boolean> delete(String[] ids) { |
a6de49
|
75 |
daPointService.delete(ids); |
6bf63b
|
76 |
return success(true); |
a6de49
|
77 |
} |
H |
78 |
|
|
79 |
@GetMapping("pointNo") |
|
80 |
public CommonResult<List<DaPointDTO>> getpoint(@RequestParam Map<String, Object> params){ |
|
81 |
List<DaPointDTO> list = daPointService.list(params); |
|
82 |
|
|
83 |
return new CommonResult<List<DaPointDTO>>().setData(list); |
|
84 |
} |
|
85 |
|
|
86 |
@PutMapping("/enable") |
|
87 |
@Operation(summary = "启用") |
|
88 |
@Transactional |
6bf63b
|
89 |
public CommonResult<Boolean> enable(@RequestBody String[] ids) { |
a6de49
|
90 |
daPointService.enableByIds(ids); |
6bf63b
|
91 |
return success(true); |
a6de49
|
92 |
} |
H |
93 |
|
|
94 |
@PutMapping("/disable") |
|
95 |
@Operation(summary = "禁用") |
|
96 |
@Transactional |
6bf63b
|
97 |
public CommonResult<Boolean> disable(@RequestBody String[] ids) { |
a6de49
|
98 |
daPointService.disableByIds(ids); |
6bf63b
|
99 |
return success(true); |
a6de49
|
100 |
} |
H |
101 |
|
|
102 |
} |