def crud_search_result(date, user):
    conn = OperatorMysql()
    res = None
    if date is not None and user is not None:
        sql = " select task_name, sys_name, sys_module, sys_api, task_stat, status, response, result, " \
              "create_time, operator " \
          "from task_result " \
          "where is_delete=0 and date(create_time) = %s and operator=%s " \
          "order by create_time desc"
        res = conn.search(sql, (date, user))
    elif date is not None and user is None:
        sql = " select task_name, sys_name, sys_module, sys_api, task_stat, status, response, result, " \
              "create_time, operator " \
          "from task_result " \
          "where is_delete=0 and date(create_time)= %s " \
          "order by create_time desc"
        res = conn.search(sql, (date, ))
    elif date is None and user is not None:
        sql = " select task_name, sys_name, sys_module, sys_api, task_stat, status, response, result, " \
              "create_time, operator " \
              "from task_result " \
              "where is_delete=0 and operator=%s " \
              "order by create_time desc"
        res = conn.search(sql, (user, ))
    return res
def crud_task_result_page():
    conn = OperatorMysql()
    sql = " select task_name, sys_name, sys_module, sys_api, task_stat, status, response, result, " \
          "create_time, operator " \
          "from task_result " \
          "where is_delete=0 " \
          "order by create_time desc limit 100 "
    res = conn.search(sql)
    sql1 = "select name from user_control where is_active=1"
    res2 = conn.search(sql1)
    return res, res2
def crud_get_task_by_sys_total(id: int):
    conn = OperatorMysql()
    sql = "select count(sa.id) " \
          "from " \
          "(sys_name sn left join sys_module sm on sn.id = sm.sys_key) " \
          "left join sys_api sa on sa.module_key=sm.id " \
          "where sn.is_delete=0 and sm.is_delete=0 and sa.is_delete=0 and sn.id=%s "
    res = conn.search(sql, (id, ))
    return res
def crud_get_task_by_sys(id: int, page_num: int, page_size: int):
    conn = OperatorMysql()
    sql = "select sa.id, sn.name sys_name, sn.host, sa.path, sm.name mod_name, sa.name api_name, " \
          "sa.method, sa.variable, sa.headers, sa.params, sa.form_data " \
          "from " \
          "(sys_name sn left join sys_module sm on sn.id = sm.sys_key) " \
          "left join sys_api sa on sa.module_key=sm.id " \
          "where sn.is_delete=0 and sm.is_delete=0 and sa.is_delete=0 and sn.id=%s order by sa.id"
    res = conn.search(sql, (id, ))
    return res
Beispiel #5
0
def crud_return_set_case_total(query: int):
    conn = OperatorMysql()
    sql = "select " \
          "count(as.name) " \
          "from " \
          "(api_case `a` left join api_step `as` on `a`.id = `as`.api_case_key) " \
          "left join assert_data `ad` on `as`.id=`ad`.api_step_key where a.is_delete=0 and `as`.is_delete=0 " \
          "and ad.is_delete=0 and a.case_set_key=%s"
    res = conn.search(sql, (query, ))
    return res
Beispiel #6
0
def crud_return_set_case(query: int, page_num: int, page_size: int):
    conn = OperatorMysql()
    sql = "select " \
          "`a`.id case_id, `a`.name case_name, `a`.`desc` case_desc, `as`.step step_num , `as`.name step_name, " \
          " `as`.desc step_desc, `as`.set_up, `as`.tear_down, `as`.url, `as`.method, `as`.variable, `as`.headers, " \
          "`as`.params, `as`.form_data, `as`.json_data, `as`.need_assert, ad.assert_method, ad.exp_status, " \
          "ad.exp_extract " \
          "from " \
          "(api_case `a` left join api_step `as` on `a`.id = `as`.api_case_key) " \
          "left join assert_data `ad` on `as`.id=`ad`.api_step_key where a.is_delete=0 and `as`.is_delete=0 " \
          "and ad.is_delete=0 and a.case_set_key=%s order by a.id  limit %s, %s"
    res = conn.search(sql, (query, (page_num - 1) * page_size, page_size))
    return res
def crud_get_task_page():
    conn = OperatorMysql()
    sql = "select id, name from sys_name where is_delete=0"
    res = conn.search(sql)
    return res
def crud_get_module_by_sys(id: int):
    conn = OperatorMysql()
    sql2 = "select id, name from sys_module where is_delete=0 and sys_key=%s"
    mod_list = conn.search(sql2, (id, ))
    return mod_list
Beispiel #9
0
def crud_query_case_set():
    conn = OperatorMysql()
    sql = "select id, name from case_set where is_delete=0 "
    res = conn.search(sql)
    return res