/** * 删除 * * @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; }
public static boolean hasChildren(Long id) { long count = Region.count("parentid=?", id); boolean has = false; if (count > 0) { has = true; } return has; }
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; }
public static String getRegionName(Long id) { String regionname = ""; Region region = Region.findById(id); if (UtilValidate.isNotEmpty(region)) { regionname = region.regionname; } return regionname; }
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; }
public static List<Region> regionList(Long parentId) { return Region.find("delete_flag=0 and parentid=? order by id asc", parentId).fetch(); }
public static List<Region> allInfos() { return Region.find("delete_flag=0 order by id asc").fetch(); }