Commit 7f64eec3 authored by 杨林's avatar 杨林

存储数据工具

parent c16251b3
package tools.es
import model.Item
import tools.base64.Base64Tools
import tools.json.Jackson
/**
* Created with IntelliJ IDEA.
* Class: SaveData
* Description:
* User: lin
* Date: 2021-06-04
* Time: 15:04
*/
object SaveData {
def saveToES(x: Item): String = {
// 判断ES是否重复
val item_id = x.item_id
val id = Base64Tools.encode("tb" + item_id)
val exists = ESUtils.getById(id).isExists
if (exists) {
"商品已存在"
}
// 存入ES
ESUtils.addOne(id, Jackson.parseBeanToString(x))
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment