Преглед на файлове

时间段内第一条和最后一条数据

songxiaohang преди 1 година
родител
ревизия
9a34103129

+ 4 - 0
app/cmd/dtgateway/desc/dtgateway.api

@@ -45,4 +45,8 @@ service dtgateway {
 	@doc "按时间点位历史数据最大值最小值查询"
 	@handler ItemHistoryDataMaxMin
 	get /item-history/max-min (ItemHistoryDataMaxMinByTimeReq) returns (CommonResponse)
+	
+	@doc "点位查询时间内第一个和最后一个值"
+	@handler ItemHistoryDataFirstLast
+	get /item-history/first-last (ItemHistoryDataByTimeReq) returns (CommonResponse)
 }

+ 10 - 10
app/cmd/dtgateway/etc/dtgateway.yaml

@@ -18,17 +18,17 @@ Log:
   Level: error
 
 DtDataStoreDB:
-  #  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(192.168.60.201:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
-  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(172.16.0.195:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
+    DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(192.168.60.201:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
+#  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(172.16.0.195:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
 
 #rpc service
-#OrganizationRpcConf:
-#  Endpoints:
-#    - 127.0.0.1:1117
-#  NonBlock: true
-#  Timeout: 0
-
 OrganizationRpcConf:
-  Timeout: 50000
-  Target: k8s://gt-datacenter/organization-rpc-svc:1117 #goctl kube 默认生成的k8s yaml的serviceName: {rpc中定义的name}-svc
+  Endpoints:
+    - 127.0.0.1:1117
+  NonBlock: true
+  Timeout: 0
+
+#OrganizationRpcConf:
+#  Timeout: 50000
+#  Target: k8s://gt-datacenter/organization-rpc-svc:1117 #goctl kube 默认生成的k8s yaml的serviceName: {rpc中定义的name}-svc
 

+ 5 - 0
app/cmd/dtgateway/internal/handler/routes.go

@@ -60,6 +60,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 					Path:    "/item-history/max-min",
 					Handler: dtgateway.ItemHistoryDataMaxMinHandler(serverCtx),
 				},
+				{
+					Method:  http.MethodGet,
+					Path:    "/item-history/first-last",
+					Handler: dtgateway.ItemHistoryDataFirstLastHandler(serverCtx),
+				},
 			}...,
 		),
 		rest.WithPrefix("/api/dtgateway/v1"),

+ 2 - 2
app/cmd/organization/etc/organization.yaml

@@ -13,8 +13,8 @@ Log:
 GtServerIp: 172.16.69.188:8900
 
 DtDataStoreDB:
