Showing
9 changed files
with
175 additions
and
49 deletions
... | ... | @@ -17,6 +17,8 @@ import org.thingsboard.server.dao.yunteng.service.TkPreserveDetailService; |
17 | 17 | import org.thingsboard.server.dao.yunteng.service.TkPreservePlanService; |
18 | 18 | import org.thingsboard.server.queue.util.TbCoreComponent; |
19 | 19 | |
20 | +import java.util.Map; | |
21 | + | |
20 | 22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE; |
21 | 23 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.PAGE_SIZE; |
22 | 24 | |
... | ... | @@ -87,10 +89,23 @@ public class TkPreservePlanController extends BaseController { |
87 | 89 | public TkPageData<TkPreserveDetailDTO> pageDetail( |
88 | 90 | @RequestParam(PAGE_SIZE) int pageSize, |
89 | 91 | @RequestParam(PAGE) int page, |
90 | - @RequestBody TkPreserveDetailDTO dto) | |
92 | + @RequestBody Map<String, Object> params) | |
91 | 93 | throws ThingsboardException { |
92 | - dto.setPage(page); | |
93 | - dto.setPageSize(pageSize); | |
94 | - return tkPreserveDetailService.page(dto); | |
94 | + params.put(PAGE, page); | |
95 | + params.put(PAGE_SIZE, pageSize); | |
96 | + return tkPreserveDetailService.page(params); | |
97 | + } | |
98 | + | |
99 | + @PostMapping("/updateDetailStatus") | |
100 | + @PreAuthorize("hasAnyAuthority('TENANT_ADMIN','CUSTOMER_USER')") | |
101 | + @ApiOperation("更新保养计划状态") | |
102 | + public ResponseEntity<TkPreserveDetailDTO> updateDetailStatus(@RequestBody TkPreserveDetailDTO dto) throws ThingsboardException { | |
103 | + TkPreserveDetailDTO detailDTO = tkPreserveDetailService.load(dto.getId()); | |
104 | + if (detailDTO == null) { | |
105 | + throw new TkDataValidationException("保养明细不存在!"); | |
106 | + } | |
107 | + | |
108 | + tkPreserveDetailService.updateStatus(dto.getId(), dto.getDetailStatus().name()); | |
109 | + return ResponseEntity.ok(detailDTO); | |
95 | 110 | } |
96 | 111 | } | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.thingsboard.server.common.data.yunteng.dto; |
3 | 3 | import io.swagger.annotations.ApiModelProperty; |
4 | 4 | import lombok.Data; |
5 | 5 | import lombok.EqualsAndHashCode; |
6 | +import org.thingsboard.server.common.data.yunteng.enums.PreserveDetailStatusEnum; | |
6 | 7 | |
7 | 8 | @EqualsAndHashCode(callSuper = true) |
8 | 9 | @Data |
... | ... | @@ -20,13 +21,16 @@ public class TkPreserveDetailDTO extends TenantDTO { |
20 | 21 | private String deviceId; |
21 | 22 | |
22 | 23 | @ApiModelProperty(value = "设备信息") |
23 | - private DeviceDTO deviceInfo; | |
24 | + private TkDeviceAccountDTO deviceInfo; | |
24 | 25 | |
25 | 26 | @ApiModelProperty(value = "方案id") |
26 | 27 | private String checkPlanId; |
27 | 28 | |
29 | + @ApiModelProperty(value = "方案id") | |
30 | + private String checkPlanName; | |
31 | + | |
28 | 32 | @ApiModelProperty(value = "执行状态(UNEXECUTED未执行,EXECUTED已执行)") |
29 | - private String detailStatus; | |
33 | + private PreserveDetailStatusEnum detailStatus; | |
30 | 34 | |
31 | 35 | @ApiModelProperty(value = "页号") |
32 | 36 | private Integer page; | ... | ... |
... | ... | @@ -3,6 +3,7 @@ package org.thingsboard.server.dao.yunteng.entities; |
3 | 3 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | 4 | import lombok.Data; |
5 | 5 | import lombok.EqualsAndHashCode; |
6 | +import org.thingsboard.server.common.data.yunteng.enums.PreserveDetailStatusEnum; | |
6 | 7 | import org.thingsboard.server.dao.model.ModelConstants; |
7 | 8 | |
8 | 9 | /** |
... | ... | @@ -17,5 +18,5 @@ public class TkPreserveDetailEntity extends TenantBaseEntity { |
17 | 18 | private String preservePlanId; |
18 | 19 | private String deviceId; |
19 | 20 | private String checkPlanId; |
20 | - private String detailStatus; | |
21 | + private PreserveDetailStatusEnum detailStatus; | |
21 | 22 | } | ... | ... |
... | ... | @@ -7,15 +7,22 @@ import lombok.RequiredArgsConstructor; |
7 | 7 | import lombok.extern.slf4j.Slf4j; |
8 | 8 | import org.apache.commons.lang3.StringUtils; |
9 | 9 | import org.springframework.stereotype.Service; |
10 | +import org.thingsboard.server.common.data.exception.ThingsboardException; | |
11 | +import org.thingsboard.server.common.data.id.TenantId; | |
10 | 12 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
11 | 13 | import org.thingsboard.server.common.data.yunteng.dto.TkCheckPlanDTO; |
14 | +import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | |
12 | 15 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
16 | +import org.thingsboard.server.dao.yunteng.entities.BaseEntity; | |
13 | 17 | import org.thingsboard.server.dao.yunteng.entities.TkCheckPlanEntity; |
14 | 18 | import org.thingsboard.server.dao.yunteng.mapper.TkCheckPlanMapper; |
15 | 19 | import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; |
16 | 20 | import org.thingsboard.server.dao.yunteng.service.TkCheckPlanService; |
17 | 21 | |
22 | +import java.util.List; | |
18 | 23 | import java.util.Map; |
24 | +import java.util.Optional; | |
25 | +import java.util.stream.Collectors; | |
19 | 26 | |
20 | 27 | @Service |
21 | 28 | @RequiredArgsConstructor |
... | ... | @@ -85,4 +92,16 @@ public class TkCheckPlanServiceImpl extends AbstractBaseService<TkCheckPlanMappe |
85 | 92 | entity.copyToDTO(tkCheckPlanDTO); |
86 | 93 | return tkCheckPlanDTO; |
87 | 94 | } |
95 | + | |
96 | + @Override | |
97 | + public List<TkCheckPlanDTO> listByIds(List<String> ids) throws ThingsboardException { | |
98 | + QueryWrapper<TkCheckPlanEntity> wrapper = new QueryWrapper<>(); | |
99 | + LambdaQueryWrapper<TkCheckPlanEntity> lambda = wrapper.lambda(); | |
100 | + TenantId tenantId = SpringBeanUtils.getTenantId(); | |
101 | + lambda.eq(TkCheckPlanEntity::getTenantId, tenantId.getId().toString()); | |
102 | + lambda.in(BaseEntity::getId,ids); | |
103 | + List<TkCheckPlanEntity> entitys = baseMapper.selectList(wrapper); | |
104 | + return Optional.ofNullable(entitys).map(all -> all.stream().map(item -> item.getDTO(TkCheckPlanDTO.class)) | |
105 | + .collect(Collectors.toList())).orElse(null); | |
106 | + } | |
88 | 107 | } | ... | ... |
... | ... | @@ -2,6 +2,7 @@ package org.thingsboard.server.dao.yunteng.impl; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
5 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
5 | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
6 | 7 | import lombok.RequiredArgsConstructor; |
7 | 8 | import lombok.extern.slf4j.Slf4j; |
... | ... | @@ -11,17 +12,17 @@ import org.springframework.stereotype.Service; |
11 | 12 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
12 | 13 | import org.thingsboard.server.common.data.id.TenantId; |
13 | 14 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
14 | -import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; | |
15 | -import org.thingsboard.server.common.data.yunteng.dto.TkPreserveDetailDTO; | |
15 | +import org.thingsboard.server.common.data.yunteng.dto.*; | |
16 | 16 | import org.thingsboard.server.common.data.yunteng.enums.PreserveDetailStatusEnum; |
17 | +import org.thingsboard.server.common.data.yunteng.enums.PreservePlanStatusEnum; | |
17 | 18 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; |
18 | 19 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
19 | 20 | import org.thingsboard.server.dao.yunteng.entities.TenantBaseEntity; |
20 | 21 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveDetailEntity; |
22 | +import org.thingsboard.server.dao.yunteng.entities.TkPreservePlanEntity; | |
23 | +import org.thingsboard.server.dao.yunteng.entities.TkRepairRecordEntity; | |
21 | 24 | import org.thingsboard.server.dao.yunteng.mapper.TkPreserveDetailMapper; |
22 | -import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | |
23 | -import org.thingsboard.server.dao.yunteng.service.TkDeviceService; | |
24 | -import org.thingsboard.server.dao.yunteng.service.TkPreserveDetailService; | |
25 | +import org.thingsboard.server.dao.yunteng.service.*; | |
25 | 26 | |
26 | 27 | import java.util.HashMap; |
27 | 28 | import java.util.List; |
... | ... | @@ -35,43 +36,20 @@ import java.util.stream.Collectors; |
35 | 36 | public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveDetailMapper, TkPreserveDetailEntity> |
36 | 37 | implements TkPreserveDetailService { |
37 | 38 | |
38 | - private final TkDeviceService tkdeviceService; | |
39 | + private final TkCheckPlanService tkCheckPlanService; | |
39 | 40 | |
40 | 41 | @Override |
41 | - public TkPageData<TkPreserveDetailDTO> page(TkPreserveDetailDTO condition) throws ThingsboardException { | |
42 | + public TkPageData<TkPreserveDetailDTO> page(Map<String, Object> params) throws ThingsboardException { | |
43 | + params.put("tenantId", SpringBeanUtils.getTenantId().getId().toString()); | |
42 | 44 | TkPageData<TkPreserveDetailDTO> result = new TkPageData<>(); |
43 | - QueryWrapper<TkPreserveDetailEntity> wrapper = new QueryWrapper<>(); | |
44 | - LambdaQueryWrapper<TkPreserveDetailEntity> lambda = wrapper.lambda(); | |
45 | - TenantId tenantId = SpringBeanUtils.getTenantId(); | |
46 | - lambda.eq(TkPreserveDetailEntity::getTenantId, tenantId.getId().toString()); | |
47 | - | |
48 | - if (StringUtils.isNotBlank(condition.getPreservePlanId())) { | |
49 | - lambda.eq(TkPreserveDetailEntity::getPreservePlanId, condition.getPreservePlanId()); | |
45 | + IPage<TkPreserveDetailEntity> page = | |
46 | + getPage(params, "pd.create_time", false); | |
47 | + IPage<TkPreserveDetailDTO> pageData = baseMapper.getPreserveDetailPage(page, params); | |
48 | + if (pageData != null) { | |
49 | + result.setItems(pageData.getRecords()); | |
50 | 50 | } |
51 | + result.setTotal(Long.valueOf(pageData.getTotal()).intValue()); | |
51 | 52 | |
52 | - lambda.orderByDesc(TenantBaseEntity::getCreateTime); | |
53 | - | |
54 | - Page<TkPreserveDetailEntity> page = new Page<>(); | |
55 | - page.setCurrent(condition.getPage()); | |
56 | - page.setSize(condition.getPageSize()); | |
57 | - page = baseMapper.selectPage(page, wrapper); | |
58 | - | |
59 | - if (page != null && CollectionUtils.isNotEmpty(page.getRecords())) { | |
60 | - Map<String, DeviceDTO> deviceMap = new HashMap<>(); | |
61 | - List<TkPreserveDetailDTO> dataList = page.getRecords().stream().map(item -> { | |
62 | - TkPreserveDetailDTO dto = item.getDTO(TkPreserveDetailDTO.class); | |
63 | - String deviceId = dto.getDeviceId(); | |
64 | - DeviceDTO deviceDTO = deviceMap.get(deviceId); | |
65 | - if (deviceDTO == null) { | |
66 | - deviceDTO = tkdeviceService.checkDeviceByTenantIdAndDeviceId(tenantId.getId(), UUID.fromString(dto.getDeviceId())); | |
67 | - deviceMap.put(deviceId, deviceDTO); | |
68 | - } | |
69 | - dto.setDeviceInfo(deviceDTO); | |
70 | - return dto; | |
71 | - }).collect(Collectors.toList()); | |
72 | - result.setItems(dataList); | |
73 | - } | |
74 | - result.setTotal(Long.valueOf(page.getTotal()).intValue()); | |
75 | 53 | return result; |
76 | 54 | } |
77 | 55 | |
... | ... | @@ -93,6 +71,17 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD |
93 | 71 | return dto; |
94 | 72 | } |
95 | 73 | |
74 | + @Override | |
75 | + public TkPreserveDetailDTO load(String id) { | |
76 | + TkPreserveDetailDTO result = null; | |
77 | + TkPreserveDetailEntity entity = baseMapper.selectById(id); | |
78 | + if (entity != null) { | |
79 | + result = new TkPreserveDetailDTO(); | |
80 | + entity.copyToDTO(result); | |
81 | + } | |
82 | + return result; | |
83 | + } | |
84 | + | |
96 | 85 | private void checkDto(TkPreserveDetailDTO dto) throws ThingsboardException { |
97 | 86 | if (StringUtils.isBlank(dto.getDeviceId())) { |
98 | 87 | throw new TkDataValidationException("设备不能为空!"); |
... | ... | @@ -110,8 +99,8 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD |
110 | 99 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); |
111 | 100 | } |
112 | 101 | |
113 | - if (StringUtils.isBlank(dto.getDetailStatus())) { | |
114 | - dto.setDetailStatus(PreserveDetailStatusEnum.UNEXECUTED.name()); | |
102 | + if (dto.getDetailStatus() == null) { | |
103 | + dto.setDetailStatus(PreserveDetailStatusEnum.UNEXECUTED); | |
115 | 104 | } |
116 | 105 | } |
117 | 106 | |
... | ... | @@ -150,8 +139,20 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD |
150 | 139 | lambda.eq(TkPreserveDetailEntity::getPreservePlanId, planId); |
151 | 140 | List<TkPreserveDetailEntity> entities = baseMapper.selectList(wrapper); |
152 | 141 | if (CollectionUtils.isNotEmpty(entities)) { |
142 | + List<String> checkPlanIdList = entities.stream().map(TkPreserveDetailEntity::getCheckPlanId).collect(Collectors.toList()); | |
143 | + Map<String, String> checkPlanMap = new HashMap<>(); | |
144 | + if (CollectionUtils.isNotEmpty(checkPlanIdList)) { | |
145 | + List<TkCheckPlanDTO> checkPlanList = tkCheckPlanService.listByIds(checkPlanIdList); | |
146 | + checkPlanMap = checkPlanList.stream().collect(Collectors.toMap(BaseDTO::getId, TkCheckPlanDTO::getName)); | |
147 | + } | |
148 | + Map<String, String> finalCheckPlanMap = checkPlanMap; | |
153 | 149 | List<TkPreserveDetailDTO> dataList = entities.stream().map(item -> { |
154 | 150 | TkPreserveDetailDTO dto = item.getDTO(TkPreserveDetailDTO.class); |
151 | + String checkPlanId = item.getCheckPlanId(); | |
152 | + String checkPlanName = finalCheckPlanMap.get(checkPlanId); | |
153 | + if (StringUtils.isNotBlank(checkPlanName)) { | |
154 | + dto.setCheckPlanName(checkPlanName); | |
155 | + } | |
155 | 156 | return dto; |
156 | 157 | }).collect(Collectors.toList()); |
157 | 158 | return dataList; |
... | ... | @@ -160,4 +161,20 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD |
160 | 161 | } |
161 | 162 | |
162 | 163 | } |
164 | + | |
165 | + @Override | |
166 | + public void updateStatus(String id, String status) throws ThingsboardException { | |
167 | + TkPreserveDetailEntity entity = baseMapper.selectById(id); | |
168 | + if (entity == null) { | |
169 | + throw new TkDataValidationException("保养明细不存在!"); | |
170 | + } | |
171 | + PreserveDetailStatusEnum statusEnum = PreserveDetailStatusEnum.valueOf(status); | |
172 | + if (statusEnum == null) { | |
173 | + throw new TkDataValidationException("保养明细状态不存在!"); | |
174 | + } | |
175 | + entity.setDetailStatus(statusEnum); | |
176 | + LambdaQueryWrapper<TkPreserveDetailEntity> filter = new QueryWrapper<TkPreserveDetailEntity>().lambda() | |
177 | + .eq(TkPreserveDetailEntity::getId, entity.getId()); | |
178 | + baseMapper.update(entity, filter); | |
179 | + } | |
163 | 180 | } | ... | ... |
1 | 1 | package org.thingsboard.server.dao.yunteng.mapper; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
4 | 5 | import org.apache.ibatis.annotations.Mapper; |
6 | +import org.apache.ibatis.annotations.Param; | |
7 | +import org.thingsboard.server.common.data.yunteng.dto.TkPreserveDetailDTO; | |
8 | +import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; | |
5 | 9 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveDetailEntity; |
6 | 10 | |
11 | +import java.util.Map; | |
12 | + | |
7 | 13 | @Mapper |
8 | 14 | public interface TkPreserveDetailMapper extends BaseMapper<TkPreserveDetailEntity> { |
15 | + IPage<TkPreserveDetailDTO> getPreserveDetailPage(IPage<?> page, @Param("queryMap") Map<String, Object> queryMap); | |
9 | 16 | } | ... | ... |
1 | 1 | package org.thingsboard.server.dao.yunteng.service; |
2 | 2 | |
3 | +import org.thingsboard.server.common.data.exception.ThingsboardException; | |
3 | 4 | import org.thingsboard.server.common.data.yunteng.dto.TkCheckPlanDTO; |
4 | 5 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
5 | 6 | import org.thingsboard.server.dao.yunteng.entities.TkCheckPlanEntity; |
6 | 7 | |
8 | +import java.util.List; | |
7 | 9 | import java.util.Map; |
8 | 10 | |
9 | 11 | public interface TkCheckPlanService extends BaseService<TkCheckPlanEntity> { |
... | ... | @@ -14,4 +16,6 @@ public interface TkCheckPlanService extends BaseService<TkCheckPlanEntity> { |
14 | 16 | boolean delete(String id); |
15 | 17 | |
16 | 18 | TkCheckPlanDTO get(String id); |
19 | + | |
20 | + List<TkCheckPlanDTO> listByIds(List<String> ids) throws ThingsboardException; | |
17 | 21 | } | ... | ... |
... | ... | @@ -6,18 +6,23 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
6 | 6 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveDetailEntity; |
7 | 7 | |
8 | 8 | import java.util.List; |
9 | +import java.util.Map; | |
9 | 10 | |
10 | -public interface TkPreserveDetailService extends BaseService<TkPreserveDetailEntity>{ | |
11 | +public interface TkPreserveDetailService extends BaseService<TkPreserveDetailEntity> { | |
11 | 12 | |
12 | - TkPageData<TkPreserveDetailDTO> page(TkPreserveDetailDTO condition) throws ThingsboardException; | |
13 | + TkPageData<TkPreserveDetailDTO> page(Map<String, Object> params) throws ThingsboardException; | |
13 | 14 | |
14 | 15 | TkPreserveDetailDTO save(TkPreserveDetailDTO dto) throws ThingsboardException; |
15 | 16 | |
17 | + TkPreserveDetailDTO load(String id); | |
18 | + | |
16 | 19 | boolean delete(String id); |
17 | 20 | |
18 | 21 | boolean deleteByPlanId(String planId); |
19 | 22 | |
20 | - void deleteNotInIdEqPlanId(String planId,List<String> notinIds); | |
23 | + void deleteNotInIdEqPlanId(String planId, List<String> notinIds); | |
21 | 24 | |
22 | 25 | List<TkPreserveDetailDTO> listByPlanId(String planId) throws ThingsboardException; |
26 | + | |
27 | + void updateStatus(String id, String status) throws ThingsboardException; | |
23 | 28 | } | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.TkPreserveDetailMapper"> | |
4 | + <resultMap type="org.thingsboard.server.common.data.yunteng.dto.TkPreserveDetailDTO" id="preserveDetailMap"> | |
5 | + <result property="detailCode" column="detail_code"/> | |
6 | + <result property="preserveDetail" column="preserve_detail"/> | |
7 | + <result property="preservePlanId" column="preserve_plan_id"/> | |
8 | + <result property="deviceId" column="device_id"/> | |
9 | + <result property="checkPlanId" column="check_plan_id"/> | |
10 | + <result property="checkPlanName" column="checkPlanName"/> | |
11 | + <result property="detailStatus" column="detail_status" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
12 | + <association property="deviceInfo" javaType="org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO"> | |
13 | + <id property="id" column="device_id"/> | |
14 | + <result property="name" column="daName"/> | |
15 | + <result property="code" column="daCode"/> | |
16 | + <result property="categoryId" column="category_id"/> | |
17 | + <result property="status" column="daStatus" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
18 | + <result property="directorId" column="director_id"/> | |
19 | + <result property="isOnline" column="is_online"/> | |
20 | + <result property="deviceImg" column="device_img"/> | |
21 | + <result property="brand" column="brand"/> | |
22 | + <result property="modelNum" column="model_num"/> | |
23 | + <result property="specifications" column="specifications"/> | |
24 | + <result property="manufacturer" column="manufacturer"/> | |
25 | + <result property="buyDate" column="buy_date"/> | |
26 | + <result property="price" column="price"/> | |
27 | + <result property="productDate" column="product_date"/> | |
28 | + <result property="receiveDate" column="receive_date"/> | |
29 | + <result property="registeDate" column="registe_date"/> | |
30 | + <result property="supplierId" column="supplier_id"/> | |
31 | + <result property="description" column="daDescription"/> | |
32 | + </association> | |
33 | + </resultMap> | |
34 | + <select id="getPreserveDetailPage" resultMap="preserveDetailMap"> | |
35 | + SELECT | |
36 | + pd.id,pd.detail_code,pd.preserve_detail,pd.preserve_plan_id,pd.device_id, | |
37 | + pd.check_plan_id,pd.detail_status,cp.name as checkPlanName, | |
38 | + da.name as daName,da.code as daCode,da.category_id,da.status as daStatus,da.director_id,da.is_online, | |
39 | + da.brand,da.model_num,da.specifications,da.manufacturer,da.buy_date,da.price,da.product_date, | |
40 | + da.receive_date,da.registe_date,da.supplier_id,da.device_img,da.description as daDescription, | |
41 | + pd.tenant_id,pd.create_time,pd.updater,pd.update_time,pd.creator | |
42 | + from qg_preserve_detail pd | |
43 | + inner join qg_device_account da on da.id=pd.device_id | |
44 | + inner join qg_check_plan cp on cp.id=pd.check_plan_id | |
45 | + <where> | |
46 | + <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> | |
47 | + AND pd.tenant_id = #{queryMap.tenantId} | |
48 | + </if> | |
49 | + <if test="queryMap.preservePlanId !=null and queryMap.preservePlanId !=''"> | |
50 | + AND pd.preserve_plan_id = #{queryMap.preservePlanId} | |
51 | + </if> | |
52 | + </where> | |
53 | + </select> | |
54 | +</mapper> | |
\ No newline at end of file | ... | ... |