Skip to content

Commit 8dc511c

Browse files
author
ljl
committed
Merge remote-tracking branch 'origin/main'
2 parents 74ad157 + 1ba3cb2 commit 8dc511c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

middleware/flow/src/dto/flow_inst_dto.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ pub struct FlowInstDetailResp {
8585
pub rel_business_obj_id: String,
8686

8787
pub current_state_id: String,
88-
pub current_assigned: Option<String>,
89-
9088
pub current_state_name: Option<String>,
89+
pub current_state_color: Option<String>,
90+
91+
pub current_assigned: Option<String>,
9192
pub current_vars: Option<HashMap<String, Value>>,
9293

9394
pub create_vars: Option<HashMap<String, Value>>,

middleware/flow/src/serv/flow_inst_serv.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,10 @@ impl FlowInstServ {
306306
pub rel_flow_model_name: String,
307307

308308
pub current_state_id: String,
309-
pub current_assigned: Option<String>,
310-
311309
pub current_state_name: Option<String>,
310+
pub current_state_color: Option<String>,
311+
312+
pub current_assigned: Option<String>,
312313
pub current_vars: Option<Value>,
313314

314315
pub create_vars: Option<Value>,
@@ -327,6 +328,7 @@ impl FlowInstServ {
327328
pub rel_business_obj_id: String,
328329
}
329330
let rel_state_table = Alias::new("rel_state");
331+
let flow_state_table = Alias::new("flow_state");
330332
let rel_model_table = Alias::new("rel_model");
331333
let mut query = Query::select();
332334
query
@@ -348,6 +350,7 @@ impl FlowInstServ {
348350
(flow_inst::Entity, flow_inst::Column::CurrentAssigned),
349351
])
350352
.expr_as(Expr::col((rel_state_table.clone(), NAME_FIELD.clone())).if_null(""), Alias::new("current_state_name"))
353+
.expr_as(Expr::col((flow_state_table.clone(), Alias::new("color"))).if_null(""), Alias::new("current_state_color"))
351354
.expr_as(Expr::col((rel_model_table.clone(), NAME_FIELD.clone())).if_null(""), Alias::new("rel_flow_model_name"))
352355
.from(flow_inst::Entity)
353356
.join_as(
@@ -359,6 +362,12 @@ impl FlowInstServ {
359362
.add(Expr::col((rel_state_table.clone(), REL_KIND_ID_FIELD.clone())).eq(FlowStateServ::get_rbum_kind_id().unwrap()))
360363
.add(Expr::col((rel_state_table.clone(), REL_DOMAIN_ID_FIELD.clone())).eq(FlowStateServ::get_rbum_domain_id().unwrap())),
361364
)
365+
.join_as(
366+
JoinType::LeftJoin,
367+
Alias::new("flow_state"),
368+
flow_state_table.clone(),
369+
Expr::col((flow_state_table.clone(), ID_FIELD.clone())).equals((flow_inst::Entity, flow_inst::Column::CurrentStateId)),
370+
)
362371
.join_as(
363372
JoinType::LeftJoin,
364373
RBUM_ITEM_TABLE.clone(),
@@ -388,8 +397,9 @@ impl FlowInstServ {
388397
own_paths: inst.own_paths,
389398
transitions: inst.transitions.map(|transitions| TardisFuns::json.json_to_obj(transitions).unwrap()),
390399
current_state_id: inst.current_state_id,
391-
current_assigned: inst.current_assigned,
392400
current_state_name: inst.current_state_name,
401+
current_state_color:inst.current_state_color,
402+
current_assigned: inst.current_assigned,
393403
current_vars: inst.current_vars.map(|current_vars| TardisFuns::json.json_to_obj(current_vars).unwrap()),
394404
rel_business_obj_id: inst.rel_business_obj_id,
395405
})
@@ -1224,7 +1234,7 @@ impl FlowInstServ {
12241234
.from(flow_inst::Entity)
12251235
.and_where(Expr::col((flow_inst::Entity, flow_inst::Column::CurrentStateId)).eq(flow_state_id))
12261236
.and_where(Expr::col((flow_inst::Entity, flow_inst::Column::RelFlowModelId)).eq(flow_model_id))
1227-
.and_where(Expr::col((flow_inst::Entity, flow_inst::Column::FinishAbort)).eq(false)),
1237+
.and_where(Expr::col((flow_inst::Entity, flow_inst::Column::FinishAbort)).ne(true)),
12281238
)
12291239
.await?
12301240
!= 0

0 commit comments

Comments
 (0)