【同步】BOOT 和 CLOUD 的功能
parent
9ffec01fa0
commit
804d3eaaeb
File diff suppressed because it is too large
Load Diff
|
|
@ -349,4 +349,27 @@ public class CollectionUtils {
|
||||||
return (LinkedHashSet<T>) toCollection(LinkedHashSet.class, elementType, value);
|
return (LinkedHashSet<T>) toCollection(LinkedHashSet.class, elementType, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean dfs(Long node, Map<Long, Set<Long>> graph) {
|
||||||
|
return dfs(node, graph, new HashSet<>(), new HashSet<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean dfs(Long node, Map<Long, Set<Long>> graph, Set<Long> visited, Set<Long> inStack) {
|
||||||
|
if (inStack.contains(node)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (visited.contains(node)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
visited.add(node);
|
||||||
|
inStack.add(node);
|
||||||
|
Set<Long> neighbors = graph.getOrDefault(node, Collections.emptySet());
|
||||||
|
for (Long neighbor : neighbors) {
|
||||||
|
if (dfs(neighbor, graph, visited, inStack)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inStack.remove(node);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -335,6 +335,27 @@ public class LocalDateTimeUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定日期所在季度的第一天
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @return 所在季度的第一天
|
||||||
|
*/
|
||||||
|
public static LocalDate getQuarterStart(LocalDate date) {
|
||||||
|
Month firstMonthOfQuarter = date.getMonth().firstMonthOfQuarter();
|
||||||
|
return LocalDate.of(date.getYear(), firstMonthOfQuarter, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定日期所在周的第一天(周一)
|
||||||
|
*
|
||||||
|
* @param date 日期
|
||||||
|
* @return 所在周的周一
|
||||||
|
*/
|
||||||
|
public static LocalDate getWeekStart(LocalDate date) {
|
||||||
|
return date.with(DayOfWeek.MONDAY);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将给定的 {@link LocalDateTime} 转换为自 Unix 纪元时间(1970-01-01T00:00:00Z)以来的秒数。
|
* 将给定的 {@link LocalDateTime} 转换为自 Unix 纪元时间(1970-01-01T00:00:00Z)以来的秒数。
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,11 @@ public class ObjectUtils {
|
||||||
return Arrays.asList(array).contains(obj);
|
return Arrays.asList(array).contains(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public static <T> boolean notEqualsAny(T obj, T... array) {
|
||||||
|
return !Arrays.asList(array).contains(obj);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isNotAllEmpty(Object... objs) {
|
public static boolean isNotAllEmpty(Object... objs) {
|
||||||
return !ObjectUtil.isAllEmpty(objs);
|
return !ObjectUtil.isAllEmpty(objs);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,12 @@ public interface CrmCustomerLimitConfigMapper extends BaseMapperX<CrmCustomerLim
|
||||||
Integer type, Long userId, Long deptId) {
|
Integer type, Long userId, Long deptId) {
|
||||||
LambdaQueryWrapperX<CrmCustomerLimitConfigDO> query = new LambdaQueryWrapperX<CrmCustomerLimitConfigDO>()
|
LambdaQueryWrapperX<CrmCustomerLimitConfigDO> query = new LambdaQueryWrapperX<CrmCustomerLimitConfigDO>()
|
||||||
.eq(CrmCustomerLimitConfigDO::getType, type);
|
.eq(CrmCustomerLimitConfigDO::getType, type);
|
||||||
query.apply("FIND_IN_SET({0}, user_ids) > 0", userId);
|
query.and(w -> {
|
||||||
if (deptId != null) {
|
w.apply("FIND_IN_SET({0}, user_ids) > 0", userId);
|
||||||
query.apply("FIND_IN_SET({0}, dept_ids) > 0", deptId);
|
if (deptId != null) {
|
||||||
}
|
w.or().apply("FIND_IN_SET({0}, dept_ids) > 0", deptId);
|
||||||
|
}
|
||||||
|
});
|
||||||
return selectList(query);
|
return selectList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue