#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/4/22 0022 下午 2:12
# @Author  : hj
# @File    : Image_status_dao.py
# @Software: PyCharm
from db.mod_db import DataBase


class Image_status_Dao:
    def __init__(self, db=None):
        if db is None:
            self.dataBase = DataBase()
        else:
            self.dataBase = db


    def select_sql_1(self,companyName):
        return self.dataBase.fetch_all("SELECT * from tj_reportUrl where companyname='%s'" % companyName)

    def select_sql_2(self,companyName):
        return self.dataBase.fetch_all("SELECT * from tj_lable_copy1_test_0316 where company_name='%s'" % companyName)

    def insertData(self,companyName,currdate,hx_status,report_status,report_url):
        return self.dataBase.insert_batch('insert into tj_task(companyName,submit_time,image_status,report_status,report_url) values("%s","%s","%s","%s","%s")'%(companyName,currdate,hx_status,report_status,report_url))

    def select_sql_3(self,companyName,num_start,pageSize):
        return self.dataBase.fetch_all('SELECT * from tj_task where companyName="%s" order by submit_time DESC,id DESC limit %s,%s' % (companyName,num_start,pageSize))

    def select_sql_4(self,companyName):
        return self.dataBase.fetch_all('SELECT COUNT(*) from tj_task WHERE companyName="%s"'% companyName)