# -*- coding: utf-8 -*- # @Author: Owl # @Date: 2025/10/10 16:17 # @Description: from app.db_func_base import * class CrossDbHelper(TableDbHelperBase): def __init__(self, pool): self.db_pool = pool self.DB_Name = 'ledger' def query_cross_usable_date_sql(self, crossid, nodeid): sql = f""" select distinct day from traffic_{nodeid}.cross_delay where crossid = '{crossid}' """ return self.do_select(sql) def query_cross_delay_info(self, crossid, nodeid, date_list, tp_start): date_list = ','.join(["'" + str(item) + "'" for item in date_list]) sql = f""" select * from traffic_{nodeid}.cross_delay where crossid = '{crossid}' and day in ({date_list}) and tp_start = '{tp_start}' order by day """ return self.do_select(sql) def query_cross_delay_whole_day_hours(self, crossid, nodeid, query_date): sql = f""" select * from traffic_{nodeid}.cross_delay where crossid = '{crossid}' and day = '{query_date}' and tp_start like 'h%' order by CAST(REGEXP_SUBSTR(tp_start, '[0-9]+') AS UNSIGNED) """ return self.do_select(sql) def query_cross_examine_records(self, start_hm, first_date, crossid, end_date): sql = """ select * from cross_doctor_matedata.cross_phase_problems_record where crossid = '%s' and start_hm = '%s' and first_date <= %s and (end_date >= '%s' or end_date is null) """ % (crossid, start_hm, first_date, end_date) return self.do_select(sql) def update_cross_examine_record_state_sql(self, crossid, first_date, start_hm, state): sql = """ update cross_doctor_matedata.cross_phase_problems_record set state = '%s' where crossid = '%s' and first_date = '%s' and start_hm = %s """ % (state, crossid, first_date, start_hm) return self.do_execute(sql)