|
|
@@ -1,34 +0,0 @@
|
|
|
-select t1.tenterprise_userid as userid,
|
|
|
- t1.fphonenumber,
|
|
|
- t1.faccountno,
|
|
|
- t1.siteid,
|
|
|
- t1.tagentsid,
|
|
|
- t3.fagentname,
|
|
|
- t3.fagentnum,
|
|
|
- t3.fagentname,
|
|
|
- t1.fusertype,
|
|
|
- t1.frole,
|
|
|
- t1.fname,
|
|
|
- t1.fisadministrator,
|
|
|
- t1.fissysadministrator,
|
|
|
- t5.fappmodel,
|
|
|
- case
|
|
|
- when t6.tpayinfoid IS null and ((t1.fusertype = '经销商' and t5.fagentamount > 0) or
|
|
|
- (t1.fusertype = '企业' and t5.FENTERPRISEUSERAMOUNT > 0)) then 1
|
|
|
- else 0 end as fisneedpay,
|
|
|
- case
|
|
|
- when t6.tpayinfoid IS null and t1.fusertype = '经销商' then t5.fagentamount
|
|
|
- when t6.tpayinfoid IS null and t1.fusertype = '企业' then t5.FENTERPRISEUSERAMOUNT
|
|
|
- else 0 end as fpayamount,
|
|
|
- t5.fagentoldamount,
|
|
|
- t2.floginmode,
|
|
|
- t2.tenterpriseid,
|
|
|
- t3.ftype as fagenttype
|
|
|
-from tenterprise_users t1
|
|
|
- inner join tenterprise t2 on t1.siteid = t2.siteid
|
|
|
- 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
|
|
|
- left join tpayinfo t6 on t1.siteid = t6.siteid and ((t1.fusertype = '经销商' and t1.tagentsid = t6.tagentsid) or
|
|
|
- (t1.fusertype = '企业' and t1.tenterprise_userid = t6.tenterprise_userid)) and
|
|
|
- t6.fbegdate <= GETDATE() and t6.fenddate >= GETDATE()
|
|
|
-where t1.faccountno =$faccountno$ and t2.floginmode in (2, 3)
|