zoukankan      html  css  js  c++  java
  • LogMysqlApeT

                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)
  • 相关阅读:
    Spring 整合Hibernate与Struts2
    Spring @注解详解(转)
    Spring 事务
    Spring c3p0支持Hibernate配置
    Spring c3p0连接池配置
    Spring dbcp连接池配置与示例(以及JDBCTemplate的使用)
    struts转换器详解
    struts拦截器详解
    struts拦截器的使用
    OGNL表达式详解
  • 原文地址:https://www.cnblogs.com/xiao-xue-di/p/13672215.html
Copyright © 2011-2022 走看看