Commit 13604582 authored by pengxiong's avatar pengxiong

查询客户列表

parent dab0de34
...@@ -368,3 +368,53 @@ class UserHoldFundFromApp(Base, BaseModel): ...@@ -368,3 +368,53 @@ class UserHoldFundFromApp(Base, BaseModel):
folio_name = Column(String(64), comment='组合名称,默认是default') folio_name = Column(String(64), comment='组合名称,默认是default')
confirm_share_date = Column(Date, comment='确认份额日期') confirm_share_date = Column(Date, comment='确认份额日期')
pay_date = Column(Date, comment='订单支付时间') pay_date = Column(Date, comment='订单支付时间')
class IfaCustomerView(Base, BaseModel):
__tablename__ = 'ifa_customer_view'
id = Column(String(64))
customer_id = Column(String(64))
ifa_id = Column(String(64))
fund_count = Column(INTEGER(11))
revision = Column(INTEGER(11))
delete_tag = Column(INTEGER(11))
comefrom = Column(String(5))
class CustomerView(Base, BaseModel):
__tablename__ = 'customer_view'
id = Column(String(64))
customer_name = Column(String(128))
delete_tag = Column(INTEGER(11))
valueSex = Column(INTEGER(11))
valueBirth = Column(DateTime)
phone = Column(String(20))
email = Column(String(120))
landline = Column(String(20))
address = Column(String(120))
fax = Column(String(20))
qq = Column(String(20))
wechat = Column(String(30))
wechatNickName = Column(String(30))
weibo = Column(String(30))
work = Column(String(50))
staff = Column(String(50))
school = Column(String(50))
nativeplace = Column(String(30))
valueMarry = Column(INTEGER(11))
familyList = Column(String(500))
favor = Column(String(100))
concatTime = Column(String(30))
wealth = Column(String(30))
extra = Column(String(120))
remark = Column(Text)
group_id = Column(INTEGER(11))
company_address = Column(String(200))
other_address = Column(String(200))
member_since = Column(DateTime)
last_seen = Column(DateTime)
total_assets = Column(DECIMAL(22, 6))
floating_earnings = Column(DECIMAL(22, 6))
comefrom = Column(String(5))
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
from sqlalchemy import and_ from sqlalchemy import and_
from app.api.engine import TAMP_SQL, tamp_diagnose_app_engine from app.api.engine import TAMP_SQL, tamp_diagnose_app_engine
from app.model.tamp_diagnose_app import Customer, IfaCustomer from app.model.tamp_diagnose_app import Customer, IfaCustomer, IfaCustomerView, CustomerView
def get_customer_list(args): def get_customer_list(args):
...@@ -22,18 +22,18 @@ def get_customer_list(args): ...@@ -22,18 +22,18 @@ def get_customer_list(args):
with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app: with TAMP_SQL(tamp_diagnose_app_engine) as tamp_diagnose_app:
tamp_diagnose_session = tamp_diagnose_app.session tamp_diagnose_session = tamp_diagnose_app.session
customer_id_list = tamp_diagnose_session.query(IfaCustomer.customer_id).filter(and_( customer_id_list = tamp_diagnose_session.query(IfaCustomerView.customer_id).filter(and_(
IfaCustomer.ifa_id == ifa_id, IfaCustomerView.ifa_id == ifa_id,
IfaCustomer.delete_tag == 0, IfaCustomerView.delete_tag == 0,
)).all() )).all()
customer_id_list = [r[0] for r in customer_id_list] customer_id_list = [r[0] for r in customer_id_list]
conditions = [ conditions = [
Customer.id.in_(customer_id_list), CustomerView.id.in_(customer_id_list),
Customer.delete_tag == 0, CustomerView.delete_tag == 0,
] ]
if name: if name:
conditions.append(Customer.customer_name.like('%' + name + '%')) conditions.append(CustomerView.customer_name.like('%' + name + '%'))
customer_list = tamp_diagnose_session.query(Customer).filter(and_( customer_list = tamp_diagnose_session.query(CustomerView).filter(and_(
*conditions *conditions
)).all() )).all()
allow_field = ['id', 'customer_name', 'valueSex', 'phone'] allow_field = ['id', 'customer_name', 'valueSex', 'phone']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment