Showing
11 changed files
with
331 additions
and
2 deletions
... | ... | @@ -150,6 +150,7 @@ CREATE TABLE "public"."qg_check_details" |
150 | 150 | "check_plan_id" varchar(36), |
151 | 151 | "inspection_plan_id" varchar(36), |
152 | 152 | "plan_details" varchar(255), |
153 | + "show_order" int4, | |
153 | 154 | "tenant_id" varchar(36), |
154 | 155 | "create_time" timestamp(6), |
155 | 156 | "creator" varchar(36), |
... | ... | @@ -164,6 +165,7 @@ COMMENT ON COLUMN "public"."qg_check_details"."check_device_id" IS '巡检设备 |
164 | 165 | COMMENT ON COLUMN "public"."qg_check_details"."check_plan_id" IS '巡检方案'; |
165 | 166 | COMMENT ON COLUMN "public"."qg_check_details"."inspection_plan_id" IS '巡检计划'; |
166 | 167 | COMMENT ON COLUMN "public"."qg_check_details"."plan_details" IS '方案明细'; |
168 | +COMMENT ON COLUMN "public"."qg_check_details"."show_order" IS '排序'; | |
167 | 169 | COMMENT ON COLUMN "public"."qg_check_details"."tenant_id" IS '租户ID'; |
168 | 170 | |
169 | 171 | CREATE TABLE "public"."qg_inspection_record" |
... | ... | @@ -196,6 +198,7 @@ CREATE TABLE "public"."qg_inspection_details" |
196 | 198 | "check_device_id" varchar(36), |
197 | 199 | "plan_details" varchar(255), |
198 | 200 | "record_result" bool, |
201 | + "show_order" int4, | |
199 | 202 | "tenant_id" varchar(36), |
200 | 203 | "create_time" timestamp(6), |
201 | 204 | "creator" varchar(36), |
... | ... | @@ -208,4 +211,5 @@ COMMENT ON COLUMN "public"."qg_inspection_details"."id" IS '主键ID'; |
208 | 211 | COMMENT ON COLUMN "public"."qg_inspection_details"."check_device_id" IS '巡检设备'; |
209 | 212 | COMMENT ON COLUMN "public"."qg_inspection_details"."plan_details" IS '巡检内容'; |
210 | 213 | COMMENT ON COLUMN "public"."qg_inspection_details"."record_result" IS '巡检结果'; |
214 | +COMMENT ON COLUMN "public"."qg_inspection_details"."show_order" IS '排序'; | |
211 | 215 | COMMENT ON COLUMN "public"."qg_inspection_details"."tenant_id" IS '租户ID'; |
\ No newline at end of file | ... | ... |
1 | 1 | package org.thingsboard.server.controller.yunteng; |
2 | 2 | |
3 | 3 | import io.swagger.annotations.Api; |
4 | +import io.swagger.annotations.ApiOperation; | |
4 | 5 | import lombok.RequiredArgsConstructor; |
5 | 6 | import lombok.extern.slf4j.Slf4j; |
6 | -import org.springframework.web.bind.annotation.RequestMapping; | |
7 | -import org.springframework.web.bind.annotation.RestController; | |
7 | +import org.apache.commons.collections4.CollectionUtils; | |
8 | +import org.apache.commons.lang3.StringUtils; | |
9 | +import org.springframework.http.ResponseEntity; | |
10 | +import org.springframework.security.access.prepost.PreAuthorize; | |
11 | +import org.springframework.web.bind.annotation.*; | |
12 | +import org.thingsboard.server.common.data.exception.ThingsboardException; | |
13 | +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | |
14 | +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | |
15 | +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionPlanDTO; | |
16 | +import org.thingsboard.server.common.data.yunteng.enums.TkInspectionPlanStatusEnum; | |
17 | +import org.thingsboard.server.common.data.yunteng.utils.i18n.MessageUtils; | |
18 | +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | |
8 | 19 | import org.thingsboard.server.controller.BaseController; |
9 | 20 | import org.thingsboard.server.dao.yunteng.service.TkInspectionPlanService; |
10 | 21 | import org.thingsboard.server.queue.util.TbCoreComponent; |
11 | 22 | |
23 | +import java.sql.Timestamp; | |
24 | +import java.util.HashMap; | |
25 | +import java.util.Map; | |
26 | + | |
27 | +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE; | |
28 | +import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE_SIZE; | |
29 | + | |
12 | 30 | @RestController |
13 | 31 | @TbCoreComponent |
14 | 32 | @RequiredArgsConstructor |
... | ... | @@ -18,4 +36,71 @@ import org.thingsboard.server.queue.util.TbCoreComponent; |
18 | 36 | public class TkInspectionPlanController extends BaseController { |
19 | 37 | private final TkInspectionPlanService tkInspectionPlanService; |
20 | 38 | |
39 | + @GetMapping(params = {PAGE_SIZE, PAGE}) | |
40 | + @ApiOperation("分页查询") | |
41 | + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | |
42 | + public TkPageData<TkInspectionPlanDTO> page( | |
43 | + @RequestParam(PAGE_SIZE) int pageSize, | |
44 | + @RequestParam(PAGE) int page, | |
45 | + @RequestParam(value = "name", required = false) String name, | |
46 | + @RequestParam(value = "type", required = false) TkInspectionPlanStatusEnum status, | |
47 | + @RequestParam(value = "startTime", required = false) Long startTime, | |
48 | + @RequestParam(value = "endTime", required = false) Long endTime | |
49 | + ) throws ThingsboardException { | |
50 | + Map<String, Object> queryMap = new HashMap<>(); | |
51 | + queryMap.put(PAGE_SIZE, pageSize); | |
52 | + queryMap.put(PAGE, page); | |
53 | + if (StringUtils.isNotBlank(name)) { | |
54 | + queryMap.put("name", name); | |
55 | + } | |
56 | + | |
57 | + if (status != null) { | |
58 | + queryMap.put("status", status); | |
59 | + } | |
60 | + | |
61 | + checkTimeAndPut(queryMap, startTime, endTime); | |
62 | + return tkInspectionPlanService.page(queryMap, getCurrentUser().isTenantAdmin()); | |
63 | + } | |
64 | + | |
65 | + @PostMapping("/save") | |
66 | + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | |
67 | + public ResponseEntity<TkInspectionPlanDTO> save(@RequestBody TkInspectionPlanDTO tkInspectionPlanDTO) throws ThingsboardException { | |
68 | + tkInspectionPlanDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | |
69 | + if (tkInspectionPlanDTO.getStatus() == null) { | |
70 | + tkInspectionPlanDTO.setStatus(TkInspectionPlanStatusEnum.NOT_START); | |
71 | + } | |
72 | + | |
73 | + if (CollectionUtils.isNotEmpty(tkInspectionPlanDTO.getTkCheckDetailsDTOList())) { | |
74 | + tkInspectionPlanDTO.getTkCheckDetailsDTOList() | |
75 | + .forEach(tkCheckDetailsDTO -> tkCheckDetailsDTO.setTenantId(tkCheckDetailsDTO.getTenantId())); | |
76 | + } | |
77 | + | |
78 | + TkInspectionPlanDTO dto = tkInspectionPlanService.save(tkInspectionPlanDTO); | |
79 | + return ResponseEntity.ok(dto); | |
80 | + } | |
81 | + | |
82 | + @GetMapping("/detail") | |
83 | + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | |
84 | + public ResponseEntity<TkInspectionPlanDTO> detail(@RequestParam("id") String id) throws ThingsboardException { | |
85 | + return ResponseEntity.ok(tkInspectionPlanService.get(id)); | |
86 | + } | |
87 | + | |
88 | + @GetMapping("/delete") | |
89 | + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | |
90 | + public ResponseEntity<Boolean> delete(@RequestParam("id") String id) throws ThingsboardException { | |
91 | + return ResponseEntity.ok(tkInspectionPlanService.delete(id)); | |
92 | + } | |
93 | + | |
94 | + protected void checkTimeAndPut(Map<String, Object> queryMap, Long startTime, Long endTime) { | |
95 | + if (null != endTime && null != startTime) { | |
96 | + if (startTime > endTime) { | |
97 | + throw new TkDataValidationException( | |
98 | + MessageUtils.message(ErrorMessage.START_TIME_NOT_MORE_THAN_END_TIME.getI18nCode())); | |
99 | + } | |
100 | + | |
101 | + queryMap.put("startTime", new Timestamp(startTime).toLocalDateTime()); | |
102 | + queryMap.put("endTime", new Timestamp(endTime).toLocalDateTime()); | |
103 | + } | |
104 | + } | |
105 | + | |
21 | 106 | } | ... | ... |
... | ... | @@ -9,6 +9,7 @@ import lombok.EqualsAndHashCode; |
9 | 9 | import org.thingsboard.server.common.data.yunteng.enums.TkInspectionPlanStatusEnum; |
10 | 10 | |
11 | 11 | import java.time.LocalDateTime; |
12 | +import java.util.List; | |
12 | 13 | |
13 | 14 | /** |
14 | 15 | * 巡检计划 |
... | ... | @@ -38,4 +39,7 @@ public class TkInspectionPlanDTO extends TenantDTO { |
38 | 39 | |
39 | 40 | @ApiModelProperty("计划备注") |
40 | 41 | private String remark; |
42 | + | |
43 | + @ApiModelProperty("巡检明细") | |
44 | + private List<TkCheckDetailsDTO> tkCheckDetailsDTOList; | |
41 | 45 | } | ... | ... |
1 | 1 | package org.thingsboard.server.dao.yunteng.impl; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
3 | 5 | import lombok.RequiredArgsConstructor; |
4 | 6 | import lombok.extern.slf4j.Slf4j; |
7 | +import org.apache.commons.collections4.CollectionUtils; | |
8 | +import org.apache.commons.lang3.StringUtils; | |
5 | 9 | import org.springframework.stereotype.Service; |
10 | +import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO; | |
6 | 11 | import org.thingsboard.server.dao.yunteng.entities.TkCheckDetailsEntity; |
7 | 12 | import org.thingsboard.server.dao.yunteng.mapper.TkCheckDetailsMapper; |
8 | 13 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
9 | 14 | import org.thingsboard.server.dao.yunteng.service.TkCheckDetailsService; |
10 | 15 | |
16 | +import java.util.ArrayList; | |
17 | +import java.util.List; | |
18 | +import java.util.stream.Collectors; | |
19 | + | |
11 | 20 | @Service |
12 | 21 | @RequiredArgsConstructor |
13 | 22 | @Slf4j |
14 | 23 | public class TkCheckDetailsServiceImpl extends AbstractBaseService<TkCheckDetailsMapper, TkCheckDetailsEntity> |
15 | 24 | implements TkCheckDetailsService { |
25 | + @Override | |
26 | + public List<TkCheckDetailsDTO> batchSave(List<TkCheckDetailsDTO> checkDetailsDTOList, String inspectionPlanId) { | |
27 | + List<TkCheckDetailsDTO> oldTkCheckDetailsDTOList = listByInspectionPlanId(inspectionPlanId); | |
28 | + if (CollectionUtils.isEmpty(checkDetailsDTOList) && CollectionUtils.isNotEmpty(oldTkCheckDetailsDTOList)) { | |
29 | + List<String> checkDetailsIdList = oldTkCheckDetailsDTOList.stream().map(TkCheckDetailsDTO::getId).collect(Collectors.toList()); | |
30 | + baseMapper.deleteBatchIds(checkDetailsIdList); | |
31 | + return new ArrayList<>(0); | |
32 | + } | |
33 | + | |
34 | + if (CollectionUtils.isEmpty(oldTkCheckDetailsDTOList) && CollectionUtils.isNotEmpty(checkDetailsDTOList)) { | |
35 | + List<TkCheckDetailsEntity> tkCheckDetailsEntityList = checkDetailsDTOList.stream().map(checkDetailsDTO -> { | |
36 | + TkCheckDetailsEntity entity = new TkCheckDetailsEntity(); | |
37 | + checkDetailsDTO.copyToEntity(entity); | |
38 | + return entity; | |
39 | + }).collect(Collectors.toList()); | |
40 | + | |
41 | + insertBatch(tkCheckDetailsEntityList, TkCheckDetailsEntity.class); | |
42 | + return listByInspectionPlanId(inspectionPlanId); | |
43 | + } | |
44 | + | |
45 | + List<TkCheckDetailsEntity> addEntityList = new ArrayList<>(checkDetailsDTOList.size()); | |
46 | + List<TkCheckDetailsEntity> updateEntityList = new ArrayList<>(checkDetailsDTOList.size()); | |
47 | + List<String> needDeleteIdList = new ArrayList<>(checkDetailsDTOList.size()); | |
48 | + List<String> checkDetailsIdList = CollectionUtils.emptyIfNull(oldTkCheckDetailsDTOList).stream() | |
49 | + .map(TkCheckDetailsDTO::getId) | |
50 | + .collect(Collectors.toList()); | |
51 | + for (TkCheckDetailsDTO tkCheckDetailsDTO : checkDetailsDTOList) { | |
52 | + TkCheckDetailsEntity entity = new TkCheckDetailsEntity(); | |
53 | + tkCheckDetailsDTO.copyToEntity(entity); | |
54 | + if (StringUtils.isBlank(entity.getId())) { | |
55 | + addEntityList.add(entity); | |
56 | + continue; | |
57 | + } | |
58 | + | |
59 | + if (checkDetailsIdList.contains(entity.getId())) { | |
60 | + updateEntityList.add(entity); | |
61 | + } | |
62 | + } | |
63 | + | |
64 | + | |
65 | + if (CollectionUtils.isNotEmpty(addEntityList)) { | |
66 | + insertBatch(addEntityList, TkCheckDetailsEntity.class); | |
67 | + } | |
68 | + | |
69 | + if (CollectionUtils.isNotEmpty(updateEntityList)) { | |
70 | + updateEntityList.forEach(tkCheckDetailsEntity -> baseMapper.updateById(tkCheckDetailsEntity)); | |
71 | + List<String> updateIdList = updateEntityList.stream().map(TkCheckDetailsEntity::getId).collect(Collectors.toList()); | |
72 | + checkDetailsIdList.removeAll(updateIdList); | |
73 | + needDeleteIdList.addAll(checkDetailsIdList); | |
74 | + } else { | |
75 | + needDeleteIdList = checkDetailsIdList; | |
76 | + } | |
77 | + | |
78 | + if (CollectionUtils.isNotEmpty(needDeleteIdList)) { | |
79 | + baseMapper.deleteBatchIds(needDeleteIdList); | |
80 | + } | |
81 | + | |
82 | + return listByInspectionPlanId(inspectionPlanId); | |
83 | + } | |
84 | + | |
85 | + public List<TkCheckDetailsDTO> listByInspectionPlanId(String inspectionPlanId) { | |
86 | + if (StringUtils.isBlank(inspectionPlanId)) { | |
87 | + return new ArrayList<>(0); | |
88 | + } | |
89 | + | |
90 | + QueryWrapper<TkCheckDetailsEntity> wrapper = new QueryWrapper<>(); | |
91 | + LambdaQueryWrapper<TkCheckDetailsEntity> lambda = wrapper.lambda(); | |
92 | + lambda.eq(TkCheckDetailsEntity::getInspectionPlanId, inspectionPlanId); | |
93 | + lambda.orderByAsc(TkCheckDetailsEntity::getShowOrder); | |
94 | + List<TkCheckDetailsEntity> tkCheckDetailsEntitieList = baseMapper.selectList(wrapper); | |
95 | + return CollectionUtils.emptyIfNull(tkCheckDetailsEntitieList).stream().map(entity -> { | |
96 | + TkCheckDetailsDTO tkCheckDetailsDTO = new TkCheckDetailsDTO(); | |
97 | + entity.copyToDTO(tkCheckDetailsDTO); | |
98 | + return tkCheckDetailsDTO; | |
99 | + }).collect(Collectors.toList()); | |
100 | + } | |
101 | + | |
102 | + @Override | |
103 | + public void deleteByInspectionPlanId(String inspectionPlanId) { | |
104 | + if (StringUtils.isBlank(inspectionPlanId)) { | |
105 | + return; | |
106 | + } | |
107 | + | |
108 | + QueryWrapper<TkCheckDetailsEntity> wrapper = new QueryWrapper<>(); | |
109 | + LambdaQueryWrapper<TkCheckDetailsEntity> lambda = wrapper.lambda(); | |
110 | + lambda.eq(TkCheckDetailsEntity::getInspectionPlanId, inspectionPlanId); | |
111 | + baseMapper.delete(wrapper); | |
112 | + } | |
16 | 113 | } | ... | ... |
1 | 1 | package org.thingsboard.server.dao.yunteng.impl; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
5 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
3 | 6 | import lombok.RequiredArgsConstructor; |
4 | 7 | import lombok.extern.slf4j.Slf4j; |
8 | +import org.apache.commons.collections4.CollectionUtils; | |
9 | +import org.apache.commons.lang3.StringUtils; | |
5 | 10 | import org.springframework.stereotype.Service; |
11 | +import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | |
12 | +import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO; | |
13 | +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionPlanDTO; | |
14 | +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | |
6 | 15 | import org.thingsboard.server.dao.yunteng.entities.TkInspectionPlanEntity; |
7 | 16 | import org.thingsboard.server.dao.yunteng.mapper.TkInspectionPlanMapper; |
8 | 17 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
18 | +import org.thingsboard.server.dao.yunteng.service.TkCheckDetailsService; | |
9 | 19 | import org.thingsboard.server.dao.yunteng.service.TkInspectionPlanService; |
20 | +import org.thingsboard.server.dao.yunteng.service.TkInspectionRecordService; | |
21 | + | |
22 | +import java.time.LocalDateTime; | |
23 | +import java.util.ArrayList; | |
24 | +import java.util.List; | |
25 | +import java.util.Map; | |
10 | 26 | |
11 | 27 | @Service |
12 | 28 | @RequiredArgsConstructor |
13 | 29 | @Slf4j |
14 | 30 | public class TkInspectionPlanServiceImpl extends AbstractBaseService<TkInspectionPlanMapper, TkInspectionPlanEntity> |
15 | 31 | implements TkInspectionPlanService { |
32 | + private final TkCheckDetailsService tkCheckDetailsService; | |
33 | + private final TkInspectionRecordService tkInspectionRecordService; | |
34 | + | |
35 | + @Override | |
36 | + public TkPageData<TkInspectionPlanDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin) { | |
37 | + QueryWrapper<TkInspectionPlanEntity> wrapper = new QueryWrapper<>(); | |
38 | + LambdaQueryWrapper<TkInspectionPlanEntity> lambda = wrapper.lambda(); | |
39 | + if (queryMap != null && queryMap.get("name") != null) { | |
40 | + lambda.eq(TkInspectionPlanEntity::getName, queryMap.get("name").toString()); | |
41 | + } | |
42 | + | |
43 | + if (queryMap != null && queryMap.get("status") != null) { | |
44 | + lambda.eq(TkInspectionPlanEntity::getStatus, queryMap.get("status").toString()); | |
45 | + } | |
46 | + | |
47 | + if (queryMap != null && queryMap.get("startTime") != null && queryMap.get("endTime") != null) { | |
48 | + LocalDateTime startTime = (LocalDateTime) queryMap.get("startTime"); | |
49 | + LocalDateTime endTime = (LocalDateTime) queryMap.get("endTime"); | |
50 | + lambda.ge(TkInspectionPlanEntity::getStartTime, startTime); | |
51 | + lambda.le(TkInspectionPlanEntity::getEndTime, endTime); | |
52 | + } | |
53 | + | |
54 | + IPage<TkInspectionPlanEntity> page = baseMapper.selectPage(getPage(queryMap, "create_time", false), | |
55 | + wrapper); | |
56 | + | |
57 | + return getPageData(page, TkInspectionPlanDTO.class); | |
58 | + } | |
59 | + | |
60 | + @Override | |
61 | + public TkInspectionPlanDTO save(TkInspectionPlanDTO tkInspectionPlanDTO) { | |
62 | + List<TkCheckDetailsDTO> checkDetailsDTOList = new ArrayList<>(tkInspectionPlanDTO.getTkCheckDetailsDTOList()); | |
63 | + checkDto(tkInspectionPlanDTO); | |
64 | + TkInspectionPlanEntity entity = new TkInspectionPlanEntity(); | |
65 | + if (StringUtils.isBlank(tkInspectionPlanDTO.getId())) { | |
66 | + tkInspectionPlanDTO.copyToEntity(entity); | |
67 | + baseMapper.insert(entity); | |
68 | + } else { | |
69 | + LambdaQueryWrapper<TkInspectionPlanEntity> filter = new QueryWrapper<TkInspectionPlanEntity>().lambda() | |
70 | + .eq(TkInspectionPlanEntity::getId, tkInspectionPlanDTO.getId()); | |
71 | + entity = tkInspectionPlanDTO.getEntity(TkInspectionPlanEntity.class); | |
72 | + baseMapper.update(entity, filter); | |
73 | + } | |
74 | + | |
75 | + entity.copyToDTO(tkInspectionPlanDTO); | |
76 | + String id = tkInspectionPlanDTO.getId(); | |
77 | + for (int index = 0; index < checkDetailsDTOList.size(); index++) { | |
78 | + if (CollectionUtils.isEmpty(checkDetailsDTOList)) { | |
79 | + continue; | |
80 | + } | |
81 | + | |
82 | + TkCheckDetailsDTO checkDetailsDTO = checkDetailsDTOList.get(index); | |
83 | + checkDetailsDTO.setInspectionPlanId(id); | |
84 | + checkDetailsDTO.setShowOrder(index); | |
85 | + } | |
86 | + | |
87 | + List<TkCheckDetailsDTO> tkCheckDetailsDTOList = tkCheckDetailsService.batchSave(checkDetailsDTOList, id); | |
88 | + tkInspectionPlanDTO.setTkCheckDetailsDTOList(tkCheckDetailsDTOList); | |
89 | + return tkInspectionPlanDTO; | |
90 | + } | |
91 | + | |
92 | + @Override | |
93 | + public TkInspectionPlanDTO get(String id) { | |
94 | + if (StringUtils.isBlank(id)) { | |
95 | + return new TkInspectionPlanDTO(); | |
96 | + } | |
97 | + | |
98 | + TkInspectionPlanEntity entity = baseMapper.selectById(id); | |
99 | + TkInspectionPlanDTO tkInspectionPlanDTO = new TkInspectionPlanDTO(); | |
100 | + entity.copyToDTO(tkInspectionPlanDTO); | |
101 | + List<TkCheckDetailsDTO> checkDetailsDTOList = tkCheckDetailsService.listByInspectionPlanId(id); | |
102 | + tkInspectionPlanDTO.setTkCheckDetailsDTOList(checkDetailsDTOList); | |
103 | + return tkInspectionPlanDTO; | |
104 | + } | |
105 | + | |
106 | + @Override | |
107 | + public boolean delete(String id) { | |
108 | + tkCheckDetailsService.deleteByInspectionPlanId(id); | |
109 | + int count = baseMapper.deleteById(id); | |
110 | + return count > 0; | |
111 | + } | |
112 | + | |
113 | + private void checkDto(TkInspectionPlanDTO dto) { | |
114 | + if (StringUtils.isBlank(dto.getTenantId())) { | |
115 | + throw new TkDataValidationException("租户id为空!"); | |
116 | + } | |
117 | + } | |
16 | 118 | } | ... | ... |
1 | 1 | package org.thingsboard.server.dao.yunteng.service; |
2 | 2 | |
3 | +import org.thingsboard.server.common.data.yunteng.dto.TkCheckDetailsDTO; | |
3 | 4 | import org.thingsboard.server.dao.yunteng.entities.TkCheckDetailsEntity; |
4 | 5 | |
6 | +import java.util.List; | |
7 | + | |
5 | 8 | public interface TkCheckDetailsService extends BaseService<TkCheckDetailsEntity> { |
9 | + | |
10 | + List<TkCheckDetailsDTO> batchSave(List<TkCheckDetailsDTO> checkDetailsDTOList, String inspectionPlanId); | |
11 | + | |
12 | + List<TkCheckDetailsDTO> listByInspectionPlanId(String inspectionPlanId); | |
13 | + | |
14 | + void deleteByInspectionPlanId(String inspectionPlanId); | |
6 | 15 | } | ... | ... |
1 | 1 | package org.thingsboard.server.dao.yunteng.service; |
2 | 2 | |
3 | +import org.thingsboard.server.common.data.yunteng.dto.TkInspectionPlanDTO; | |
4 | +import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | |
3 | 5 | import org.thingsboard.server.dao.yunteng.entities.TkInspectionPlanEntity; |
4 | 6 | |
7 | +import java.util.Map; | |
8 | + | |
5 | 9 | public interface TkInspectionPlanService extends BaseService<TkInspectionPlanEntity> { |
10 | + | |
11 | + TkPageData<TkInspectionPlanDTO> page(Map<String, Object> queryMap, boolean isTenantAdmin); | |
12 | + | |
13 | + TkInspectionPlanDTO save(TkInspectionPlanDTO tkInspectionPlanDTO); | |
14 | + | |
15 | + TkInspectionPlanDTO get(String id); | |
16 | + | |
17 | + boolean delete(String id); | |
6 | 18 | } | ... | ... |