Commit 1d2f31d5 by Aeolus

update

parent 21635be2
...@@ -45,17 +45,14 @@ def run_hatch_list(): ...@@ -45,17 +45,14 @@ def run_hatch_list():
""" """
count_sql = "select count(hatch.id) as total_count" count_sql = "select count(hatch.id) as total_count"
from_sql = """ from hatch from_sql = """ from hatch
where hatch.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1) """
""".format(user_id=admin.id)
if g.user.level == 1: if g.user.level == 1:
where_sql = " where 0=0" where_sql = " where 0=0"
else: else:
where_sql = """ where p.id in ( select production_type_id from admin_production_type where where_sql = """ where hatch.machine_no in ( select machine_no from admin_machine where
admin_production_type.user_id = {} and admin_production_type.status = 1 admin_machine.user_id = {user_id} and admin_machine.status = 1)
) """.format(user_id=admin.id)
)""".format(admin.id)
where_sql = " "
if keyword: if keyword:
where_sql += """ where_sql += """
and CONCAT(hatch.machine_no,ifnull(hatch.brand_name,''), ifnull(hatch.production_type_name,''), and CONCAT(hatch.machine_no,ifnull(hatch.brand_name,''), ifnull(hatch.production_type_name,''),
......
...@@ -416,7 +416,7 @@ def run_production_type_list(): ...@@ -416,7 +416,7 @@ def run_production_type_list():
where_sql = """ where p.id in ( select production_type_id from admin_production_type where where_sql = """ where p.id in ( select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1 admin_production_type.user_id = {} and admin_production_type.status = 1
) )
)""".format(admin.id) """.format(admin.id)
if keyword: if keyword:
where_sql += """ where_sql += """
and CONCAT( p.production_type_name) LIKE '%{keyword}%' and CONCAT( p.production_type_name) LIKE '%{keyword}%'
...@@ -510,7 +510,7 @@ def get_production_type_detail(): ...@@ -510,7 +510,7 @@ def get_production_type_detail():
where_sql = """ where p.id in ( select production_type_id from admin_production_type where where_sql = """ where p.id in ( select production_type_id from admin_production_type where
admin_production_type.user_id = {} and admin_production_type.status = 1 admin_production_type.user_id = {} and admin_production_type.status = 1
) )
)""".format(admin.id) """.format(admin.id)
where_sql += " and b.id ={}".format(production_type_id) where_sql += " and b.id ={}".format(production_type_id)
result = db.session.execute(select_sql + from_sql + where_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql).fetchall()
......
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