baoyubo преди 2 месеца
родител
ревизия
1c10e5eae1
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      routers/api/comprehensive_search/__init__.py

+ 1 - 1
routers/api/comprehensive_search/__init__.py

@@ -25,7 +25,7 @@ router = APIRouter()
 #union all  (select `jhhk`.`video_code` AS `id`,`jhhk`.`name` AS `name`,Null AS `dataType`,`jhhk`.`area` AS `area`,`jhhk`.`longitude` AS `longitude`,`jhhk`.`latitude` AS `latitude`,NULL AS `address`,null as dict_label from (select `t1`.`name` AS `name`,(case when (`t1`.`area` like '%高州%') then '高州市' when (`t1`.`area` like '%信宜%') then '信宜市' when (`t1`.`area` like '%化州%') then '化州市' when (`t1`.`area` like '%茂南%') then '茂南区' when (`t1`.`area` like '%电白%') then '电白区' else '直辖市' end) AS `area`,`t2`.`longitude` AS `longitude`,`t2`.`latitude` AS `latitude`,`t1`.`status` AS `status`,`t1`.`video_code` AS `video_code` from ((select `tp_video_log`.`id` AS `id`,`tp_video_log`.`name` AS `name`,`tp_video_log`.`area` AS `area`,`tp_video_log`.`ip` AS `ip`,`tp_video_log`.`status` AS `status`,`tp_video_log`.`status_lifetime` AS `status_lifetime`,`tp_video_log`.`record_status` AS `record_status`,`tp_video_log`.`inspection_datetime` AS `inspection_datetime`,`tp_video_log`.`video_code_int` AS `video_code_int`,`tp_video_log`.`video_code` AS `video_code` from `tp_video_log` where (`tp_video_log`.`video_code` not in (SELECT id from point_data ))) `t1` left join `tp_video_base` `t2` on((`t1`.`video_code` = `t2`.`indexcode`)))) `jhhk` where  id like '%{keyword}%' or `name` like '%{keyword}%')A
 def get_add_data(keyword:str ,db :Session):
     sql = text("""SELECT * FROM point_data where dataType in (2,3,4,5,6,7,8,9,11,12,13,14,18,19,20,24,26,35,36,37,38,39) and ( address like '%{keyword}%' or `name` like '%{keyword}%')""".replace("{keyword}",keyword))
-    return [{"id":i.id,"name":i.name,"dataType":i.dataType,"area":i.area,"longitude":i.longitude,"latitude":i.latitude,"address":i.address} for i in db.execute(sql).all()]
+    return [{"id":i.id,"name":i.name,"dataType":i.dataType,"area":i.area,"longitude":i.longitude,"latitude":i.latitude,"address":i.address,"type":"2"} for i in db.execute(sql).all()]
 def get_video_data(keyword:str ,db :Session):
     sql = text("""SELECT T1.*,T2.dict_label FROM point_data T1 LEFT JOIN (SELECT * FROM `sys_dict_data` WHERE `dict_type`='point_type') T2 on T1.dataType=T2.dict_value where T1.dataType in (30,31,32,33,34) and ( T1.id like '%{keyword}%' or T1.`name` like '%{keyword}%') """.replace("{keyword}",keyword))
     result = []