Beispiel #1
0
 /**
  * 删除
  *
  * @param id
  * @return
  */
 public static boolean deleteInfo(Long id) {
   Region info = Region.findById(id);
   boolean success = false;
   if (UtilValidate.isNotEmpty(info)) {
     // info.delete();
     info.delete_flag = 1;
     success = info.save().isPersistent();
   }
   return success;
 }
Beispiel #2
0
 public static boolean hasChildren(Long id) {
   long count = Region.count("parentid=?", id);
   boolean has = false;
   if (count > 0) {
     has = true;
   }
   return has;
 }
Beispiel #3
0
  public static Long getMaxOrderId() {
    Region region = Region.find("order by id desc").first();
    Long orderId = 1L;
    if (UtilValidate.isNotEmpty(region)) {
      orderId = region.orderid + 1;
    }

    return orderId;
  }
Beispiel #4
0
  public static String getRegionName(Long id) {
    String regionname = "";
    Region region = Region.findById(id);
    if (UtilValidate.isNotEmpty(region)) {
      regionname = region.regionname;
    }

    return regionname;
  }
Beispiel #5
0
  public static String getParentStr(Long parentId) {
    String parentStr = "";
    if (parentId == 0 || parentId == null) {
      parentStr = "0,";
    } else {
      Region region = Region.findById(parentId);
      parentStr = region.parentstr + parentId + ",";
    }

    return parentStr;
  }
Beispiel #6
0
 public static List<Region> regionList(Long parentId) {
   return Region.find("delete_flag=0 and parentid=? order by id asc", parentId).fetch();
 }
Beispiel #7
0
 public static List<Region> allInfos() {
   return Region.find("delete_flag=0 order by id asc").fetch();
 }