# -*- encoding=utf8 -*-


import pymysql

class delByNoticeName(object):

    def delete_ByNoticeName(self):
        # connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
        #                              charset="utf8")
        # 内网切换数据库
        connection = pymysql.connect(host="10.17.65.49", port=30017, user="root", password="H-pV2d-1-N0z",
                                     database="spd3_herp_test2",
                                     charset="utf8")
        cursor = connection.cursor()
        # 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
        sql = "update sys_notice set del_flag=1 where title like '%公告发布测试%';"
        print(sql)
        cursor.execute(sql)
        cursor.execute("commit;")
        print('%s公告数据已逻辑删除成功')
        cursor.close()

# delByNoticeName().delete_ByNoticeName()
