This commit is contained in:
2024-04-18 16:25:45 +08:00
parent 0b6ff9d95f
commit dd2aa08e61
5 changed files with 10 additions and 30 deletions

View File

@@ -93,7 +93,7 @@ public class DictionaryService extends BaseService<DictionaryEntity, DictionaryR
ans.setTree(TreeDto.buildList(result.getResponse(), flatten));
} else {
throw new BizException("不支持的字典类型 " + dict.getDictTypeName());
throw new BizException("不支持的字典类型 " + dict.getDictType());
}
return ans;

View File

@@ -1,8 +1,10 @@
package cn.lihongjie.coal.emDevice.dto;
import cn.lihongjie.coal.base.dto.OrgCommonDto;
import cn.lihongjie.coal.common.DictCode;
import cn.lihongjie.coal.emDevice.entity.EmDeviceItemConfig;
import cn.lihongjie.coal.emDeviceSupplier.dto.EmDeviceSupplierDto;
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
import cn.lihongjie.coal.thirdAccount.dto.ThirdAccountDto;
import lombok.Data;
@@ -28,6 +30,7 @@ public class EmDeviceDto extends OrgCommonDto {
private String location;
private String archiveStatus;
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
private String archiveStatusName;
private List<EmDeviceItemConfig> itemConfig;

View File

@@ -12,7 +12,6 @@ import lombok.Data;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.Comment;
import org.hibernate.annotations.Formula;
import java.util.List;
@@ -27,14 +26,7 @@ public class EmDeviceEntity extends OrgCommonEntity {
@Comment("设备类型")
private String deviceType;
@Formula(
"(select i.name\n"
+ "from t_dictionary d,\n"
+ " t_dictionary_item i\n"
+ "where d.id = i.dictionary_id\n"
+ " and d.code = 'em.device.type'\n"
+ " and i.code = device_type)")
private String deviceTypeName;
private String location;
@@ -42,14 +34,7 @@ public class EmDeviceEntity extends OrgCommonEntity {
@ColumnDefault("'0'")
private String archiveStatus = "0";
@Formula(
"(select i.name\n"
+ "from t_dictionary d,\n"
+ " t_dictionary_item i\n"
+ "where d.id = i.dictionary_id\n"
+ " and d.code = 'archiveStatus'\n"
+ " and i.code = archive_status)")
private String archiveStatusName;
@ElementCollection

View File

@@ -1,8 +1,10 @@
package cn.lihongjie.coal.pdcDevice.dto;
import cn.lihongjie.coal.base.dto.OrgCommonDto;
import cn.lihongjie.coal.common.DictCode;
import cn.lihongjie.coal.dataCollector.dto.DataCollectorDto;
import cn.lihongjie.coal.pdcDeviceSupplier.dto.PdcDeviceSupplierDto;
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
import jakarta.persistence.ManyToOne;
@@ -34,12 +36,9 @@ public class PdcDeviceDto extends OrgCommonDto {
@Comment("煤类型")
private String coalType;
@DictTranslate(dictKey = DictCode.COAL_TYPE)
private String coalTypeName;
@Comment("MODBUS地址")
private String modbusUId;

View File

@@ -34,14 +34,7 @@ public class PdcDeviceEntity extends OrgCommonEntity {
@Comment("煤类型")
private String coalType;
@Formula(
"(select i.name\n"
+ "from t_dictionary d,\n"
+ " t_dictionary_item i\n"
+ "where d.id = i.dictionary_id\n"
+ " and d.code = 'coal.type'\n"
+ " and i.code = coal_type)")
private String coalTypeName;