t.task_state=case when e1.executor_userid is null and t.task_state='1' then '0' when e1.executor_userid is not null and t.task_state='0' then '1' else t.task_state end,
t.task_state=case when e1.executor_userid is null and t.task_state='1' then '0' when e1.executor_userid is not null and t.task_state='0' then '1' else t.task_state end,
t.bid_step=
t.bid_step=
case when t.crowd='0' or t.crowd is null then t.bid_step
case when t.crowd='0' or t.crowd is null then t.bid_step
when t.crowd='1' and (t.estate in( '0','4') or t.estate is null) and e1.executor_userid is not null and (t.bid_step is null or t.bid_step in('0','1','2','3')) then '4'
when t.crowd='1' and t.estate ='2' and e1.executor_userid is not null and (t.bid_step is null or t.bid_step in('0','1','2','3','4')) then '5'
when t.crowd='1' and (t.estate in( '0','4') or t.estate is null or (t.estate in ('2','3') and t.efunds <e1.quote_amount)) and e1.executor_userid is not null and (t.bid_step is null or t.bid_step in('0','1','2','3')) then '4'
when t.crowd='1' and t.estate ='2' and t.efunds >=e1.quote_amount and e1.executor_userid is not null and (t.bid_step is null or t.bid_step in('0','1','2','3','4')) then '5'
when t.crowd='1' and e1.executor_userid is null and t.task_state in('0') then '2'
when t.crowd='1' and e1.executor_userid is null and t.task_state in('0') then '2'