mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
优化
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package cn.lihongjie.coal.deviceWorkOrder.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.common.DictCode;
|
||||
import cn.lihongjie.coal.device.entity.DeviceEntity;
|
||||
import cn.lihongjie.coal.deviceWorkOrderDetail.dto.DeviceWorkOrderDetailDto;
|
||||
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
|
||||
import cn.lihongjie.coal.user.entity.UserEntity;
|
||||
|
||||
import jakarta.persistence.ManyToOne;
|
||||
@@ -12,7 +14,6 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@@ -36,41 +37,22 @@ public class DeviceWorkOrderDto extends OrgCommonDto {
|
||||
@Comment("工单类型")
|
||||
private String type;
|
||||
|
||||
@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 = 'device.workOrder.type'\n"
|
||||
+ " and i.code = type)")
|
||||
@DictTranslate(dictKey = DictCode.DEVICE_WORKORDER_TYPE)
|
||||
private String typeName;
|
||||
|
||||
@Comment("工单状态")
|
||||
private String orderStatus;
|
||||
|
||||
@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 = 'device.workOrder.status'\n"
|
||||
+ " and i.code = order_status)")
|
||||
@DictTranslate(dictKey = DictCode.DEVICE_WORKORDER_STATUS)
|
||||
private String orderStatusName;
|
||||
|
||||
@Comment("归档状态")
|
||||
@ColumnDefault("'0'")
|
||||
private String archiveStatus;
|
||||
|
||||
@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)")
|
||||
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
|
||||
private String archiveStatusName;
|
||||
|
||||
|
||||
private List<DeviceWorkOrderDetailDto> details;
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.hibernate.annotations.Formula;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@@ -41,39 +40,17 @@ public class DeviceWorkOrderEntity extends OrgCommonEntity {
|
||||
@Comment("工单类型")
|
||||
private String type;
|
||||
|
||||
@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 = 'device.workOrder.type'\n"
|
||||
+ " and i.code = type)")
|
||||
private String typeName;
|
||||
|
||||
@Comment("工单状态")
|
||||
private String orderStatus;
|
||||
|
||||
@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 = 'device.workOrder.status'\n"
|
||||
+ " and i.code = order_status)")
|
||||
private String orderStatusName;
|
||||
|
||||
|
||||
@Comment("归档状态")
|
||||
@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;
|
||||
|
||||
|
||||
|
||||
@OneToMany(mappedBy = "workOrder", cascade = {CascadeType.ALL})
|
||||
|
||||
Reference in New Issue
Block a user