Commit a8600ad3cbbf66e9688059a506dfc0fb580b4f6c

Authored by 云中非
1 parent 58442f80

fix: 编辑转换脚本,同步修改设备配置问题修复

@@ -228,7 +228,7 @@ public class YtDeviceScriptController extends BaseController { @@ -228,7 +228,7 @@ public class YtDeviceScriptController extends BaseController {
228 DeviceProfileDTO deviceProfileDTO, String scriptId, String scriptText) { 228 DeviceProfileDTO deviceProfileDTO, String scriptId, String scriptText) {
229 DeviceProfile tbDeviceProfile = new DeviceProfile(); 229 DeviceProfile tbDeviceProfile = new DeviceProfile();
230 if (StringUtils.isNotBlank(deviceProfileDTO.getId())) { 230 if (StringUtils.isNotBlank(deviceProfileDTO.getId())) {
231 - UUID profileId = UUID.fromString(deviceProfileDTO.getId()); 231 + UUID profileId = UUID.fromString(deviceProfileDTO.getTbProfileId());
232 tbDeviceProfile.setId(new DeviceProfileId(profileId)); 232 tbDeviceProfile.setId(new DeviceProfileId(profileId));
233 tbDeviceProfile.setCreatedTime( 233 tbDeviceProfile.setCreatedTime(
234 deviceProfileDTO.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli()); 234 deviceProfileDTO.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
@@ -169,15 +169,7 @@ public class YtDeviceProfileServiceImpl @@ -169,15 +169,7 @@ public class YtDeviceProfileServiceImpl
169 169
170 @Override 170 @Override
171 public List<DeviceProfileDTO> findDeviceProfile(String tenantId, String scriptId) { 171 public List<DeviceProfileDTO> findDeviceProfile(String tenantId, String scriptId) {
172 - LambdaQueryWrapper<YtDeviceProfileEntity> queryWrapper =  
173 - new QueryWrapper<YtDeviceProfileEntity>()  
174 - .lambda()  
175 - .eq(YtDeviceProfileEntity::getTenantId, tenantId)  
176 - .eq(StringUtils.isNotEmpty(scriptId), YtDeviceProfileEntity::getScriptId, scriptId);  
177 - List<DeviceProfileDTO> results =  
178 - baseMapper.selectList(queryWrapper).stream()  
179 - .map(item -> item.getDTO(DeviceProfileDTO.class))  
180 - .collect(Collectors.toList()); 172 + List<DeviceProfileDTO> results = baseMapper.profileByScriptId(tenantId,scriptId);
181 return results; 173 return results;
182 } 174 }
183 } 175 }
@@ -22,4 +22,6 @@ public interface YtDeviceProfileMapper extends BaseMapper<YtDeviceProfileEntity> @@ -22,4 +22,6 @@ public interface YtDeviceProfileMapper extends BaseMapper<YtDeviceProfileEntity>
22 22
23 IPage<DeviceProfileDTO> getProfilePage(IPage<?> page, @Param("tenantId") String tenantId, @Param("profileName") String profileName, @Param("transportType") String transportType); 23 IPage<DeviceProfileDTO> getProfilePage(IPage<?> page, @Param("tenantId") String tenantId, @Param("profileName") String profileName, @Param("transportType") String transportType);
24 24
  25 +
  26 + List<DeviceProfileDTO> profileByScriptId( @Param("tenantId") String tenantId, @Param("scriptId") String scriptId);
25 } 27 }
@@ -63,4 +63,16 @@ @@ -63,4 +63,16 @@
63 </if> 63 </if>
64 </where> 64 </where>
65 </select> 65 </select>
  66 + <select id="profileByScriptId" resultMap="detail">
  67 + SELECT
  68 + <include refid="basicColumns"/>
  69 + FROM device_profile base
  70 + LEFT JOIN iotfs_device_profile iot ON iot.tb_profile_id = base.id::TEXT
  71 + <where>
  72 + iot.tenant_id = #{tenantId}
  73 + <if test="scriptId !=null and scriptId !=''">
  74 + AND iot.script_id = #{scriptId}
  75 + </if>
  76 + </where>
  77 + </select>
66 </mapper> 78 </mapper>