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. 机器人走方格-51nod解题

    M * N的方格,一个机器人从左上走到右下,只能向右或向下走. 有多少种不同的走法? 注意:给定 M, N 是一个正整数. 示例 输入: 1行, 2个数M,N,中间用空格隔开.(2 <= m,n ...

  2. 计算机网络-已知IP地址和子网掩码,求广播地址

    首先说结论--广播地址=该IP所在的下一跳-1 例题: 已知IP地址是192.72.20.111,子网掩码是255.255.255.224,求广播地址 要知道下一跳就需要先求出网段间隔,网段间隔=25 ...

  3. mysql is null 和 =null 区别

    数据库中 null 表示 不可知,不确定所以 判断都用 字段 is null的方式进行判断而 = null .<> null 的判断结果,仍然是不可知,不确定,所以 不会返回任何结果.或者 ...

  4. 【Set】Set集合求并集,交集,差集

    /** * @author: Sam.yang * @date: 2020/11/16 11:14 * @desc: Set集合操作工具类 */ public class SetOptUtils { ...

  5. 【MybatisPlus】使用Wrappers条件构造器构造or和and

    模糊查询中,会有针对一个数据,需要查询数据库的多个字段的情况,例如: 上图中的平台名称和平台进程在数据表中是两个不同的字段, 如果不使用Mybatisplus,仅使用Mybatis,则只有通过写xml ...

  6. hdu 1814 字典序最小的2sat(暴力深搜)

    题意:      题意就是最基础的2sat,关系只有矛盾关系,然后二选一,关键是这个题目是输出字典序最小的那组解. 思路:      输出字典序最小,用强连通那个实现不了(起码没看到有人实现),其实我 ...

  7. hdu1255 扫描线,矩形重叠面积(两次以上)

    题意:       给你n个矩形,然后问你这n个矩形所组成的画面中被覆盖至少两次的面积有多大. 思路:       和1542差距并不是很大,大体上还是离散化+线段树扫面线,不同的地方就是这个题目要求 ...

  8. .NET之默认依赖注入

    介绍 不要依赖于具体的实现,应该依赖于抽象,高层模块不应该依赖于底层模块,二者应该依赖于抽象.简单的说就是为了更好的解耦.而控制反转(Ioc)就是这样的原则的其中一个实现思路, 这个思路的其中一种实现 ...

  9. No input file specified.问题的解决

    问题描述:apache配置网站出现问题"No input file specified." 解决1: 打开.htaccess 在RewriteRule 后面的index.php教程 ...

  10. Windows进程间通讯(IPC)----套接字

    Windows套接字 Windows套接字即socket,通过socket可以实现在不同的进程间通信,甚至这两个进程可以不在同一个计算机中. Winsock使用步骤 服务端 socket初始化 创建套 ...