Authored by hugufei

添加4张表的增量

  1 +package com.yoho.search.consumer.index.increment.yhb_operations;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yoho.search.base.utils.ConvertUtils;
  5 +import com.yoho.search.base.utils.EventReportEnum;
  6 +import com.yoho.search.consumer.index.increment.AbstractMqListener;
  7 +import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
  8 +import com.yoho.search.dal.CsRecommendBrandMapper;
  9 +import com.yoho.search.dal.model.CsRecommendBrand;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +@Component
  14 +@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_brand")
  15 +public class CsRecommendBrandMqListener extends AbstractMqListener {
  16 +
  17 + @Autowired
  18 + private CsRecommendBrandMapper csRecommendBrandMapper;
  19 +
  20 + @Override
  21 + protected EventReportEnum getEventReportEnum() {
  22 + return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
  23 + }
  24 +
  25 + @Override
  26 + protected void deleteData(String id) throws Exception {
  27 + csRecommendBrandMapper.deleteByPrimaryKey(Integer.valueOf(id));
  28 + }
  29 +
  30 + @Override
  31 + protected void updateData(JSONObject data) throws Exception {
  32 + CsRecommendBrand csRecommendBrand = ConvertUtils.toJavaObject(CsRecommendBrand.class, data);
  33 + if (csRecommendBrand == null || csRecommendBrand.getId() == null) {
  34 + return;
  35 + }
  36 + if (csRecommendBrandMapper.selectByPrimaryKey(csRecommendBrand.getId()) == null) {
  37 + csRecommendBrandMapper.insert(csRecommendBrand);
  38 + } else {
  39 + csRecommendBrandMapper.updateByPrimaryKey(csRecommendBrand);
  40 + }
  41 + }
  42 +}
  1 +package com.yoho.search.consumer.index.increment.yhb_operations;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yoho.search.base.utils.ConvertUtils;
  5 +import com.yoho.search.base.utils.EventReportEnum;
  6 +import com.yoho.search.consumer.index.increment.AbstractMqListener;
  7 +import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
  8 +import com.yoho.search.dal.CsRecommendConfigMapper;
  9 +import com.yoho.search.dal.model.CsRecommendConfig;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +@Component
  14 +@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_config")
  15 +public class CsRecommendConfigMqListener extends AbstractMqListener {
  16 +
  17 + @Autowired
  18 + private CsRecommendConfigMapper csRecommendConfigMapper;
  19 +
  20 + @Override
  21 + protected EventReportEnum getEventReportEnum() {
  22 + return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
  23 + }
  24 +
  25 + @Override
  26 + protected void deleteData(String id) throws Exception {
  27 + csRecommendConfigMapper.deleteByPrimaryKey(Integer.valueOf(id));
  28 + }
  29 +
  30 + @Override
  31 + protected void updateData(JSONObject data) throws Exception {
  32 + CsRecommendConfig csRecommendConfig = ConvertUtils.toJavaObject(CsRecommendConfig.class, data);
  33 + if (csRecommendConfig == null || csRecommendConfig.getId() == null) {
  34 + return;
  35 + }
  36 + if (csRecommendConfigMapper.selectByPrimaryKey(csRecommendConfig.getId()) == null) {
  37 + csRecommendConfigMapper.insert(csRecommendConfig);
  38 + } else {
  39 + csRecommendConfigMapper.updateByPrimaryKey(csRecommendConfig);
  40 + }
  41 + }
  42 +}
  1 +package com.yoho.search.consumer.index.increment.yhb_operations;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yoho.search.base.utils.ConvertUtils;
  5 +import com.yoho.search.base.utils.EventReportEnum;
  6 +import com.yoho.search.consumer.index.increment.AbstractMqListener;
  7 +import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
  8 +import com.yoho.search.dal.CsRecommendSknPoolMapper;
  9 +import com.yoho.search.dal.model.CsRecommendSknPool;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +@Component
  14 +@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_skn_pool")
  15 +public class CsRecommendSknPoolMqListener extends AbstractMqListener {
  16 +
  17 + @Autowired
  18 + private CsRecommendSknPoolMapper csRecommendSknPoolMapper;
  19 +
  20 + @Override
  21 + protected EventReportEnum getEventReportEnum() {
  22 + return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
  23 + }
  24 +
  25 + @Override
  26 + protected void deleteData(String id) throws Exception {
  27 + csRecommendSknPoolMapper.deleteByPrimaryKey(Integer.valueOf(id));
  28 + }
  29 +
  30 + @Override
  31 + protected void updateData(JSONObject data) throws Exception {
  32 + CsRecommendSknPool csRecommendSknPool = ConvertUtils.toJavaObject(CsRecommendSknPool.class, data);
  33 + if (csRecommendSknPool == null || csRecommendSknPool.getId() == null) {
  34 + return;
  35 + }
  36 + if (csRecommendSknPoolMapper.selectByPrimaryKey(csRecommendSknPool.getId()) == null) {
  37 + csRecommendSknPoolMapper.insert(csRecommendSknPool);
  38 + } else {
  39 + csRecommendSknPoolMapper.updateByPrimaryKey(csRecommendSknPool);
  40 + }
  41 + }
  42 +}
  1 +package com.yoho.search.consumer.index.increment.yhb_operations;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.yoho.search.base.utils.ConvertUtils;
  5 +import com.yoho.search.base.utils.EventReportEnum;
  6 +import com.yoho.search.consumer.index.increment.AbstractMqListener;
  7 +import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
  8 +import com.yoho.search.dal.CsRecommendSortPriceMapper;
  9 +import com.yoho.search.dal.model.CsRecommendSortPrice;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
  12 +
  13 +@Component
  14 +@SearchMqConsumerListerner(dbName = "yhb_operations", tableName = "cs_recommend_sort_price")
  15 +public class CsRecommendSortPriceMqListener extends AbstractMqListener {
  16 +
  17 + @Autowired
  18 + private CsRecommendSortPriceMapper csRecommendSortPriceMapper;
  19 +
  20 + @Override
  21 + protected EventReportEnum getEventReportEnum() {
  22 + return EventReportEnum.CSRECALLCONFIGCOMMONMQLISTENER_ONMESSAGE;
  23 + }
  24 +
  25 + @Override
  26 + protected void deleteData(String id) throws Exception {
  27 + csRecommendSortPriceMapper.deleteByPrimaryKey(Integer.valueOf(id));
  28 + }
  29 +
  30 + @Override
  31 + protected void updateData(JSONObject data) throws Exception {
  32 + CsRecommendSortPrice csRecommendSortPrice = ConvertUtils.toJavaObject(CsRecommendSortPrice.class, data);
  33 + if (csRecommendSortPrice == null || csRecommendSortPrice.getId() == null) {
  34 + return;
  35 + }
  36 + if (csRecommendSortPriceMapper.selectByPrimaryKey(csRecommendSortPrice.getId()) == null) {
  37 + csRecommendSortPriceMapper.insert(csRecommendSortPrice);
  38 + } else {
  39 + csRecommendSortPriceMapper.updateByPrimaryKey(csRecommendSortPrice);
  40 + }
  41 + }
  42 +}