设备缓存增加iotModelCode

This commit is contained in:
谷成伟 2024-12-31 16:54:06 +08:00
parent 633566bda8
commit 2a1a768d18
3 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import com.das.modules.equipment.mapper.SysEquipmentMapper;
import com.das.modules.equipment.mapper.SysIotModelMapper;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -16,6 +17,7 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
@Slf4j
@Service
public class EquipmentCacheImpl implements EquipmentCache {
@Autowired
@ -46,8 +48,10 @@ public class EquipmentCacheImpl implements EquipmentCache {
deviceInfoCache.setMadeinFactory(equipment.getMadeinFactory());
deviceInfoCache.setParentDeviceId(equipment.getParentEquipmentId());
deviceInfoCache.setIotModelId(equipment.getIotModelId());
String iotModelCode = sysIotModelMapper.getIotModel(equipment.getIotModelId());
String iotModelCode = sysIotModelMapper.getIodModelCode(equipment.getIotModelId());
log.debug("iotModelId: {}", equipment.getIotModelId());
if (StrUtil.isNotBlank(iotModelCode)){
log.debug("iotModelCode: {}", iotModelCode);
deviceInfoCache.setIotModelCode(iotModelCode);
}
//创建Code索引

View File

@ -31,6 +31,8 @@ public interface SysIotModelMapper extends BaseMapper<SysIotModel> {
String getIotModel(Long id);
String getIodModelCode(Long id);
List<SysIotModelField> getAllIotModelField(Long id);
SysIotModelVo selectIotModelByCode(String code);

View File

@ -77,6 +77,10 @@
select sim.iot_model_code from sys_iot_model sim left join sys_equipment se on sim.id = se.iot_model_id
where se.id = #{id}
</select>
<select id="getIodModelCode" resultType="java.lang.String">
select sim.iot_model_code from sys_iot_model sim where sim.id = #{id}
</select>
<select id="getAllIotModelField" resultType="com.das.modules.equipment.entity.SysIotModelField">
select simf.attribute_name as attributeName, simf.attribute_code as attributeCode,simf.highspeed as highSpeed,simf.datatype as dataType,simf.attribute_type as attributeType,simf.level as level,simf.stateDesc as stateDesc from sys_iot_model_field simf where simf.iot_model_id = #{id} order by simf.attribute_code
</select>