-#  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(192.168.60.201:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
-  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(172.16.0.195:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
+  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(192.168.60.201:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
+#  DataSource: ws_data:c712f89fc4f8edaf30e41b828f4e3d26@tcp(172.16.0.195:4000)/ws_data?charset=utf8mb4&parseTime=True&loc=&loc=Asia%2FShanghai
 
 Redis:
   Host: 172.16.69.193:36379

+ 5 - 0
app/cmd/organization/internal/server/organizationServer.go

@@ -66,3 +66,8 @@ func (s *OrganizationServer) ItemHistoryDataMaxMinByTime(ctx context.Context, in
 	l := logic.NewItemHistoryDataMaxMinByTimeLogic(ctx, s.svcCtx)
 	return l.ItemHistoryDataMaxMinByTime(in)
 }
+
+func (s *OrganizationServer) ItemHistoryDataFirstLastByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*pb.ItemHistoryDataFirstLastResp, error) {
+	l := logic.NewItemHistoryDataFirstLastByTimeLogic(ctx, s.svcCtx)
+	return l.ItemHistoryDataFirstLastByTime(in)
+}

+ 8 - 0
app/cmd/organization/organization.proto

@@ -459,6 +459,13 @@ message ItemHistoryDataMaxMinResp {
   double    min_val = 2;
 }
 
+message ItemHistoryDataFirstLastResp {
+  // @gotags: json:"first"
+  double    first = 1;
+  // @gotags: json:"last"
+  double    last = 2;
+}
+
 message ItemHistoryDataList {
   // @gotags: json:"item_name"
   string    item_name = 1;
@@ -518,4 +525,5 @@ service Organization {
   rpc ItemHistoryDataList(ItemHistoryDataListReq) returns(ItemHistoryDataListResp);
   rpc ItemHistoryDataByTime(ItemHistoryDataByTimeReq) returns(ItemHistoryDataListResp);
   rpc ItemHistoryDataMaxMinByTime(ItemHistoryDataByTimeReq) returns(ItemHistoryDataMaxMinResp);
+  rpc ItemHistoryDataFirstLastByTime(ItemHistoryDataByTimeReq) returns(ItemHistoryDataFirstLastResp);
 }

+ 30 - 23
app/cmd/organization/organization/organization.go

@@ -13,29 +13,30 @@ import (
 )
 
 type (
-	DcWorkingReq                = pb.DcWorkingReq
-	GetWorkingChestByCodeResp   = pb.GetWorkingChestByCodeResp
-	GetWorkingMfByCodeResp      = pb.GetWorkingMfByCodeResp
-	GetWorkingNfByCodeResp      = pb.GetWorkingNfByCodeResp
-	GetWorkingPumpByCodeResp    = pb.GetWorkingPumpByCodeResp
-	GetWorkingRoByCodeResp      = pb.GetWorkingRoByCodeResp
-	GetWorkingUfByCodeResp      = pb.GetWorkingUfByCodeResp
-	GetWorkingValveByCodeResp   = pb.GetWorkingValveByCodeResp
-	ItemHistoryData             = pb.ItemHistoryData
-	ItemHistoryDataByTimeReq    = pb.ItemHistoryDataByTimeReq
-	ItemHistoryDataList         = pb.ItemHistoryDataList
-	ItemHistoryDataListReq      = pb.ItemHistoryDataListReq
-	ItemHistoryDataListResp     = pb.ItemHistoryDataListResp
-	ItemHistoryDataMaxMinResp   = pb.ItemHistoryDataMaxMinResp
-	MultiAddItemHistoryDataReq  = pb.MultiAddItemHistoryDataReq
-	MultiAddItemHistoryDataResp = pb.MultiAddItemHistoryDataResp
-	WorkingChest                = pb.WorkingChest
-	WorkingMf                   = pb.WorkingMf
-	WorkingNf                   = pb.WorkingNf
-	WorkingPump                 = pb.WorkingPump
-	WorkingRo                   = pb.WorkingRo
-	WorkingUf                   = pb.WorkingUf
-	WorkingValve                = pb.WorkingValve
+	DcWorkingReq                 = pb.DcWorkingReq
+	GetWorkingChestByCodeResp    = pb.GetWorkingChestByCodeResp
+	GetWorkingMfByCodeResp       = pb.GetWorkingMfByCodeResp
+	GetWorkingNfByCodeResp       = pb.GetWorkingNfByCodeResp
+	GetWorkingPumpByCodeResp     = pb.GetWorkingPumpByCodeResp
+	GetWorkingRoByCodeResp       = pb.GetWorkingRoByCodeResp
+	GetWorkingUfByCodeResp       = pb.GetWorkingUfByCodeResp
+	GetWorkingValveByCodeResp    = pb.GetWorkingValveByCodeResp
+	ItemHistoryData              = pb.ItemHistoryData
+	ItemHistoryDataByTimeReq     = pb.ItemHistoryDataByTimeReq
+	ItemHistoryDataFirstLastResp = pb.ItemHistoryDataFirstLastResp
+	ItemHistoryDataList          = pb.ItemHistoryDataList
+	ItemHistoryDataListReq       = pb.ItemHistoryDataListReq
+	ItemHistoryDataListResp      = pb.ItemHistoryDataListResp
+	ItemHistoryDataMaxMinResp    = pb.ItemHistoryDataMaxMinResp
+	MultiAddItemHistoryDataReq   = pb.MultiAddItemHistoryDataReq
+	MultiAddItemHistoryDataResp  = pb.MultiAddItemHistoryDataResp
+	WorkingChest                 = pb.WorkingChest
+	WorkingMf                    = pb.WorkingMf
+	WorkingNf                    = pb.WorkingNf
+	WorkingPump                  = pb.WorkingPump
+	WorkingRo                    = pb.WorkingRo
+	WorkingUf                    = pb.WorkingUf
+	WorkingValve                 = pb.WorkingValve
 
 	Organization interface {
 		GetWorkingUfByCode(ctx context.Context, in *DcWorkingReq, opts ...grpc.CallOption) (*GetWorkingUfByCodeResp, error)
@@ -47,6 +48,7 @@ type (
 		ItemHistoryDataList(ctx context.Context, in *ItemHistoryDataListReq, opts ...grpc.CallOption) (*ItemHistoryDataListResp, error)
 		ItemHistoryDataByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataListResp, error)
 		ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error)
+		ItemHistoryDataFirstLastByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataFirstLastResp, error)
 	}
 
 	defaultOrganization struct {
@@ -104,3 +106,8 @@ func (m *defaultOrganization) ItemHistoryDataMaxMinByTime(ctx context.Context, i
 	client := pb.NewOrganizationClient(m.cli.Conn())
 	return client.ItemHistoryDataMaxMinByTime(ctx, in, opts...)
 }
+
+func (m *defaultOrganization) ItemHistoryDataFirstLastByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataFirstLastResp, error) {
+	client := pb.NewOrganizationClient(m.cli.Conn())
+	return client.ItemHistoryDataFirstLastByTime(ctx, in, opts...)
+}

+ 237 - 154
app/cmd/organization/pb/organization.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.28.0
-// 	protoc        v4.23.4
+// 	protoc-gen-go v1.30.0
+// 	protoc        v3.21.12
 // source: organization.proto
 
 package pb
@@ -2457,6 +2457,63 @@ func (x *ItemHistoryDataMaxMinResp) GetMinVal() float64 {
 	return 0
 }
 
+type ItemHistoryDataFirstLastResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	// @gotags: json:"first"
+	First float64 `protobuf:"fixed64,1,opt,name=first,proto3" json:"first"`
+	// @gotags: json:"last"
+	Last float64 `protobuf:"fixed64,2,opt,name=last,proto3" json:"last"`
+}
+
+func (x *ItemHistoryDataFirstLastResp) Reset() {
+	*x = ItemHistoryDataFirstLastResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_organization_proto_msgTypes[14]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *ItemHistoryDataFirstLastResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemHistoryDataFirstLastResp) ProtoMessage() {}
+
+func (x *ItemHistoryDataFirstLastResp) ProtoReflect() protoreflect.Message {
+	mi := &file_organization_proto_msgTypes[14]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use ItemHistoryDataFirstLastResp.ProtoReflect.Descriptor instead.
+func (*ItemHistoryDataFirstLastResp) Descriptor() ([]byte, []int) {
+	return file_organization_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *ItemHistoryDataFirstLastResp) GetFirst() float64 {
+	if x != nil {
+		return x.First
+	}
+	return 0
+}
+
+func (x *ItemHistoryDataFirstLastResp) GetLast() float64 {
+	if x != nil {
+		return x.Last
+	}
+	return 0
+}
+
 type ItemHistoryDataList struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -2473,7 +2530,7 @@ type ItemHistoryDataList struct {
 func (x *ItemHistoryDataList) Reset() {
 	*x = ItemHistoryDataList{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[14]
+		mi := &file_organization_proto_msgTypes[15]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2486,7 +2543,7 @@ func (x *ItemHistoryDataList) String() string {
 func (*ItemHistoryDataList) ProtoMessage() {}
 
 func (x *ItemHistoryDataList) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[14]
+	mi := &file_organization_proto_msgTypes[15]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2499,7 +2556,7 @@ func (x *ItemHistoryDataList) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use ItemHistoryDataList.ProtoReflect.Descriptor instead.
 func (*ItemHistoryDataList) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{14}
+	return file_organization_proto_rawDescGZIP(), []int{15}
 }
 
 func (x *ItemHistoryDataList) GetItemName() string {
@@ -2535,7 +2592,7 @@ type ItemHistoryDataListResp struct {
 func (x *ItemHistoryDataListResp) Reset() {
 	*x = ItemHistoryDataListResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[15]
+		mi := &file_organization_proto_msgTypes[16]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2548,7 +2605,7 @@ func (x *ItemHistoryDataListResp) String() string {
 func (*ItemHistoryDataListResp) ProtoMessage() {}
 
 func (x *ItemHistoryDataListResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[15]
+	mi := &file_organization_proto_msgTypes[16]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2561,7 +2618,7 @@ func (x *ItemHistoryDataListResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use ItemHistoryDataListResp.ProtoReflect.Descriptor instead.
 func (*ItemHistoryDataListResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{15}
+	return file_organization_proto_rawDescGZIP(), []int{16}
 }
 
 func (x *ItemHistoryDataListResp) GetList() []*ItemHistoryDataList {
@@ -2583,7 +2640,7 @@ type GetWorkingUfByCodeResp struct {
 func (x *GetWorkingUfByCodeResp) Reset() {
 	*x = GetWorkingUfByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[16]
+		mi := &file_organization_proto_msgTypes[17]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2596,7 +2653,7 @@ func (x *GetWorkingUfByCodeResp) String() string {
 func (*GetWorkingUfByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingUfByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[16]
+	mi := &file_organization_proto_msgTypes[17]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2609,7 +2666,7 @@ func (x *GetWorkingUfByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingUfByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingUfByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{16}
+	return file_organization_proto_rawDescGZIP(), []int{17}
 }
 
 func (x *GetWorkingUfByCodeResp) GetList() []*WorkingUf {
@@ -2631,7 +2688,7 @@ type GetWorkingRoByCodeResp struct {
 func (x *GetWorkingRoByCodeResp) Reset() {
 	*x = GetWorkingRoByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[17]
+		mi := &file_organization_proto_msgTypes[18]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2644,7 +2701,7 @@ func (x *GetWorkingRoByCodeResp) String() string {
 func (*GetWorkingRoByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingRoByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[17]
+	mi := &file_organization_proto_msgTypes[18]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2657,7 +2714,7 @@ func (x *GetWorkingRoByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingRoByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingRoByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{17}
+	return file_organization_proto_rawDescGZIP(), []int{18}
 }
 
 func (x *GetWorkingRoByCodeResp) GetList() []*WorkingRo {
@@ -2679,7 +2736,7 @@ type GetWorkingNfByCodeResp struct {
 func (x *GetWorkingNfByCodeResp) Reset() {
 	*x = GetWorkingNfByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[18]
+		mi := &file_organization_proto_msgTypes[19]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2692,7 +2749,7 @@ func (x *GetWorkingNfByCodeResp) String() string {
 func (*GetWorkingNfByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingNfByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[18]
+	mi := &file_organization_proto_msgTypes[19]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2705,7 +2762,7 @@ func (x *GetWorkingNfByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingNfByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingNfByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{18}
+	return file_organization_proto_rawDescGZIP(), []int{19}
 }
 
 func (x *GetWorkingNfByCodeResp) GetList() []*WorkingNf {
@@ -2727,7 +2784,7 @@ type GetWorkingMfByCodeResp struct {
 func (x *GetWorkingMfByCodeResp) Reset() {
 	*x = GetWorkingMfByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[19]
+		mi := &file_organization_proto_msgTypes[20]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2740,7 +2797,7 @@ func (x *GetWorkingMfByCodeResp) String() string {
 func (*GetWorkingMfByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingMfByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[19]
+	mi := &file_organization_proto_msgTypes[20]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2753,7 +2810,7 @@ func (x *GetWorkingMfByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingMfByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingMfByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{19}
+	return file_organization_proto_rawDescGZIP(), []int{20}
 }
 
 func (x *GetWorkingMfByCodeResp) GetList() []*WorkingMf {
@@ -2775,7 +2832,7 @@ type GetWorkingPumpByCodeResp struct {
 func (x *GetWorkingPumpByCodeResp) Reset() {
 	*x = GetWorkingPumpByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[20]
+		mi := &file_organization_proto_msgTypes[21]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2788,7 +2845,7 @@ func (x *GetWorkingPumpByCodeResp) String() string {
 func (*GetWorkingPumpByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingPumpByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[20]
+	mi := &file_organization_proto_msgTypes[21]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2801,7 +2858,7 @@ func (x *GetWorkingPumpByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingPumpByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingPumpByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{20}
+	return file_organization_proto_rawDescGZIP(), []int{21}
 }
 
 func (x *GetWorkingPumpByCodeResp) GetList() []*WorkingPump {
@@ -2823,7 +2880,7 @@ type GetWorkingValveByCodeResp struct {
 func (x *GetWorkingValveByCodeResp) Reset() {
 	*x = GetWorkingValveByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[21]
+		mi := &file_organization_proto_msgTypes[22]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2836,7 +2893,7 @@ func (x *GetWorkingValveByCodeResp) String() string {
 func (*GetWorkingValveByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingValveByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[21]
+	mi := &file_organization_proto_msgTypes[22]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2849,7 +2906,7 @@ func (x *GetWorkingValveByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingValveByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingValveByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{21}
+	return file_organization_proto_rawDescGZIP(), []int{22}
 }
 
 func (x *GetWorkingValveByCodeResp) GetList() []*WorkingValve {
@@ -2871,7 +2928,7 @@ type GetWorkingChestByCodeResp struct {
 func (x *GetWorkingChestByCodeResp) Reset() {
 	*x = GetWorkingChestByCodeResp{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_organization_proto_msgTypes[22]
+		mi := &file_organization_proto_msgTypes[23]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2884,7 +2941,7 @@ func (x *GetWorkingChestByCodeResp) String() string {
 func (*GetWorkingChestByCodeResp) ProtoMessage() {}
 
 func (x *GetWorkingChestByCodeResp) ProtoReflect() protoreflect.Message {
-	mi := &file_organization_proto_msgTypes[22]
+	mi := &file_organization_proto_msgTypes[23]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2897,7 +2954,7 @@ func (x *GetWorkingChestByCodeResp) ProtoReflect() protoreflect.Message {
 
 // Deprecated: Use GetWorkingChestByCodeResp.ProtoReflect.Descriptor instead.
 func (*GetWorkingChestByCodeResp) Descriptor() ([]byte, []int) {
-	return file_organization_proto_rawDescGZIP(), []int{22}
+	return file_organization_proto_rawDescGZIP(), []int{23}
 }
 
 func (x *GetWorkingChestByCodeResp) GetList() []*WorkingChest {
@@ -3358,91 +3415,102 @@ var file_organization_proto_rawDesc = []byte{
 	0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x76, 0x61,
 	0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x56, 0x61, 0x6c, 0x12,
 	0x17, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01,
-	0x52, 0x06, 0x6d, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x22, 0x5b, 0x0a, 0x13, 0x49, 0x74, 0x65, 0x6d,
-	0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x12,
-	0x1b, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
-	0x28, 0x09, 0x52, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03,
-	0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x15,
-	0x0a, 0x06, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
-	0x68, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x46, 0x0a, 0x17, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73,
-	0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
-	0x12, 0x2b, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17,
-	0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44,
-	0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a,
-	0x16, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x42, 0x79, 0x43,
-	0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18,
-	0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69,
-	0x6e, 0x67, 0x55, 0x66, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65,
-	0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65,
-	0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03,
-	0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52,
-	0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x57, 0x6f,
-	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x4e, 0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73,
+	0x52, 0x06, 0x6d, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x22, 0x48, 0x0a, 0x1c, 0x49, 0x74, 0x65, 0x6d,
+	0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x46, 0x69, 0x72, 0x73, 0x74,
+	0x4c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x72, 0x73,
+	0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x66, 0x69, 0x72, 0x73, 0x74, 0x12, 0x12,
+	0x0a, 0x04, 0x6c, 0x61, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x6c, 0x61,
+	0x73, 0x74, 0x22, 0x5b, 0x0a, 0x13, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
+	0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x74, 0x65,
+	0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x74,
+	0x65, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20,
+	0x01, 0x28, 0x01, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x15, 0x0a, 0x06, 0x68, 0x5f, 0x74, 0x69,
+	0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x22,
+	0x46, 0x0a, 0x17, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61,
+	0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x04, 0x6c, 0x69,
+	0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74,
+	0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73,
+	0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x57, 0x6f,
+	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73,
 	0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
-	0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x4e, 0x66, 0x52, 0x04,
+	0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x52, 0x04,
 	0x6c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69,
-	0x6e, 0x67, 0x4d, 0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21,
+	0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21,
 	0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70,
-	0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x4d, 0x66, 0x52, 0x04, 0x6c, 0x69, 0x73,
-	0x74, 0x22, 0x3f, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50,
-	0x75, 0x6d, 0x70, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a,
-	0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62,
-	0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x52, 0x04, 0x6c, 0x69,
-	0x73, 0x74, 0x22, 0x41, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67,
-	0x56, 0x61, 0x6c, 0x76, 0x65, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12,
-	0x24, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
-	0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x52,
-	0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x41, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b,
-	0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65,
-	0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
-	0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65,
-	0x73, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x32, 0xce, 0x05, 0x0a, 0x0c, 0x4f, 0x72, 0x67,
-	0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x12, 0x47, 0x65, 0x74,
-	0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12,
-	0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65,
-	0x71, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e,
-	0x67, 0x55, 0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a,
-	0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43,
-	0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69,
-	0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f,
-	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73,
-	0x70, 0x12, 0x48, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43,
-	0x68, 0x65, 0x73, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e,
-	0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x70,
-	0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73,
-	0x74, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x14, 0x47,
+	0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73,
+	0x74, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x4e,
+	0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c,
+	0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57,
+	0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x4e, 0x66, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x3b,
+	0x0a, 0x16, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x4d, 0x66, 0x42, 0x79,
+	0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74,
+	0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b,
+	0x69, 0x6e, 0x67, 0x4d, 0x66, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x3f, 0x0a, 0x18, 0x47,
 	0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x42, 0x79, 0x43,
-	0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69,
-	0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f,
-	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52,
-	0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e,
-	0x67, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70,
-	0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1d,
-	0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61,
-	0x6c, 0x76, 0x65, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5a, 0x0a,
-	0x17, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73,
-	0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75,
-	0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
-	0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75,
-	0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
-	0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x4e, 0x0a, 0x13, 0x49, 0x74, 0x65,
-	0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74,
-	0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
-	0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x70,
+	0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18,
+	0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69,
+	0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x41, 0x0a, 0x19,
+	0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x42,
+	0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x6c, 0x69, 0x73,
+	0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72,
+	0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22,
+	0x41, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65,
+	0x73, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04,
+	0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e,
+	0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6c, 0x69,
+	0x73, 0x74, 0x32, 0xb0, 0x06, 0x0a, 0x0c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74,
+	0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e,
+	0x67, 0x55, 0x66, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44,
+	0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x70, 0x62,
+	0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x42, 0x79, 0x43,
+	0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f,
+	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e,
+	0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a,
+	0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52,
+	0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, 0x15, 0x47,
+	0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x42, 0x79,
+	0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b,
+	0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57,
+	0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x64,
+	0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b,
+	0x69, 0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e,
+	0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a,
+	0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50,
+	0x75, 0x6d, 0x70, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a,
+	0x15, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x76, 0x65,
+	0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f,
+	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65,
+	0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x42, 0x79, 0x43,
+	0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5a, 0x0a, 0x17, 0x4d, 0x75, 0x6c, 0x74, 0x69,
+	0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61,
+	0x74, 0x61, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64,
+	0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52,
+	0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64,
+	0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x4e, 0x0a, 0x13, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f,
+	0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e,
+	0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c,
+	0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d,
+	0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x52, 0x0a, 0x15, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f,
+	0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70,
 	0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74,
-	0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x52, 0x0a, 0x15, 0x49, 0x74, 0x65,
-	0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69,
-	0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74,
-	0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71,
-	0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
-	0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5a, 0x0a,
-	0x1b, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61,
-	0x4d, 0x61, 0x78, 0x4d, 0x69, 0x6e, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70,
-	0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74,
-	0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e,
-	0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4d,
-	0x61, 0x78, 0x4d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
-	0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e,
+	0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c,
+	0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x5a, 0x0a, 0x1b, 0x49, 0x74, 0x65, 0x6d, 0x48,
+	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x78, 0x4d, 0x69, 0x6e,
+	0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d,
+	0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d,
+	0x65, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69,
+	0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x78, 0x4d, 0x69, 0x6e, 0x52,
+	0x65, 0x73, 0x70, 0x12, 0x60, 0x0a, 0x1e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f,
+	0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x42,
+	0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48,
+	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65,
+	0x52, 0x65, 0x71, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73,
+	0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4c, 0x61, 0x73,
+	0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -3457,35 +3525,36 @@ func file_organization_proto_rawDescGZIP() []byte {
 	return file_organization_proto_rawDescData
 }
 
-var file_organization_proto_msgTypes = make([]protoimpl.MessageInfo, 23)
+var file_organization_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
 var file_organization_proto_goTypes = []interface{}{
-	(*DcWorkingReq)(nil),                // 0: pb.DcWorkingReq
-	(*WorkingMf)(nil),                   // 1: pb.WorkingMf
-	(*WorkingUf)(nil),                   // 2: pb.WorkingUf
-	(*WorkingNf)(nil),                   // 3: pb.WorkingNf
-	(*WorkingRo)(nil),                   // 4: pb.WorkingRo
-	(*WorkingChest)(nil),                // 5: pb.WorkingChest
-	(*WorkingPump)(nil),                 // 6: pb.WorkingPump
-	(*WorkingValve)(nil),                // 7: pb.WorkingValve
-	(*ItemHistoryData)(nil),             // 8: pb.ItemHistoryData
-	(*MultiAddItemHistoryDataReq)(nil),  // 9: pb.MultiAddItemHistoryDataReq
-	(*MultiAddItemHistoryDataResp)(nil), // 10: pb.MultiAddItemHistoryDataResp
-	(*ItemHistoryDataListReq)(nil),      // 11: pb.ItemHistoryDataListReq
-	(*ItemHistoryDataByTimeReq)(nil),    // 12: pb.ItemHistoryDataByTimeReq
-	(*ItemHistoryDataMaxMinResp)(nil),   // 13: pb.ItemHistoryDataMaxMinResp
-	(*ItemHistoryDataList)(nil),         // 14: pb.ItemHistoryDataList
-	(*ItemHistoryDataListResp)(nil),     // 15: pb.ItemHistoryDataListResp
-	(*GetWorkingUfByCodeResp)(nil),      // 16: pb.GetWorkingUfByCodeResp
-	(*GetWorkingRoByCodeResp)(nil),      // 17: pb.GetWorkingRoByCodeResp
-	(*GetWorkingNfByCodeResp)(nil),      // 18: pb.GetWorkingNfByCodeResp
-	(*GetWorkingMfByCodeResp)(nil),      // 19: pb.GetWorkingMfByCodeResp
-	(*GetWorkingPumpByCodeResp)(nil),    // 20: pb.GetWorkingPumpByCodeResp
-	(*GetWorkingValveByCodeResp)(nil),   // 21: pb.GetWorkingValveByCodeResp
-	(*GetWorkingChestByCodeResp)(nil),   // 22: pb.GetWorkingChestByCodeResp
+	(*DcWorkingReq)(nil),                 // 0: pb.DcWorkingReq
+	(*WorkingMf)(nil),                    // 1: pb.WorkingMf
+	(*WorkingUf)(nil),                    // 2: pb.WorkingUf
+	(*WorkingNf)(nil),                    // 3: pb.WorkingNf
+	(*WorkingRo)(nil),                    // 4: pb.WorkingRo
+	(*WorkingChest)(nil),                 // 5: pb.WorkingChest
+	(*WorkingPump)(nil),                  // 6: pb.WorkingPump
+	(*WorkingValve)(nil),                 // 7: pb.WorkingValve
+	(*ItemHistoryData)(nil),              // 8: pb.ItemHistoryData
+	(*MultiAddItemHistoryDataReq)(nil),   // 9: pb.MultiAddItemHistoryDataReq
+	(*MultiAddItemHistoryDataResp)(nil),  // 10: pb.MultiAddItemHistoryDataResp
+	(*ItemHistoryDataListReq)(nil),       // 11: pb.ItemHistoryDataListReq
+	(*ItemHistoryDataByTimeReq)(nil),     // 12: pb.ItemHistoryDataByTimeReq
+	(*ItemHistoryDataMaxMinResp)(nil),    // 13: pb.ItemHistoryDataMaxMinResp
+	(*ItemHistoryDataFirstLastResp)(nil), // 14: pb.ItemHistoryDataFirstLastResp
+	(*ItemHistoryDataList)(nil),          // 15: pb.ItemHistoryDataList
+	(*ItemHistoryDataListResp)(nil),      // 16: pb.ItemHistoryDataListResp
+	(*GetWorkingUfByCodeResp)(nil),       // 17: pb.GetWorkingUfByCodeResp
+	(*GetWorkingRoByCodeResp)(nil),       // 18: pb.GetWorkingRoByCodeResp
+	(*GetWorkingNfByCodeResp)(nil),       // 19: pb.GetWorkingNfByCodeResp
+	(*GetWorkingMfByCodeResp)(nil),       // 20: pb.GetWorkingMfByCodeResp
+	(*GetWorkingPumpByCodeResp)(nil),     // 21: pb.GetWorkingPumpByCodeResp
+	(*GetWorkingValveByCodeResp)(nil),    // 22: pb.GetWorkingValveByCodeResp
+	(*GetWorkingChestByCodeResp)(nil),    // 23: pb.GetWorkingChestByCodeResp
 }
 var file_organization_proto_depIdxs = []int32{
 	8,  // 0: pb.MultiAddItemHistoryDataReq.list:type_name -> pb.ItemHistoryData
-	14, // 1: pb.ItemHistoryDataListResp.list:type_name -> pb.ItemHistoryDataList
+	15, // 1: pb.ItemHistoryDataListResp.list:type_name -> pb.ItemHistoryDataList
 	2,  // 2: pb.GetWorkingUfByCodeResp.list:type_name -> pb.WorkingUf
 	4,  // 3: pb.GetWorkingRoByCodeResp.list:type_name -> pb.WorkingRo
 	3,  // 4: pb.GetWorkingNfByCodeResp.list:type_name -> pb.WorkingNf
@@ -3502,17 +3571,19 @@ var file_organization_proto_depIdxs = []int32{
 	11, // 15: pb.Organization.ItemHistoryDataList:input_type -> pb.ItemHistoryDataListReq
 	12, // 16: pb.Organization.ItemHistoryDataByTime:input_type -> pb.ItemHistoryDataByTimeReq
 	12, // 17: pb.Organization.ItemHistoryDataMaxMinByTime:input_type -> pb.ItemHistoryDataByTimeReq
-	16, // 18: pb.Organization.GetWorkingUfByCode:output_type -> pb.GetWorkingUfByCodeResp
-	17, // 19: pb.Organization.GetWorkingRoByCode:output_type -> pb.GetWorkingRoByCodeResp
-	22, // 20: pb.Organization.GetWorkingChestByCode:output_type -> pb.GetWorkingChestByCodeResp
-	20, // 21: pb.Organization.GetWorkingPumpByCode:output_type -> pb.GetWorkingPumpByCodeResp
-	21, // 22: pb.Organization.GetWorkingValveByCode:output_type -> pb.GetWorkingValveByCodeResp
-	10, // 23: pb.Organization.MultiAddItemHistoryData:output_type -> pb.MultiAddItemHistoryDataResp
-	15, // 24: pb.Organization.ItemHistoryDataList:output_type -> pb.ItemHistoryDataListResp
-	15, // 25: pb.Organization.ItemHistoryDataByTime:output_type -> pb.ItemHistoryDataListResp
-	13, // 26: pb.Organization.ItemHistoryDataMaxMinByTime:output_type -> pb.ItemHistoryDataMaxMinResp
-	18, // [18:27] is the sub-list for method output_type
-	9,  // [9:18] is the sub-list for method input_type
+	12, // 18: pb.Organization.ItemHistoryDataFirstLastByTime:input_type -> pb.ItemHistoryDataByTimeReq
+	17, // 19: pb.Organization.GetWorkingUfByCode:output_type -> pb.GetWorkingUfByCodeResp
+	18, // 20: pb.Organization.GetWorkingRoByCode:output_type -> pb.GetWorkingRoByCodeResp
+	23, // 21: pb.Organization.GetWorkingChestByCode:output_type -> pb.GetWorkingChestByCodeResp
+	21, // 22: pb.Organization.GetWorkingPumpByCode:output_type -> pb.GetWorkingPumpByCodeResp
+	22, // 23: pb.Organization.GetWorkingValveByCode:output_type -> pb.GetWorkingValveByCodeResp
+	10, // 24: pb.Organization.MultiAddItemHistoryData:output_type -> pb.MultiAddItemHistoryDataResp
+	16, // 25: pb.Organization.ItemHistoryDataList:output_type -> pb.ItemHistoryDataListResp
+	16, // 26: pb.Organization.ItemHistoryDataByTime:output_type -> pb.ItemHistoryDataListResp
+	13, // 27: pb.Organization.ItemHistoryDataMaxMinByTime:output_type -> pb.ItemHistoryDataMaxMinResp
+	14, // 28: pb.Organization.ItemHistoryDataFirstLastByTime:output_type -> pb.ItemHistoryDataFirstLastResp
+	19, // [19:29] is the sub-list for method output_type
+	9,  // [9:19] is the sub-list for method input_type
 	9,  // [9:9] is the sub-list for extension type_name
 	9,  // [9:9] is the sub-list for extension extendee
 	0,  // [0:9] is the sub-list for field type_name
@@ -3693,7 +3764,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*ItemHistoryDataList); i {
+			switch v := v.(*ItemHistoryDataFirstLastResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3705,7 +3776,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*ItemHistoryDataListResp); i {
+			switch v := v.(*ItemHistoryDataList); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3717,7 +3788,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetWorkingUfByCodeResp); i {
+			switch v := v.(*ItemHistoryDataListResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3729,7 +3800,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetWorkingRoByCodeResp); i {
+			switch v := v.(*GetWorkingUfByCodeResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3741,7 +3812,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetWorkingNfByCodeResp); i {
+			switch v := v.(*GetWorkingRoByCodeResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3753,7 +3824,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetWorkingMfByCodeResp); i {
+			switch v := v.(*GetWorkingNfByCodeResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3765,7 +3836,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetWorkingPumpByCodeResp); i {
+			switch v := v.(*GetWorkingMfByCodeResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3777,7 +3848,7 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*GetWorkingValveByCodeResp); i {
+			switch v := v.(*GetWorkingPumpByCodeResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3789,6 +3860,18 @@ func file_organization_proto_init() {
 			}
 		}
 		file_organization_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*GetWorkingValveByCodeResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_organization_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*GetWorkingChestByCodeResp); i {
 			case 0:
 				return &v.state
@@ -3807,7 +3890,7 @@ func file_organization_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_organization_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   23,
+			NumMessages:   24,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 69 - 20
app/cmd/organization/pb/organization_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
-// - protoc-gen-go-grpc v1.2.0
-// - protoc             v4.23.4
+// - protoc-gen-go-grpc v1.3.0
+// - protoc             v3.21.12
 // source: organization.proto
 
 package pb
@@ -18,6 +18,19 @@ import (
 // Requires gRPC-Go v1.32.0 or later.
 const _ = grpc.SupportPackageIsVersion7
 
+const (
+	Organization_GetWorkingUfByCode_FullMethodName             = "/pb.Organization/GetWorkingUfByCode"
+	Organization_GetWorkingRoByCode_FullMethodName             = "/pb.Organization/GetWorkingRoByCode"
+	Organization_GetWorkingChestByCode_FullMethodName          = "/pb.Organization/GetWorkingChestByCode"
+	Organization_GetWorkingPumpByCode_FullMethodName           = "/pb.Organization/GetWorkingPumpByCode"
+	Organization_GetWorkingValveByCode_FullMethodName          = "/pb.Organization/GetWorkingValveByCode"
+	Organization_MultiAddItemHistoryData_FullMethodName        = "/pb.Organization/MultiAddItemHistoryData"
+	Organization_ItemHistoryDataList_FullMethodName            = "/pb.Organization/ItemHistoryDataList"
+	Organization_ItemHistoryDataByTime_FullMethodName          = "/pb.Organization/ItemHistoryDataByTime"
+	Organization_ItemHistoryDataMaxMinByTime_FullMethodName    = "/pb.Organization/ItemHistoryDataMaxMinByTime"
+	Organization_ItemHistoryDataFirstLastByTime_FullMethodName = "/pb.Organization/ItemHistoryDataFirstLastByTime"
+)
+
 // OrganizationClient is the client API for Organization service.
 //
 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@@ -31,6 +44,7 @@ type OrganizationClient interface {
 	ItemHistoryDataList(ctx context.Context, in *ItemHistoryDataListReq, opts ...grpc.CallOption) (*ItemHistoryDataListResp, error)
 	ItemHistoryDataByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataListResp, error)
 	ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error)
+	ItemHistoryDataFirstLastByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataFirstLastResp, error)
 }
 
 type organizationClient struct {
@@ -43,7 +57,7 @@ func NewOrganizationClient(cc grpc.ClientConnInterface) OrganizationClient {
 
 func (c *organizationClient) GetWorkingUfByCode(ctx context.Context, in *DcWorkingReq, opts ...grpc.CallOption) (*GetWorkingUfByCodeResp, error) {
 	out := new(GetWorkingUfByCodeResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/GetWorkingUfByCode", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_GetWorkingUfByCode_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -52,7 +66,7 @@ func (c *organizationClient) GetWorkingUfByCode(ctx context.Context, in *DcWorki
 
 func (c *organizationClient) GetWorkingRoByCode(ctx context.Context, in *DcWorkingReq, opts ...grpc.CallOption) (*GetWorkingRoByCodeResp, error) {
 	out := new(GetWorkingRoByCodeResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/GetWorkingRoByCode", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_GetWorkingRoByCode_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -61,7 +75,7 @@ func (c *organizationClient) GetWorkingRoByCode(ctx context.Context, in *DcWorki
 
 func (c *organizationClient) GetWorkingChestByCode(ctx context.Context, in *DcWorkingReq, opts ...grpc.CallOption) (*GetWorkingChestByCodeResp, error) {
 	out := new(GetWorkingChestByCodeResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/GetWorkingChestByCode", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_GetWorkingChestByCode_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -70,7 +84,7 @@ func (c *organizationClient) GetWorkingChestByCode(ctx context.Context, in *DcWo
 
 func (c *organizationClient) GetWorkingPumpByCode(ctx context.Context, in *DcWorkingReq, opts ...grpc.CallOption) (*GetWorkingPumpByCodeResp, error) {
 	out := new(GetWorkingPumpByCodeResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/GetWorkingPumpByCode", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_GetWorkingPumpByCode_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -79,7 +93,7 @@ func (c *organizationClient) GetWorkingPumpByCode(ctx context.Context, in *DcWor
 
 func (c *organizationClient) GetWorkingValveByCode(ctx context.Context, in *DcWorkingReq, opts ...grpc.CallOption) (*GetWorkingValveByCodeResp, error) {
 	out := new(GetWorkingValveByCodeResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/GetWorkingValveByCode", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_GetWorkingValveByCode_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -88,7 +102,7 @@ func (c *organizationClient) GetWorkingValveByCode(ctx context.Context, in *DcWo
 
 func (c *organizationClient) MultiAddItemHistoryData(ctx context.Context, in *MultiAddItemHistoryDataReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataResp, error) {
 	out := new(MultiAddItemHistoryDataResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/MultiAddItemHistoryData", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_MultiAddItemHistoryData_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -97,7 +111,7 @@ func (c *organizationClient) MultiAddItemHistoryData(ctx context.Context, in *Mu
 
 func (c *organizationClient) ItemHistoryDataList(ctx context.Context, in *ItemHistoryDataListReq, opts ...grpc.CallOption) (*ItemHistoryDataListResp, error) {
 	out := new(ItemHistoryDataListResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/ItemHistoryDataList", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_ItemHistoryDataList_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -106,7 +120,7 @@ func (c *organizationClient) ItemHistoryDataList(ctx context.Context, in *ItemHi
 
 func (c *organizationClient) ItemHistoryDataByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataListResp, error) {
 	out := new(ItemHistoryDataListResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/ItemHistoryDataByTime", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_ItemHistoryDataByTime_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -115,7 +129,16 @@ func (c *organizationClient) ItemHistoryDataByTime(ctx context.Context, in *Item
 
 func (c *organizationClient) ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error) {
 	out := new(ItemHistoryDataMaxMinResp)
-	err := c.cc.Invoke(ctx, "/pb.Organization/ItemHistoryDataMaxMinByTime", in, out, opts...)
+	err := c.cc.Invoke(ctx, Organization_ItemHistoryDataMaxMinByTime_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+func (c *organizationClient) ItemHistoryDataFirstLastByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataFirstLastResp, error) {
+	out := new(ItemHistoryDataFirstLastResp)
+	err := c.cc.Invoke(ctx, Organization_ItemHistoryDataFirstLastByTime_FullMethodName, in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -135,6 +158,7 @@ type OrganizationServer interface {
 	ItemHistoryDataList(context.Context, *ItemHistoryDataListReq) (*ItemHistoryDataListResp, error)
 	ItemHistoryDataByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataListResp, error)
 	ItemHistoryDataMaxMinByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataMaxMinResp, error)
+	ItemHistoryDataFirstLastByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataFirstLastResp, error)
 	mustEmbedUnimplementedOrganizationServer()
 }
 
@@ -169,6 +193,9 @@ func (UnimplementedOrganizationServer) ItemHistoryDataByTime(context.Context, *I
 func (UnimplementedOrganizationServer) ItemHistoryDataMaxMinByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataMaxMinResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ItemHistoryDataMaxMinByTime not implemented")
 }
+func (UnimplementedOrganizationServer) ItemHistoryDataFirstLastByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataFirstLastResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ItemHistoryDataFirstLastByTime not implemented")
+}
 func (UnimplementedOrganizationServer) mustEmbedUnimplementedOrganizationServer() {}
 
 // UnsafeOrganizationServer may be embedded to opt out of forward compatibility for this service.
@@ -192,7 +219,7 @@ func _Organization_GetWorkingUfByCode_Handler(srv interface{}, ctx context.Conte
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/GetWorkingUfByCode",
+		FullMethod: Organization_GetWorkingUfByCode_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).GetWorkingUfByCode(ctx, req.(*DcWorkingReq))
@@ -210,7 +237,7 @@ func _Organization_GetWorkingRoByCode_Handler(srv interface{}, ctx context.Conte
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/GetWorkingRoByCode",
+		FullMethod: Organization_GetWorkingRoByCode_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).GetWorkingRoByCode(ctx, req.(*DcWorkingReq))
@@ -228,7 +255,7 @@ func _Organization_GetWorkingChestByCode_Handler(srv interface{}, ctx context.Co
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/GetWorkingChestByCode",
+		FullMethod: Organization_GetWorkingChestByCode_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).GetWorkingChestByCode(ctx, req.(*DcWorkingReq))
@@ -246,7 +273,7 @@ func _Organization_GetWorkingPumpByCode_Handler(srv interface{}, ctx context.Con
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/GetWorkingPumpByCode",
+		FullMethod: Organization_GetWorkingPumpByCode_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).GetWorkingPumpByCode(ctx, req.(*DcWorkingReq))
@@ -264,7 +291,7 @@ func _Organization_GetWorkingValveByCode_Handler(srv interface{}, ctx context.Co
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/GetWorkingValveByCode",
+		FullMethod: Organization_GetWorkingValveByCode_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).GetWorkingValveByCode(ctx, req.(*DcWorkingReq))
@@ -282,7 +309,7 @@ func _Organization_MultiAddItemHistoryData_Handler(srv interface{}, ctx context.
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/MultiAddItemHistoryData",
+		FullMethod: Organization_MultiAddItemHistoryData_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).MultiAddItemHistoryData(ctx, req.(*MultiAddItemHistoryDataReq))
@@ -300,7 +327,7 @@ func _Organization_ItemHistoryDataList_Handler(srv interface{}, ctx context.Cont
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/ItemHistoryDataList",
+		FullMethod: Organization_ItemHistoryDataList_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).ItemHistoryDataList(ctx, req.(*ItemHistoryDataListReq))
@@ -318,7 +345,7 @@ func _Organization_ItemHistoryDataByTime_Handler(srv interface{}, ctx context.Co
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/ItemHistoryDataByTime",
+		FullMethod: Organization_ItemHistoryDataByTime_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).ItemHistoryDataByTime(ctx, req.(*ItemHistoryDataByTimeReq))
@@ -336,7 +363,7 @@ func _Organization_ItemHistoryDataMaxMinByTime_Handler(srv interface{}, ctx cont
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/pb.Organization/ItemHistoryDataMaxMinByTime",
+		FullMethod: Organization_ItemHistoryDataMaxMinByTime_FullMethodName,
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(OrganizationServer).ItemHistoryDataMaxMinByTime(ctx, req.(*ItemHistoryDataByTimeReq))
@@ -344,6 +371,24 @@ func _Organization_ItemHistoryDataMaxMinByTime_Handler(srv interface{}, ctx cont
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Organization_ItemHistoryDataFirstLastByTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ItemHistoryDataByTimeReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(OrganizationServer).ItemHistoryDataFirstLastByTime(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: Organization_ItemHistoryDataFirstLastByTime_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(OrganizationServer).ItemHistoryDataFirstLastByTime(ctx, req.(*ItemHistoryDataByTimeReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Organization_ServiceDesc is the grpc.ServiceDesc for Organization service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -387,6 +432,10 @@ var Organization_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ItemHistoryDataMaxMinByTime",
 			Handler:    _Organization_ItemHistoryDataMaxMinByTime_Handler,
 		},
+		{
+			MethodName: "ItemHistoryDataFirstLastByTime",
+			Handler:    _Organization_ItemHistoryDataFirstLastByTime_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "organization.proto",

+ 48 - 0
app/model/dcitemhistorydatamodel.go

@@ -21,6 +21,8 @@ type (
 		MultiInsert(ctx context.Context, projectId int64, datas []*pb.ItemHistoryData) (int64, error)
 		QueryHistoryDataByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) ([]*ItemHistoryData, error)
 		QueryHistoryDataMaxMinByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*MaxMinData, error)
+		QueryHistoryDataFirstByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*ItemHistoryData, error)
+		QueryHistoryDataLastByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*ItemHistoryData, error)
 	}
 
 	customDcItemHistoryDataModel struct {
@@ -118,6 +120,52 @@ func (m *defaultDcItemHistoryDataModel) QueryHistoryDataMaxMinByTime(ctx context
 	}
 }
 
+func (m *defaultDcItemHistoryDataModel) QueryHistoryDataFirstByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*ItemHistoryData, error) {
+	resp := &ItemHistoryData{}
+	var err error
+	query := fmt.Sprintf("SELECT hd.* FROM %s AS hd "+
+		" LEFT JOIN dc_item_config as ic ON hd.item_name = ic.item_name "+
+		" WHERE hd.item_name = ? AND h_time BETWEEN ? AND ? AND (ic.id IS NULL OR (hd.val > ic.min_val AND hd.val < ic.max_val))"+
+		" Order by h_time asc limit 1", m.getTableName(in.ProjectId))
+	err = m.conn.QueryRowCtx(ctx, resp, query, in.ItemName, in.Stime, in.Etime)
+
+	switch err {
+	case nil:
+		return resp, nil
+	case sqlc.ErrNotFound:
+		return nil, ErrNotFound
+	default:
+		return nil, err
+	}
+}
+
+func (m *defaultDcItemHistoryDataModel) QueryHistoryDataLastByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*ItemHistoryData, error) {
+	resp := &ItemHistoryData{}
+	var err error
+	if in.Stime != "" && in.Etime != "" {
+		query := fmt.Sprintf("SELECT hd.* FROM %s AS hd "+
+			" LEFT JOIN dc_item_config as ic ON hd.item_name = ic.item_name "+
+			" WHERE hd.item_name = ? AND h_time BETWEEN ? AND ? AND (ic.id IS NULL OR (hd.val > ic.min_val AND hd.val < ic.max_val))"+
+			" Order by h_time desc limit 1", m.getTableName(in.ProjectId))
+		err = m.conn.QueryRowCtx(ctx, resp, query, in.ItemName, in.Stime, in.Etime)
+	} else {
+		query := fmt.Sprintf("SELECT hd.* FROM %s AS hd "+
+			" LEFT JOIN dc_item_config as ic ON hd.item_name = ic.item_name "+
+			" WHERE hd.item_name = ? AND (ic.id IS NULL OR (hd.val > ic.min_val AND hd.val < ic.max_val))"+
+			" Order by h_time desc limit 1", m.getTableName(in.ProjectId))
+		err = m.conn.QueryRowCtx(ctx, resp, query, in.ItemName)
+	}
+
+	switch err {
+	case nil:
+		return resp, nil
+	case sqlc.ErrNotFound:
+		return nil, ErrNotFound
+	default:
+		return nil, err
+	}
+}
+
 func (m *defaultDcItemHistoryDataModel) getTableName(projectId int64) string {
 	return fmt.Sprintf("dc_item_history_data_%d", projectId)
 }