All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quhaodian.data.utils.CatalogUtils Maven / Gradle / Ivy

The newest version!
package com.quhaodian.data.utils;

import com.quhaodian.data.entity.CatalogEntity;

public class CatalogUtils {

  public static void updateParent(CatalogEntity bean, CatalogEntity parent) {
    if (bean.getParentId() != null) {
      if (parent != null) {
        if (parent.getLevelInfo() != null) {
          bean.setLevelInfo(parent.getLevelInfo() + 1);
        } else {
          parent.setLevelInfo(1);
          bean.setLevelInfo(2);
        }
        if (parent.getIds() != null) {
          bean.setIds(parent.getIds() + "," + bean.getId());
        } else {
          parent.setIds(parent.getId() + "");
          bean.setIds(parent.getId() + "," + bean.getId());
        }
      } else {
        bean.setLevelInfo(1);
        bean.setIds("" + bean.getId());
      }
    } else {
      bean.setLevelInfo(1);
      bean.setIds("" + bean.getId());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy