不能删除ASN 组中的最后一个ASN IP,做了前台Ajax验证

This commit is contained in:
wangxin
2018-09-03 13:02:24 +08:00
parent ff449143e6
commit ba295706f3
7 changed files with 63 additions and 9 deletions

View File

@@ -18,4 +18,5 @@ public interface AsnIpCfgDao extends CrudDao<AsnIpCfg>{
public List<AsnIpCfg> findAllList(AsnIpCfg cfg);
public List<ConfigGroupInfo> findPolicyGroupInfosByType(@Param("groupId")Integer groupId);
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
public List<Integer> countValidIPs(@Param("ids")String ids);
}

View File

@@ -381,10 +381,13 @@
from config_group_info c where c.group_type= #{groupId}
</select>
<select id="findOtherIps" resultType="java.lang.Integer" parameterType="java.lang.Integer">
select 1 from asn_ip_cfg where is_valid=1 and asn_ip_group=#{groupId} and cfg_id !=#{cfgId} limit 2
select 1 from asn_ip_cfg where is_valid=1 and asn_ip_group=#{groupId} and cfg_id !=#{cfgId} limit 1
</select>
<select id="hasGroupIds" resultType="java.lang.Integer" parameterType="java.lang.Integer">
select 1 from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${ids}) limit 2
select 1 from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${ids}) limit 1
</select>
<select id="countValidIPs" resultType="java.lang.Integer" parameterType="java.lang.Integer">
select count(1) from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${ids}) GROUP BY asn_ip_group;
</select>
</mapper>