示例#1
0
	def getAll(self):
		try:
			self.cursor_stg.execute("select taxid,title,origin_id,provider_id,isEnglish from tax where isEnglish='Y' and display=1 and duplicate_flag=0")
			for row in self.cursor_stg.fetchall():
				law=Law()
				law.id=row[0]
				law.title=row[1]
				law.originId=row[2]
				law.providerId=row[3]
				law.isEnglish=row[4]
				yield law
		except Exception,e:
			self.log.error(e)
示例#2
0
	def getLawByKeywordId(self,keywordId):
		if keywordId:
			try:
				self.cursor_hyperlink.execute("SELECT origin_id,provider_id,isEnglish,target_id,action_type FROM article_en WHERE keyword_id=%s AND content_type='T' ORDER BY provider_id asc;" % keywordId)
				articleList=[]
				for row in self.cursor_hyperlink.fetchall():
					article=Law()
					article.originId=row[0]
					article.providerId=row[1]
					article.isEnglish=row[2]
					article.targetId=row[3]
					article.id=row[3]
					article.actionType=row[4]
					articleList.append(article)
				return articleList
			except Exception,e:
				self.log.error(e)
示例#3
0
	def getById(self,id):
		if id:
			try:
				
				self.cursor_stg.execute("SELECT tax.taxid as id,tax.title,tax_content.content,tax.origin_id,tax.provider_id,tax.isEnglish,tax.date,tax.effect_date FROM tax LEFT JOIN tax_content ON tax.taxid=tax_content.taxid WHERE tax.taxid=%s;" % id)
				row=self.cursor_stg.fetchone()
				if row:
					article=Law()	
					article.id=row[0]
					article.title=row[1]
					article.content=row[2]
					article.originId=row[3]
					article.providerId=row[4]
					article.isEnglish=row[5]
					article.proDate=row[6]
					article.effectDate=row[7]
					return article
				else:
					raise Exception("No law with id %s found!" %id)
			except Exception,e:
				self.log.error(e)	
示例#4
0
	def getByOrigin(self,originId,providerId,isEnglish):
		"""
		根据originId,providerId,isEnglish获取法规
		"""
		try:
			self.cursor_stg.execute("SELECT tax.taxid as id,tax.title,tax_content.content,tax.origin_id,tax.provider_id,tax.isEnglish,tax.date,tax.effect_date FROM tax LEFT JOIN tax_content ON tax.taxid=tax_content.taxid WHERE tax.origin_id='%s' and tax.provider_id=%s and tax.isEnglish='%s' and display=1;" % (originId,providerId,isEnglish))
			row=self.cursor_stg.fetchone()
			if row:
				article=Law()	
				article.id=row[0]
				article.title=row[1]
				article.content=row[2]
				article.originId=row[3]
				article.providerId=row[4]
				article.isEnglish=row[5]
				article.proDate=row[6]
				article.effectDate=row[7]
				return article
			else:
				raise Exception("No law with origin_id:%s,provider_id:%s,isEnglish:%s found!" %(originId,providerId,isEnglish))
		except Exception,e:
			self.log.error(e)