|
|
package com.yoho.search.consumer.index.increment.yhb_operations;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.search.base.utils.ConvertUtils;
|
|
|
import com.yoho.search.base.utils.EventReportEnum;
|
|
|
import com.yoho.search.consumer.index.increment.AbstractMqListener;
|
|
|
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
|
|
|
import com.yoho.search.dal.CsRecommendSortPriceMapper;
|
|
|
import com.yoho.search.dal.model.CsRecommendSortPrice;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@Component
|
|
|
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_sort_price")
|
|
|
public class CsRecommendSortPriceMqListener extends AbstractMqListener {
|
|
|
|
|
|
@Autowired
|
|
|
private CsRecommendSortPriceMapper csRecommendSortPriceMapper;
|
|
|
|
|
|
@Override
|
|
|
protected EventReportEnum getEventReportEnum() {
|
|
|
return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void deleteData(String id) throws Exception {
|
|
|
csRecommendSortPriceMapper.deleteByPrimaryKey(Integer.valueOf(id));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void updateData(JSONObject data) throws Exception {
|
|
|
CsRecommendSortPrice csRecommendSortPrice = ConvertUtils.toJavaObject(CsRecommendSortPrice.class, data);
|
|
|
if (csRecommendSortPrice == null || csRecommendSortPrice.getId() == null) {
|
|
|
return;
|
|
|
}
|
|
|
if (csRecommendSortPriceMapper.selectByPrimaryKey(csRecommendSortPrice.getId()) == null) {
|
|
|
csRecommendSortPriceMapper.insert(csRecommendSortPrice);
|
|
|
} else {
|
|
|
csRecommendSortPriceMapper.updateByPrimaryKey(csRecommendSortPrice);
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|