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)

 

posted @ 2020-09-15 11:37  小学弟-  阅读(132)  评论(0编辑  收藏  举报