# -*- encoding=utf8 -*-


import pymysql

class delData(object):

    def Delete_branch_by_id(self):
        connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
                                     charset="utf8")
        cursor = connection.cursor()
        # 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
        # sql = "DELETE from mcms_branch_info where id = '%s';" % id
        sql="DELETE  from mcms_branch_info where  name  like '%东土城路院区_____';"
        print(sql)
        cursor.execute(sql)
        cursor.execute("commit;")
        print('院区数据已删除成功')
        cursor.close()

    def Delete_goods_change_info(self):
        connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
                                     charset="utf8")
        cursor = connection.cursor()
        # 删除产品信息修改数据
        sql = "DELETE from mcms_goods_chg_main where create_user='UID-050151';"
        print(sql)
        cursor.execute(sql)
        cursor.execute("commit;")
        print('产品调价和产品信息变更数据已删除成功')
        cursor.close()
    def Delete_sys_config(self):
        connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
                                     charset="utf8")
        cursor = connection.cursor()
        # 删除产品信息修改数据
        sql = "delete from sys_config  where  create_user = 'UID-050151';"
        print(sql)
        cursor.execute(sql)
        cursor.execute("commit;")
        print('院区参数信息已经删除成功 ')
        cursor.close()
    def Delete_sysrAtomDet(self):
        connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
                                     charset="utf8")
        cursor = connection.cursor()
        # 删除产品信息修改数据
        sql = "delete from sysr_atom_det where create_user='UID-050151';"
        print(sql)
        cursor.execute(sql)
        cursor.execute("commit;")
        print('院区参数信息已经删除成功 ')
        cursor.close()
    def Delete_sys_message_template(self):
        connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
                                     charset="utf8")
        cursor = connection.cursor()
        # 删除产品信息修改数据
        sql = " delete from sys_message_type where create_user='UID-050151' and template_type_name='test1';"
        print(sql)
        cursor.execute(sql)
        cursor.execute("commit;")
        print('消息通知模板类型已经删除成功 ')
        cursor.close()
# delData().Delete_branch_by_id()
# delData().Delete_goods_change_info()
# delData().Delete_sys_config()
# delData().Delete_sys_message_template()