|
@@ -11,26 +11,21 @@ select t1.tenterprise_userid
|
|
|
t1.fname,
|
|
t1.fname,
|
|
|
t1.fisadministrator,
|
|
t1.fisadministrator,
|
|
|
t1.fissysadministrator,
|
|
t1.fissysadministrator,
|
|
|
- case
|
|
|
|
|
- when t1.fusertype = '经销商' and t3.tagentsid IS not null and t3.fappmodel is not null then t3.fappmodel
|
|
|
|
|
- else t5.fappmodel end as fappmodel,
|
|
|
|
|
|
|
+ t5.fappmodel,
|
|
|
case
|
|
case
|
|
|
when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
|
|
when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
|
|
|
(t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then 1
|
|
(t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then 1
|
|
|
else 0 end as fisneedpay,
|
|
else 0 end as fisneedpay,
|
|
|
- case
|
|
|
|
|
- when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
|
|
|
|
|
- (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then '当前账号未激活'
|
|
|
|
|
- else '' end as fioserrmsg,
|
|
|
|
|
case
|
|
case
|
|
|
when t6.tpayinfoid IS null and t1.fusertype = '经销商' then t5.fagentamount
|
|
when t6.tpayinfoid IS null and t1.fusertype = '经销商' then t5.fagentamount
|
|
|
when t6.tpayinfoid IS null and t1.fusertype = '企业' then t5.FENTERPRISEUSERAMOUNT
|
|
when t6.tpayinfoid IS null and t1.fusertype = '企业' then t5.FENTERPRISEUSERAMOUNT
|
|
|
else 0 end as fpayamount,
|
|
else 0 end as fpayamount,
|
|
|
t5.fagentoldamount,
|
|
t5.fagentoldamount,
|
|
|
t2.floginmode,
|
|
t2.floginmode,
|
|
|
- t2.tenterpriseid
|
|
|
|
|
|
|
+ t2.tenterpriseid,
|
|
|
|
|
+ t3.ftype as fagenttype
|
|
|
from tenterprise_users t1
|
|
from tenterprise_users t1
|
|
|
- inner join tenterprise t2 on t1.siteid = t2.siteid and (fenddate is null or fenddate > getdate())
|
|
|
|
|
|
|
+ inner join tenterprise t2 on t1.siteid = t2.siteid
|
|
|
left join tagents t3 on t1.siteid = t3.siteid and t1.tagentsid = t3.tagentsid
|
|
left join tagents t3 on t1.siteid = t3.siteid and t1.tagentsid = t3.tagentsid
|
|
|
inner join tappmodelauth t5 on t1.siteid = t5.siteid and t5.fisdefault = 1
|
|
inner join tappmodelauth t5 on t1.siteid = t5.siteid and t5.fisdefault = 1
|
|
|
left join tpayinfo t6 on t1.siteid = t6.siteid and ((t1.fusertype = '经销商' and t1.tagentsid = t6.tagentsid) or
|
|
left join tpayinfo t6 on t1.siteid = t6.siteid and ((t1.fusertype = '经销商' and t1.tagentsid = t6.tagentsid) or
|