with LogMysqlApeT(db) as m_client:
condition = "select * from {} where deleted=0 ".format(table)
condition_count = "select count(id) as numbers from {} where deleted=0 ".format(table)
get_data = json.loads(request.body)
industry = get_data.get("industry", '') # 行业
industry2 = get_data.get("industry2", '') # 行业
viewpoint = get_data.get("viewpoint", '') # 观点
viewpointtitle = get_data.get("viewpointtitle", '') # 观点标题
property = get_data.get("property", '') # 属性
contentname = get_data.get("contentname", '') # 母模板名称
parenttitleid = get_data.get("parenttitleid", '') # 观点标题id
pageStartNumber = get_data.get('page', 1)
pageNumber = get_data.get('pageSize', 100)
if industry:
condition += " and industry='{}' ".format(industry)
condition_count += " and industry='{}' ".format(industry)
if industry2:
condition += " and industry2='{}' ".format(industry2)
condition_count += " and industry2='{}' ".format(industry2)
if viewpoint:
condition += " and viewpoint='{}' ".format(viewpoint)
condition_count += " and viewpoint='{}' ".format(viewpoint)
if property:
condition += " and property='{}' ".format(property)
condition_count += " and property='{}' ".format(property)
if viewpointtitle:
condition += " and viewpointtitle = '{}' ".format(viewpointtitle)
condition_count += " and viewpointtitle = '{}' ".format(viewpointtitle)
if contentname:
condition += " and contentname like '%%{}%%' ".format(contentname)
condition_count += " and contentname like '%%{}%%' ".format(contentname)
if parenttitleid:
condition += " and parenttitleid ={} ".format(parenttitleid)
condition_count += " and parenttitleid ={} ".format(parenttitleid)
condition_limit = condition + " limit {},{} ".format((pageStartNumber - 1) * pageNumber, pageNumber)
total = m_client.search_db(condition_count)[0].get('numbers', 0)
logger.info('@@@ 观点标题详情:%s' % condition)
data = m_client.search_db(condition_limit)

LogMysqlApeT的更多相关文章

随机推荐

  1. 【Spring】循环依赖

    @ 目录 循环依赖 是什么? Spring是如何解决的? 源码分析 细节 循环依赖 是什么? ​ 简单的来说就是对象a的属性中引用了对象b,对象b的属性中引用了对象c......最后引用到a. < ...

  2. kubernetes 的API 介绍

    在API conventions doc中描述了API的全部协议. 在API Reference文档中描述了API的端点.资源类型和示例. 在Controlling API Access doc中讨论 ...

  3. 1040 Longest Symmetric String

    Given a string, you are supposed to output the length of the longest symmetric sub-string. For examp ...

  4. 【目录】python全栈工程师

    第一阶段:Python 语言核心编程1. Python核心   -- 2048 游戏核心算法2. 面向对象   -- 天龙八部游戏技能系统3. Python高级   -- 集成操作框架项目:2048游 ...

  5. python 自动化审计

    基于python的自动化代码审计 代码审计 逢魔安全实验室   2018-02-11  10,539   本文通过介绍在python开发中经常出现的常规web漏洞,然后通过静态和动态两种方式对pyth ...

  6. POJ1719行列匹配

    题意:      给一个n*m的格子,每一列都有两个白色的,其余的全是黑色的,然后要选择m个格子,要求是每一列必须也只能选一个,而每一行至少选择一个,输出一种可行的方案没,输出的格式是输出m个数,表示 ...

  7. CVE-2012-3569:VMware OVF Tool 格式化字符串漏洞调试分析

    0x01 简介 VMware OVF Tool 是一个命令行实用程序,允许您从许多 VMware 产品导入和导出 OVF 包.在 2.1.0 - 2.1.3 之间的版本中存在格式化字符串漏洞,通过修改 ...

  8. 正则表达式:(mysql)REGEXP

    检索列prod_name包含文本1000的所以行 SELECT prod_name FROM  products WHERE prod_name REGEXP '1000' ORDER BY prod ...

  9. React中diff算法的理解

    React中diff算法的理解 diff算法用来计算出Virtual DOM中改变的部分,然后针对该部分进行DOM操作,而不用重新渲染整个页面,渲染整个DOM结构的过程中开销是很大的,需要浏览器对DO ...

  10. SE_Work4_软件案例分析

    项目 内容 课程:北航-2020-春-软件工程 博客园班级博客 要求:分析软件案例 个人博客作业-软件案例分析 班级 005 这个作业在哪个具体方面帮助我实现目标 分析对比一类软件,学会规划分析软件的 ...