Authored by hugufei

添加4张表的增量

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.CsRecommendBrandMapper;
import com.yoho.search.dal.model.CsRecommendBrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_brand")
public class CsRecommendBrandMqListener extends AbstractMqListener {
@Autowired
private CsRecommendBrandMapper csRecommendBrandMapper;
@Override
protected EventReportEnum getEventReportEnum() {
return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
}
@Override
protected void deleteData(String id) throws Exception {
csRecommendBrandMapper.deleteByPrimaryKey(Integer.valueOf(id));
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendBrand csRecommendBrand = ConvertUtils.toJavaObject(CsRecommendBrand.class, data);
if (csRecommendBrand == null || csRecommendBrand.getId() == null) {
return;
}
if (csRecommendBrandMapper.selectByPrimaryKey(csRecommendBrand.getId()) == null) {
csRecommendBrandMapper.insert(csRecommendBrand);
} else {
csRecommendBrandMapper.updateByPrimaryKey(csRecommendBrand);
}
}
}
... ...
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.CsRecommendConfigMapper;
import com.yoho.search.dal.model.CsRecommendConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_config")
public class CsRecommendConfigMqListener extends AbstractMqListener {
@Autowired
private CsRecommendConfigMapper csRecommendConfigMapper;
@Override
protected EventReportEnum getEventReportEnum() {
return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
}
@Override
protected void deleteData(String id) throws Exception {
csRecommendConfigMapper.deleteByPrimaryKey(Integer.valueOf(id));
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendConfig csRecommendConfig = ConvertUtils.toJavaObject(CsRecommendConfig.class, data);
if (csRecommendConfig == null || csRecommendConfig.getId() == null) {
return;
}
if (csRecommendConfigMapper.selectByPrimaryKey(csRecommendConfig.getId()) == null) {
csRecommendConfigMapper.insert(csRecommendConfig);
} else {
csRecommendConfigMapper.updateByPrimaryKey(csRecommendConfig);
}
}
}
... ...
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.CsRecommendSknPoolMapper;
import com.yoho.search.dal.model.CsRecommendSknPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_skn_pool")
public class CsRecommendSknPoolMqListener extends AbstractMqListener {
@Autowired
private CsRecommendSknPoolMapper csRecommendSknPoolMapper;
@Override
protected EventReportEnum getEventReportEnum() {
return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
}
@Override
protected void deleteData(String id) throws Exception {
csRecommendSknPoolMapper.deleteByPrimaryKey(Integer.valueOf(id));
}
@Override
protected void updateData(JSONObject data) throws Exception {
CsRecommendSknPool csRecommendSknPool = ConvertUtils.toJavaObject(CsRecommendSknPool.class, data);
if (csRecommendSknPool == null || csRecommendSknPool.getId() == null) {
return;
}
if (csRecommendSknPoolMapper.selectByPrimaryKey(csRecommendSknPool.getId()) == null) {
csRecommendSknPoolMapper.insert(csRecommendSknPool);
} else {
csRecommendSknPoolMapper.updateByPrimaryKey(csRecommendSknPool);
}
}
}
... ...
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);
}
}
}
... ...