Showing
12 changed files
with
88 additions
and
38 deletions
@@ -62,7 +62,7 @@ public class TkPreserveRecordController extends BaseController { | @@ -62,7 +62,7 @@ public class TkPreserveRecordController extends BaseController { | ||
62 | throw new TkDataValidationException("保养记录不存在!"); | 62 | throw new TkDataValidationException("保养记录不存在!"); |
63 | } | 63 | } |
64 | 64 | ||
65 | - tkPreserveRecordServcie.updateStatus(dto.getId(), dto.getPreserveStatus()); | 65 | + tkPreserveRecordServcie.updateStatus(dto.getId(), dto.getPreserveStatus().name()); |
66 | return ResponseEntity.ok(orderInfo); | 66 | return ResponseEntity.ok(orderInfo); |
67 | } | 67 | } |
68 | 68 |
@@ -91,7 +91,7 @@ public class TkRepairOrderController extends BaseController { | @@ -91,7 +91,7 @@ public class TkRepairOrderController extends BaseController { | ||
91 | throws ThingsboardException { | 91 | throws ThingsboardException { |
92 | params.put(PAGE, page); | 92 | params.put(PAGE, page); |
93 | params.put(PAGE_SIZE, pageSize); | 93 | params.put(PAGE_SIZE, pageSize); |
94 | - return tkRepairOrderService.page(getCurrentUser().getCurrentTenantId(), params); | 94 | + return tkRepairOrderService.page(params); |
95 | } | 95 | } |
96 | 96 | ||
97 | @PostMapping("/updateStatus") | 97 | @PostMapping("/updateStatus") |
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; | @@ -6,6 +6,7 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; | ||
6 | import io.swagger.annotations.ApiModelProperty; | 6 | import io.swagger.annotations.ApiModelProperty; |
7 | import lombok.Data; | 7 | import lombok.Data; |
8 | import lombok.EqualsAndHashCode; | 8 | import lombok.EqualsAndHashCode; |
9 | +import org.thingsboard.server.common.data.yunteng.enums.PreserveRecordStatusEnum; | ||
9 | 10 | ||
10 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
11 | 12 | ||
@@ -27,7 +28,7 @@ public class TkPreserveRecordDTO extends TenantDTO { | @@ -27,7 +28,7 @@ public class TkPreserveRecordDTO extends TenantDTO { | ||
27 | private String preserveBy; | 28 | private String preserveBy; |
28 | 29 | ||
29 | @ApiModelProperty(value = "状态(INCOMPLETE未完成,COMPLETE已完成)") | 30 | @ApiModelProperty(value = "状态(INCOMPLETE未完成,COMPLETE已完成)") |
30 | - private String preserveStatus; | 31 | + private PreserveRecordStatusEnum preserveStatus; |
31 | 32 | ||
32 | @ApiModelProperty(value = "保养人员姓名") | 33 | @ApiModelProperty(value = "保养人员姓名") |
33 | private String preserveByName; | 34 | private String preserveByName; |
@@ -3,6 +3,7 @@ package org.thingsboard.server.dao.yunteng.entities; | @@ -3,6 +3,7 @@ package org.thingsboard.server.dao.yunteng.entities; | ||
3 | import com.baomidou.mybatisplus.annotation.TableName; | 3 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | import lombok.Data; | 4 | import lombok.Data; |
5 | import lombok.EqualsAndHashCode; | 5 | import lombok.EqualsAndHashCode; |
6 | +import org.thingsboard.server.common.data.yunteng.enums.PreserveRecordStatusEnum; | ||
6 | import org.thingsboard.server.dao.model.ModelConstants; | 7 | import org.thingsboard.server.dao.model.ModelConstants; |
7 | 8 | ||
8 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
@@ -18,5 +19,5 @@ public class TkPreserveRecordEntity extends TenantBaseEntity { | @@ -18,5 +19,5 @@ public class TkPreserveRecordEntity extends TenantBaseEntity { | ||
18 | private String preservePlanId; | 19 | private String preservePlanId; |
19 | private LocalDateTime preserveDate; | 20 | private LocalDateTime preserveDate; |
20 | private String preserveBy; | 21 | private String preserveBy; |
21 | - private String preserveStatus; | 22 | + private PreserveRecordStatusEnum preserveStatus; |
22 | } | 23 | } |
@@ -130,7 +130,7 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD | @@ -130,7 +130,7 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD | ||
130 | @Override | 130 | @Override |
131 | public List<TkPreserveDetailDTO> listByPlanId(String planId) throws ThingsboardException { | 131 | public List<TkPreserveDetailDTO> listByPlanId(String planId) throws ThingsboardException { |
132 | if (StringUtils.isBlank(planId)) { | 132 | if (StringUtils.isBlank(planId)) { |
133 | - throw new TkDataValidationException("方案id不能为空!"); | 133 | + throw new TkDataValidationException("计划id不能为空!"); |
134 | } | 134 | } |
135 | QueryWrapper<TkPreserveDetailEntity> wrapper = new QueryWrapper<>(); | 135 | QueryWrapper<TkPreserveDetailEntity> wrapper = new QueryWrapper<>(); |
136 | LambdaQueryWrapper<TkPreserveDetailEntity> lambda = wrapper.lambda(); | 136 | LambdaQueryWrapper<TkPreserveDetailEntity> lambda = wrapper.lambda(); |
@@ -163,6 +163,24 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD | @@ -163,6 +163,24 @@ public class TkPreserveDetailServiceImpl extends AbstractBaseService<TkPreserveD | ||
163 | } | 163 | } |
164 | 164 | ||
165 | @Override | 165 | @Override |
166 | + public List<String> getPlanIdByDeviceId(String deviceId) throws ThingsboardException { | ||
167 | + if (StringUtils.isBlank(deviceId)) { | ||
168 | + throw new TkDataValidationException("设备id不能为空!"); | ||
169 | + } | ||
170 | + QueryWrapper<TkPreserveDetailEntity> wrapper = new QueryWrapper<>(); | ||
171 | + LambdaQueryWrapper<TkPreserveDetailEntity> lambda = wrapper.lambda(); | ||
172 | + TenantId tenantId = SpringBeanUtils.getTenantId(); | ||
173 | + lambda.eq(TkPreserveDetailEntity::getTenantId, tenantId.getId().toString()); | ||
174 | + lambda.eq(TkPreserveDetailEntity::getDeviceId, deviceId); | ||
175 | + List<TkPreserveDetailEntity> entities = baseMapper.selectList(wrapper); | ||
176 | + if (CollectionUtils.isNotEmpty(entities)) { | ||
177 | + return entities.stream().map(TkPreserveDetailEntity::getPreservePlanId).distinct().collect(Collectors.toList()); | ||
178 | + } else { | ||
179 | + return null; | ||
180 | + } | ||
181 | + } | ||
182 | + | ||
183 | + @Override | ||
166 | public void updateStatus(String id, String status) throws ThingsboardException { | 184 | public void updateStatus(String id, String status) throws ThingsboardException { |
167 | TkPreserveDetailEntity entity = baseMapper.selectById(id); | 185 | TkPreserveDetailEntity entity = baseMapper.selectById(id); |
168 | if (entity == null) { | 186 | if (entity == null) { |
@@ -20,10 +20,7 @@ import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | @@ -20,10 +20,7 @@ import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | ||
20 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 20 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
21 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveRecordEntity; | 21 | import org.thingsboard.server.dao.yunteng.entities.TkPreserveRecordEntity; |
22 | import org.thingsboard.server.dao.yunteng.mapper.TkPreserveRecordMapper; | 22 | import org.thingsboard.server.dao.yunteng.mapper.TkPreserveRecordMapper; |
23 | -import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | ||
24 | -import org.thingsboard.server.dao.yunteng.service.TkPreservePlanService; | ||
25 | -import org.thingsboard.server.dao.yunteng.service.TkPreserveRecordServcie; | ||
26 | -import org.thingsboard.server.dao.yunteng.service.TkUserService; | 23 | +import org.thingsboard.server.dao.yunteng.service.*; |
27 | 24 | ||
28 | import java.util.HashMap; | 25 | import java.util.HashMap; |
29 | import java.util.List; | 26 | import java.util.List; |
@@ -37,7 +34,7 @@ import java.util.stream.Collectors; | @@ -37,7 +34,7 @@ import java.util.stream.Collectors; | ||
37 | public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveRecordMapper, TkPreserveRecordEntity> | 34 | public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveRecordMapper, TkPreserveRecordEntity> |
38 | implements TkPreserveRecordServcie { | 35 | implements TkPreserveRecordServcie { |
39 | 36 | ||
40 | - private final TkUserService tkUserService; | 37 | + private final TkPreserveDetailService tkPreserveDetailService; |
41 | 38 | ||
42 | @Override | 39 | @Override |
43 | public TkPageData<TkPreserveRecordDTO> page(Map<String, Object> params) throws ThingsboardException { | 40 | public TkPageData<TkPreserveRecordDTO> page(Map<String, Object> params) throws ThingsboardException { |
@@ -47,6 +44,14 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | @@ -47,6 +44,14 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | ||
47 | IPage<TkPreserveRecordEntity> page = | 44 | IPage<TkPreserveRecordEntity> page = |
48 | getPage(params, "create_time", false); | 45 | getPage(params, "create_time", false); |
49 | 46 | ||
47 | + Object deviceId = params.get("deviceId"); | ||
48 | + if (deviceId != null && StringUtils.isNotBlank(deviceId.toString())) { | ||
49 | + List<String> planIdList = tkPreserveDetailService.getPlanIdByDeviceId(deviceId.toString()); | ||
50 | + if (CollectionUtils.isNotEmpty(planIdList)) { | ||
51 | + params.put("planIdList", planIdList); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
50 | IPage<TkPreserveRecordDTO> pageData = baseMapper.getPreserveRecordPage(page, params); | 55 | IPage<TkPreserveRecordDTO> pageData = baseMapper.getPreserveRecordPage(page, params); |
51 | if (pageData != null) { | 56 | if (pageData != null) { |
52 | result.setItems(pageData.getRecords()); | 57 | result.setItems(pageData.getRecords()); |
@@ -91,8 +96,8 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | @@ -91,8 +96,8 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | ||
91 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); | 96 | dto.setTenantId(SpringBeanUtils.getTenantId().getId().toString()); |
92 | } | 97 | } |
93 | 98 | ||
94 | - if (StringUtils.isBlank(dto.getPreserveStatus())) { | ||
95 | - dto.setPreserveStatus(PreserveRecordStatusEnum.INCOMPLETE.name()); | 99 | + if (dto.getPreserveStatus() != null) { |
100 | + dto.setPreserveStatus(PreserveRecordStatusEnum.INCOMPLETE); | ||
96 | } | 101 | } |
97 | } | 102 | } |
98 | 103 | ||
@@ -126,11 +131,11 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | @@ -126,11 +131,11 @@ public class TkPreserveRecordServcieImpl extends AbstractBaseService<TkPreserveR | ||
126 | if (entity == null) { | 131 | if (entity == null) { |
127 | throw new TkDataValidationException("保养记录不存在!"); | 132 | throw new TkDataValidationException("保养记录不存在!"); |
128 | } | 133 | } |
129 | - PreservePlanStatusEnum statusEnum = PreservePlanStatusEnum.valueOf(status); | 134 | + PreserveRecordStatusEnum statusEnum = PreserveRecordStatusEnum.valueOf(status); |
130 | if (statusEnum == null) { | 135 | if (statusEnum == null) { |
131 | throw new TkDataValidationException("保养记录状态不存在!"); | 136 | throw new TkDataValidationException("保养记录状态不存在!"); |
132 | } | 137 | } |
133 | - entity.setPreserveStatus(statusEnum.name()); | 138 | + entity.setPreserveStatus(statusEnum); |
134 | LambdaQueryWrapper<TkPreserveRecordEntity> filter = new QueryWrapper<TkPreserveRecordEntity>().lambda() | 139 | LambdaQueryWrapper<TkPreserveRecordEntity> filter = new QueryWrapper<TkPreserveRecordEntity>().lambda() |
135 | .eq(TkPreserveRecordEntity::getId, entity.getId()); | 140 | .eq(TkPreserveRecordEntity::getId, entity.getId()); |
136 | baseMapper.update(entity, filter); | 141 | baseMapper.update(entity, filter); |
@@ -13,6 +13,7 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -13,6 +13,7 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
13 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | 13 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
14 | import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; | 14 | import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; |
15 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceAccountDTO; |
16 | +import org.thingsboard.server.common.data.yunteng.dto.TkPreserveRecordDTO; | ||
16 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; | 17 | import org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO; |
17 | import org.thingsboard.server.common.data.yunteng.enums.RepairOrderStatusEnum; | 18 | import org.thingsboard.server.common.data.yunteng.enums.RepairOrderStatusEnum; |
18 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | 19 | import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; |
@@ -28,6 +29,7 @@ import org.thingsboard.server.dao.yunteng.service.TkRepairOrderService; | @@ -28,6 +29,7 @@ import org.thingsboard.server.dao.yunteng.service.TkRepairOrderService; | ||
28 | import java.time.LocalDateTime; | 29 | import java.time.LocalDateTime; |
29 | import java.util.HashMap; | 30 | import java.util.HashMap; |
30 | import java.util.Map; | 31 | import java.util.Map; |
32 | +import java.util.Optional; | ||
31 | import java.util.UUID; | 33 | import java.util.UUID; |
32 | 34 | ||
33 | @Service | 35 | @Service |
@@ -41,12 +43,15 @@ public class TkRepairOrderServiceImpl extends AbstractBaseService<TkRepairOrderM | @@ -41,12 +43,15 @@ public class TkRepairOrderServiceImpl extends AbstractBaseService<TkRepairOrderM | ||
41 | private final TkDeviceAccountService tkDeviceAccountService; | 43 | private final TkDeviceAccountService tkDeviceAccountService; |
42 | 44 | ||
43 | @Override | 45 | @Override |
44 | - public TkPageData<TkRepairOrderDTO> page(String tenantId, Map<String, Object> params) throws ThingsboardException { | 46 | + public TkPageData<TkRepairOrderDTO> page(Map<String, Object> params) throws ThingsboardException { |
45 | params.put("tenantId", SpringBeanUtils.getTenantId().getId().toString()); | 47 | params.put("tenantId", SpringBeanUtils.getTenantId().getId().toString()); |
46 | TkPageData<TkRepairOrderDTO> result = new TkPageData<>(); | 48 | TkPageData<TkRepairOrderDTO> result = new TkPageData<>(); |
47 | IPage<TkRepairOrderEntity> page = | 49 | IPage<TkRepairOrderEntity> page = |
48 | getPage(params, "create_time", false); | 50 | getPage(params, "create_time", false); |
49 | - | 51 | + Object emergency = params.get("emergency"); |
52 | + if (emergency != null && StringUtils.isBlank(emergency.toString())) { | ||
53 | + params.remove("emergency"); | ||
54 | + } | ||
50 | IPage<TkRepairOrderDTO> pageData = baseMapper.getRepairOrderPage(page, params); | 55 | IPage<TkRepairOrderDTO> pageData = baseMapper.getRepairOrderPage(page, params); |
51 | if (pageData != null) { | 56 | if (pageData != null) { |
52 | result.setItems(pageData.getRecords()); | 57 | result.setItems(pageData.getRecords()); |
@@ -79,19 +84,15 @@ public class TkRepairOrderServiceImpl extends AbstractBaseService<TkRepairOrderM | @@ -79,19 +84,15 @@ public class TkRepairOrderServiceImpl extends AbstractBaseService<TkRepairOrderM | ||
79 | 84 | ||
80 | @Override | 85 | @Override |
81 | public TkRepairOrderDTO detail(String id) throws ThingsboardException { | 86 | public TkRepairOrderDTO detail(String id) throws ThingsboardException { |
82 | - TkRepairOrderDTO detail = new TkRepairOrderDTO(); | ||
83 | - TkRepairOrderEntity entity = baseMapper.selectById(id); | ||
84 | - if (entity == null) { | ||
85 | - throw new TkDataValidationException("数据不存在!"); | ||
86 | - } | ||
87 | - entity.copyToDTO(detail); | ||
88 | - String deviceId = entity.getDeviceId(); | ||
89 | - if (StringUtils.isNotBlank(deviceId)) { | ||
90 | - TkDeviceAccountDTO deviceDTO = tkDeviceAccountService.load(deviceId); | ||
91 | - detail.setDeviceInfo(deviceDTO); | 87 | + Map<String, Object> params = new HashMap<>(); |
88 | + params.put("id", id); | ||
89 | + TkPageData<TkRepairOrderDTO> page = page(params); | ||
90 | + if (page != null && CollectionUtils.isNotEmpty(page.getItems())) { | ||
91 | + Optional<TkRepairOrderDTO> first = page.getItems().stream().findFirst(); | ||
92 | + return first.get(); | ||
93 | + } else { | ||
94 | + return null; | ||
92 | } | 95 | } |
93 | - | ||
94 | - return detail; | ||
95 | } | 96 | } |
96 | 97 | ||
97 | @Override | 98 | @Override |
@@ -24,5 +24,7 @@ public interface TkPreserveDetailService extends BaseService<TkPreserveDetailEnt | @@ -24,5 +24,7 @@ public interface TkPreserveDetailService extends BaseService<TkPreserveDetailEnt | ||
24 | 24 | ||
25 | List<TkPreserveDetailDTO> listByPlanId(String planId) throws ThingsboardException; | 25 | List<TkPreserveDetailDTO> listByPlanId(String planId) throws ThingsboardException; |
26 | 26 | ||
27 | + List<String> getPlanIdByDeviceId(String deviceId) throws ThingsboardException; | ||
28 | + | ||
27 | void updateStatus(String id, String status) throws ThingsboardException; | 29 | void updateStatus(String id, String status) throws ThingsboardException; |
28 | } | 30 | } |
@@ -10,7 +10,7 @@ import java.util.Map; | @@ -10,7 +10,7 @@ import java.util.Map; | ||
10 | 10 | ||
11 | public interface TkRepairOrderService extends BaseService<TkRepairOrderEntity> { | 11 | public interface TkRepairOrderService extends BaseService<TkRepairOrderEntity> { |
12 | 12 | ||
13 | - TkPageData<TkRepairOrderDTO> page(String tenantId,Map<String, Object> params) throws ThingsboardException; | 13 | + TkPageData<TkRepairOrderDTO> page(Map<String, Object> params) throws ThingsboardException; |
14 | 14 | ||
15 | TkRepairOrderDTO save(TkRepairOrderDTO dto) throws ThingsboardException; | 15 | TkRepairOrderDTO save(TkRepairOrderDTO dto) throws ThingsboardException; |
16 | 16 |
@@ -2,6 +2,12 @@ | @@ -2,6 +2,12 @@ | ||
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 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.TkPreserveRecordMapper"> | 3 | <mapper namespace="org.thingsboard.server.dao.yunteng.mapper.TkPreserveRecordMapper"> |
4 | <resultMap type="org.thingsboard.server.common.data.yunteng.dto.TkPreserveRecordDTO" id="preserveRecordMap"> | 4 | <resultMap type="org.thingsboard.server.common.data.yunteng.dto.TkPreserveRecordDTO" id="preserveRecordMap"> |
5 | + <result property="id" column="id"/> | ||
6 | + <result property="preservePlanId" column="preserve_plan_id"/> | ||
7 | + <result property="preserveDate" column="preserve_date"/> | ||
8 | + <result property="preserveBy" column="preserve_by"/> | ||
9 | + <result property="preserveStatus" column="preserve_status" | ||
10 | + typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | ||
5 | <result property="preserveByName" column="preserveByName"/> | 11 | <result property="preserveByName" column="preserveByName"/> |
6 | <result property="preservePlanName" column="preserveName"/> | 12 | <result property="preservePlanName" column="preserveName"/> |
7 | </resultMap> | 13 | </resultMap> |
@@ -14,27 +20,34 @@ | @@ -14,27 +20,34 @@ | ||
14 | inner join sys_user su on su.id=r.preserve_by | 20 | inner join sys_user su on su.id=r.preserve_by |
15 | inner join qg_preserve_plan p on p.id=r.preserve_plan_id | 21 | inner join qg_preserve_plan p on p.id=r.preserve_plan_id |
16 | <where> | 22 | <where> |
17 | - <if test="queryMap.id !=null "> | 23 | + <if test="queryMap.id !=null and queryMap.id !=''"> |
18 | AND r.id = #{queryMap.id} | 24 | AND r.id = #{queryMap.id} |
19 | </if> | 25 | </if> |
20 | - <if test="queryMap.tenantId !=null "> | 26 | + <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> |
21 | AND r.tenant_id = #{queryMap.tenantId} | 27 | AND r.tenant_id = #{queryMap.tenantId} |
22 | </if> | 28 | </if> |
23 | - <if test="queryMap.preserve_plan_id !=null "> | 29 | + <if test="queryMap.preserve_plan_id !=null and queryMap.preserve_plan_id !=''"> |
24 | AND r.status = #{queryMap.preservePlanId} | 30 | AND r.status = #{queryMap.preservePlanId} |
25 | </if> | 31 | </if> |
26 | - <if test="queryMap.preserve_by !=null "> | 32 | + <if test="queryMap.preserve_by !=null and queryMap.preserve_by !=''"> |
27 | AND r.device_id = #{queryMap.preserveBy} | 33 | AND r.device_id = #{queryMap.preserveBy} |
28 | </if> | 34 | </if> |
29 | - <if test="queryMap.preserve_status !=null "> | 35 | + <if test="queryMap.preserve_status !=null and queryMap.preserve_status !=''"> |
30 | AND r.emergency = #{queryMap.preserveStatus} | 36 | AND r.emergency = #{queryMap.preserveStatus} |
31 | </if> | 37 | </if> |
32 | - <if test="queryMap.startDate !=null "> | 38 | + <if test="queryMap.startDate !=null and queryMap.startDate !=''"> |
33 | AND to_char(r.preserve_date, 'YYYY-MM-DD HH24:MI:SS') >= #{queryMap.startDate} | 39 | AND to_char(r.preserve_date, 'YYYY-MM-DD HH24:MI:SS') >= #{queryMap.startDate} |
34 | </if> | 40 | </if> |
35 | - <if test="queryMap.endDate !=null "> | 41 | + <if test="queryMap.endDate !=null and queryMap.endDate !=''"> |
36 | AND to_char(r.preserve_date, 'YYYY-MM-DD HH24:MI:SS') <= #{queryMap.endDate} | 42 | AND to_char(r.preserve_date, 'YYYY-MM-DD HH24:MI:SS') <= #{queryMap.endDate} |
37 | </if> | 43 | </if> |
44 | + <if test="queryMap.planIdList !=null"> | ||
45 | + AND r.preserve_plan_id in | ||
46 | + <foreach collection="queryMap.planIdList" item="item" index="index" | ||
47 | + separator="," open="(" close=")"> | ||
48 | + #{item} | ||
49 | + </foreach> | ||
50 | + </if> | ||
38 | </where> | 51 | </where> |
39 | </select> | 52 | </select> |
40 | </mapper> | 53 | </mapper> |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | <mapper namespace="org.thingsboard.server.dao.yunteng.mapper.TkRepairOrderMapper"> | 4 | <mapper namespace="org.thingsboard.server.dao.yunteng.mapper.TkRepairOrderMapper"> |
5 | <resultMap type="org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO" id="repairOrderMap"> | 5 | <resultMap type="org.thingsboard.server.common.data.yunteng.dto.TkRepairOrderDTO" id="repairOrderMap"> |
6 | + <result property="id" column="id"/> | ||
6 | <result property="orderCode" column="order_code"/> | 7 | <result property="orderCode" column="order_code"/> |
7 | <result property="deviceId" column="device_id"/> | 8 | <result property="deviceId" column="device_id"/> |
8 | <result property="reportDate" column="report_date"/> | 9 | <result property="reportDate" column="report_date"/> |
@@ -37,6 +38,7 @@ | @@ -37,6 +38,7 @@ | ||
37 | <result property="registeDate" column="registe_date"/> | 38 | <result property="registeDate" column="registe_date"/> |
38 | <result property="supplierId" column="supplier_id"/> | 39 | <result property="supplierId" column="supplier_id"/> |
39 | <result property="description" column="daDescription"/> | 40 | <result property="description" column="daDescription"/> |
41 | + <result property="directorName" column="directorName"/> | ||
40 | </association> | 42 | </association> |
41 | </resultMap> | 43 | </resultMap> |
42 | <select id="getRepairOrderPage" resultMap="repairOrderMap"> | 44 | <select id="getRepairOrderPage" resultMap="repairOrderMap"> |
@@ -44,12 +46,16 @@ | @@ -44,12 +46,16 @@ | ||
44 | o.id,o.device_id,o.order_code,o.report_date,o.report_by,o.status,o.emergency,o.situation_img,o.description, | 46 | o.id,o.device_id,o.order_code,o.report_date,o.report_by,o.status,o.emergency,o.situation_img,o.description, |
45 | da.name as daName,da.code as daCode,da.category_id,da.status as daStatus,da.director_id,da.is_online, | 47 | da.name as daName,da.code as daCode,da.category_id,da.status as daStatus,da.director_id,da.is_online, |
46 | da.brand,da.model_num,da.specifications,da.manufacturer,da.buy_date,da.price,da.product_date, | 48 | da.brand,da.model_num,da.specifications,da.manufacturer,da.buy_date,da.price,da.product_date, |
47 | - da.receive_date,da.registe_date,da.supplier_id,da.device_img,da.description as daDescription, | 49 | + da.receive_date,da.registe_date,da.supplier_id,da.device_img,da.description as daDescription,su2.real_name as directorName, |
48 | o.tenant_id,o.create_time,o.updater,o.update_time,o.creator,su.real_name as reportByName | 50 | o.tenant_id,o.create_time,o.updater,o.update_time,o.creator,su.real_name as reportByName |
49 | from qg_repair_order o | 51 | from qg_repair_order o |
50 | inner join sys_user su on su.id=o.report_by | 52 | inner join sys_user su on su.id=o.report_by |
51 | inner join qg_device_account da on da.id=o.device_id | 53 | inner join qg_device_account da on da.id=o.device_id |
54 | + inner join sys_user su2 on su2.id=da.director_id | ||
52 | <where> | 55 | <where> |
56 | + <if test="queryMap.id !=null "> | ||
57 | + AND o.id = #{queryMap.id} | ||
58 | + </if> | ||
53 | <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> | 59 | <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> |
54 | AND o.tenant_id = #{queryMap.tenantId} | 60 | AND o.tenant_id = #{queryMap.tenantId} |
55 | </if> | 61 | </if> |
@@ -59,7 +65,7 @@ | @@ -59,7 +65,7 @@ | ||
59 | <if test="queryMap.deviceId !=null and queryMap.deviceId !=''"> | 65 | <if test="queryMap.deviceId !=null and queryMap.deviceId !=''"> |
60 | AND o.device_id = #{queryMap.deviceId} | 66 | AND o.device_id = #{queryMap.deviceId} |
61 | </if> | 67 | </if> |
62 | - <if test="queryMap.emergency !=null and queryMap.emergency !=''"> | 68 | + <if test="queryMap.emergency !=null"> |
63 | AND o.emergency = #{queryMap.emergency} | 69 | AND o.emergency = #{queryMap.emergency} |
64 | </if> | 70 | </if> |
65 | <if test="queryMap.startDate !=null and queryMap.startDate !=''"> | 71 | <if test="queryMap.startDate !=null and queryMap.startDate !=''"> |
@@ -45,6 +45,9 @@ | @@ -45,6 +45,9 @@ | ||
45 | <if test="queryMap.reportBy !=null and queryMap.reportBy !=''"> | 45 | <if test="queryMap.reportBy !=null and queryMap.reportBy !=''"> |
46 | AND ro.report_by = #{queryMap.reportBy} | 46 | AND ro.report_by = #{queryMap.reportBy} |
47 | </if> | 47 | </if> |
48 | + <if test="queryMap.deviceId !=null and queryMap.deviceId !=''"> | ||
49 | + AND ro.device_id = #{queryMap.deviceId} | ||
50 | + </if> | ||
48 | <if test="queryMap.orderCode !=null and queryMap.orderCode !=''"> | 51 | <if test="queryMap.orderCode !=null and queryMap.orderCode !=''"> |
49 | AND ro.order_code LIKE concat('%',#{queryMap.orderCode}::TEXT,'%') | 52 | AND ro.order_code LIKE concat('%',#{queryMap.orderCode}::TEXT,'%') |
50 | </if> | 53 | </if> |