Commit 480fe1b2 authored by 金凯强's avatar 金凯强 🎨

去空格

parent 09db477d
Pipeline #22226 failed with stage
in 11 seconds
...@@ -31,6 +31,8 @@ class ConnectionService(): ...@@ -31,6 +31,8 @@ class ConnectionService():
"db_password": "000", "mes_db_name": "HSGmtMes", "tiip_db_name": "HSTIIP"} "db_password": "000", "mes_db_name": "HSGmtMes", "tiip_db_name": "HSTIIP"}
:return: :return:
''' '''
CommonTools.validate_dict_value_all_not_none(json_data)
id = json_data.get('id') id = json_data.get('id')
project_no = json_data.get('project_no').strip() project_no = json_data.get('project_no').strip()
db_ip = json_data.get('db_ip') db_ip = json_data.get('db_ip')
...@@ -40,8 +42,6 @@ class ConnectionService(): ...@@ -40,8 +42,6 @@ class ConnectionService():
mes_db_name = json_data.get('mes_db_name').strip() mes_db_name = json_data.get('mes_db_name').strip()
host_ip = json_data.get('host_ip') host_ip = json_data.get('host_ip')
CommonTools.validate_dict_value_all_not_none(json_data)
# 验证数据库连接是否正确 # 验证数据库连接是否正确
if not CommonTools().test_db_connection(db_ip, db_port, db_user, db_password, mes_db_name): if not CommonTools().test_db_connection(db_ip, db_port, db_user, db_password, mes_db_name):
raise HSException('您填写的数据库信息未能连接上数据库,请检查') raise HSException('您填写的数据库信息未能连接上数据库,请检查')
...@@ -170,6 +170,11 @@ values ...@@ -170,6 +170,11 @@ values
server_user is None or server_password is None: server_user is None or server_password is None:
raise HSException('以上参数全部必填') raise HSException('以上参数全部必填')
project_no = project_no.strip()
server_ip = server_ip.strip()
server_user = server_user.strip()
server_password = server_password.strip()
with db_driver as session: with db_driver as session:
if id: if id:
validate_sql = f"select * from remote_server_info where project_no='{project_no}' and id<>'{id}' " validate_sql = f"select * from remote_server_info where project_no='{project_no}' and id<>'{id}' "
...@@ -202,7 +207,7 @@ values ...@@ -202,7 +207,7 @@ values
def set_remote_db_info(self, json_data): def set_remote_db_info(self, json_data):
''' '''
设置远程服务器数据库配置 设置远程服务器数据库配置
:param param: :param param:
:return: :return:
''' '''
...@@ -221,6 +226,13 @@ values ...@@ -221,6 +226,13 @@ values
db_user is None or db_password is None or mes_db_name is None or work_shop_no is None: db_user is None or db_password is None or mes_db_name is None or work_shop_no is None:
raise HSException('以上参数全部必填') raise HSException('以上参数全部必填')
project_no = project_no.strip()
work_shop_no = work_shop_no.strip()
db_ip = db_ip.strip()
db_user = db_user.strip()
db_password = db_password.strip()
mes_db_name = mes_db_name.strip()
with db_driver as session: with db_driver as session:
if id: if id:
validate_sql = f"select * from remote_server_db_info where project_no='{project_no}' and work_shop_no='{work_shop_no}' and id<>'{id}' " validate_sql = f"select * from remote_server_db_info where project_no='{project_no}' and work_shop_no='{work_shop_no}' and id<>'{id}' "
......
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