You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
749 B
26 lines
749 B
from entity.KeyWordEntity import Keyword
|
|
from common.Utils import getSession
|
|
from sqlalchemy import update
|
|
|
|
|
|
class KeyWordService:
|
|
|
|
def insertOne(region, word):
|
|
session = getSession()
|
|
keyWord: Keyword = Keyword(region=region, word=word)
|
|
session.add(keyWord)
|
|
session.commit()
|
|
session.close()
|
|
|
|
def queryOneByRegionWord(region, word):
|
|
session = getSession()
|
|
keyWord: Keyword = session.query(Keyword).filter(
|
|
Keyword.region == region, Keyword.word == word).one_or_none()
|
|
session.close()
|
|
return keyWord
|
|
|
|
def insterKeyWords(keyWords):
|
|
session = getSession()
|
|
session.bulk_save_objects(keyWords)
|
|
session.commit()
|
|
session.close()
|
|
|