Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
120ab69fe9 | 7 days ago |
|
|
c5403a44dc | 7 days ago |
|
|
3f65d9af20 | 3 weeks ago |
|
|
4f05e2bf29 | 3 weeks ago |
|
|
74e72c24e3 | 3 weeks ago |
|
|
3190cfa03a | 3 weeks ago |
|
|
666b74b822 | 3 weeks ago |
|
|
9054141457 | 3 weeks ago |
|
|
e3c44537e3 | 4 weeks ago |
5 changed files with 332 additions and 32 deletions
@ -0,0 +1,36 @@ |
|||||
|
package com.techsor.datacenter.sender.dao; |
||||
|
|
||||
|
import com.techsor.datacenter.sender.entitiy.DeviceEntity; |
||||
|
import com.techsor.datacenter.sender.entitiy.TypeEntity; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.cache.annotation.Cacheable; |
||||
|
import org.springframework.jdbc.core.JdbcTemplate; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Component |
||||
|
public class TypeDAO { |
||||
|
|
||||
|
@Resource |
||||
|
private JdbcTemplate jdbcTemplate ; |
||||
|
|
||||
|
//Get Wsclient info by deviceId
|
||||
|
@Cacheable(value = "typeDAO::queryCategoryIdByTypeId", key = "#typeId") |
||||
|
public Long queryCategoryIdByTypeId(Integer typeId) { |
||||
|
String sql = "SELECT id,device_category_id FROM type WHERE id="+typeId+" and flag!=1"; |
||||
|
List<TypeEntity> dataList = jdbcTemplate.query(sql, |
||||
|
(rs, rowNum) -> { |
||||
|
TypeEntity item = new TypeEntity(); |
||||
|
item.setId(rs.getInt("id")); |
||||
|
item.setDeviceCategoryId(rs.getLong("device_category_id")); |
||||
|
return item; |
||||
|
}); |
||||
|
if (dataList.size()==0){ |
||||
|
return null; |
||||
|
}else{ |
||||
|
return dataList.get(dataList.size()-1).getDeviceCategoryId(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
package com.techsor.datacenter.sender.entitiy; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
public class TypeEntity implements Serializable { |
||||
|
|
||||
|
private Integer id; |
||||
|
private String name; |
||||
|
private String description; |
||||
|
private String deviceType; // 设备类别
|
||||
|
private String deviceDataSrc; // 设备数据来源
|
||||
|
private String originJsonFormat; // 原始数据来源
|
||||
|
private String expressionMap; // 表达式映射
|
||||
|
private String expressionVariableMap; // 表达式变量map
|
||||
|
private String targetJsonFormat; // 转发数据格式
|
||||
|
private Long targetForwardId; // 转发目标ID
|
||||
|
private String targetForwardCode; // 转发识别代码 (修正了原表中的拼写错误)
|
||||
|
private Long createdBy; // 创建人
|
||||
|
private Long updatedBy; // 更新人
|
||||
|
private Long companyId; // 公司ID
|
||||
|
private Long spaceId; // 空间ID
|
||||
|
private Integer flag; // 标志位:0:正常;1:删除
|
||||
|
private String dbmId; // dbmId,{"[deviceId][dbm_id]":value}
|
||||
|
private String nameZh; // name中文
|
||||
|
private String nameEn; // name英文
|
||||
|
private Long deviceCategoryId; // 设备大类ID
|
||||
|
private String unit; // 单位信息
|
||||
|
} |
||||
Loading…
Reference in new issue