|
@@ -676,41 +676,42 @@ public class MarketingAppsServiceImpl implements MarketingAppsService {
|
|
|
query.eq("app_id", appId);
|
|
|
}
|
|
|
|
|
|
- // 单IP模式检查
|
|
|
- if (ipDto.getIpMode() == 1) {
|
|
|
- String targetIp = ipDto.getStartIp();
|
|
|
- // 检查是否有相同单IP
|
|
|
- query.and(wrapper -> wrapper
|
|
|
- .eq("ip_mode", 1)
|
|
|
- .eq("start_ip", targetIp));
|
|
|
-
|
|
|
- // 检查是否被IP段包含
|
|
|
- query.or(wrapper -> wrapper
|
|
|
- .eq("ip_mode", 2)
|
|
|
- .apply("INET_ATON({0}) BETWEEN INET_ATON(start_ip) AND INET_ATON(end_ip)", targetIp));
|
|
|
-
|
|
|
- }
|
|
|
+ query.and(wrapper -> {
|
|
|
+ // 单IP模式检查
|
|
|
+ if (ipDto.getIpMode() == 1) {
|
|
|
+ String targetIp = ipDto.getStartIp();
|
|
|
+ // 检查是否有相同单IP
|
|
|
+ wrapper.and(w -> w
|
|
|
+ .eq("ip_mode", 1)
|
|
|
+ .eq("start_ip", targetIp));
|
|
|
+
|
|
|
+ // 检查是否被IP段包含
|
|
|
+ wrapper.or(w -> w
|
|
|
+ .eq("ip_mode", 2)
|
|
|
+ .apply("INET_ATON({0}) BETWEEN INET_ATON(start_ip) AND INET_ATON(end_ip)", targetIp));
|
|
|
|
|
|
- // IP段模式检查
|
|
|
- if (ipDto.getIpMode() == 2) {
|
|
|
- String startIp = ipDto.getStartIp();
|
|
|
- String endIp = ipDto.getEndIp();
|
|
|
-
|
|
|
- // 检查是否与单IP重叠:单IP在输入IP段范围内
|
|
|
- query.and(wrapper -> wrapper
|
|
|
- .eq("ip_mode", 1)
|
|
|
- .apply("INET_ATON(start_ip) BETWEEN INET_ATON({0}) AND INET_ATON({1})", startIp, endIp));
|
|
|
- // 检查是否与IP段重叠:两个IP段有交集
|
|
|
- query.or(wrapper -> wrapper
|
|
|
- .eq("ip_mode", 2)
|
|
|
- .and(w2 -> w2
|
|
|
- .apply("INET_ATON(start_ip) BETWEEN INET_ATON({0}) AND INET_ATON({1})", startIp, endIp)
|
|
|
- .or().apply("INET_ATON(end_ip) BETWEEN INET_ATON({0}) AND INET_ATON({1})", startIp, endIp)
|
|
|
- .or().apply("INET_ATON({0}) BETWEEN INET_ATON(start_ip) AND INET_ATON(end_ip)", startIp)
|
|
|
- )
|
|
|
- );
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
+ // IP段模式检查
|
|
|
+ if (ipDto.getIpMode() == 2) {
|
|
|
+ String startIp = ipDto.getStartIp();
|
|
|
+ String endIp = ipDto.getEndIp();
|
|
|
+
|
|
|
+ // 检查是否与单IP重叠:单IP在输入IP段范围内
|
|
|
+ wrapper.and(w -> w
|
|
|
+ .eq("ip_mode", 1)
|
|
|
+ .apply("INET_ATON(start_ip) BETWEEN INET_ATON({0}) AND INET_ATON({1})", startIp, endIp));
|
|
|
+ // 检查是否与IP段重叠:两个IP段有交集
|
|
|
+ wrapper.or(w -> w
|
|
|
+ .eq("ip_mode", 2)
|
|
|
+ .and(w2 -> w2
|
|
|
+ .apply("INET_ATON(start_ip) BETWEEN INET_ATON({0}) AND INET_ATON({1})", startIp, endIp)
|
|
|
+ .or().apply("INET_ATON(end_ip) BETWEEN INET_ATON({0}) AND INET_ATON({1})", startIp, endIp)
|
|
|
+ .or().apply("INET_ATON({0}) BETWEEN INET_ATON(start_ip) AND INET_ATON(end_ip)", startIp)
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
return appsIpMapper.selectCount(query) > 0;
|
|
|
}
|
|
|
|