2019-01-04 18:28:57 +06:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
<mapper namespace="com.nis.web.dao.basics.AsnGroupInfoDao" >
|
|
|
|
|
<resultMap id="AsnGroupInfoMap" type="com.nis.domain.basics.AsnGroupInfo" >
|
|
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
|
|
|
<result column="group_id" property="groupId" jdbcType="INTEGER" />
|
|
|
|
|
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
|
|
|
|
|
<result column="organization" property="organization" jdbcType="VARCHAR" />
|
|
|
|
|
<result column="country" property="country" jdbcType="VARCHAR" />
|
|
|
|
|
<result column="detail" property="detail" jdbcType="VARCHAR" />
|
|
|
|
|
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
|
|
|
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
|
|
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
|
|
|
|
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
|
|
|
|
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
|
|
|
|
<result column="asn_id" property="asnId" jdbcType="BIGINT" />
|
2019-01-06 11:24:49 +08:00
|
|
|
<result column="issued_ips" property="issuedIPs" jdbcType="INTEGER" />
|
2019-01-16 14:33:29 +06:00
|
|
|
<result column="is_used" property="isUsed" jdbcType="INTEGER" />
|
|
|
|
|
<result column="region_id" property="regionId" jdbcType="INTEGER" />
|
2019-01-18 11:14:05 +06:00
|
|
|
<result column="org_group_id" property="orgGroupId" jdbcType="INTEGER" />
|
2019-01-04 18:28:57 +06:00
|
|
|
</resultMap>
|
|
|
|
|
<sql id="AsnGroupInfoColumns">
|
|
|
|
|
r.id,r.group_id,r.compile_id,r.organization,r.country,r.detail,r.is_valid,r.create_time,r.edit_time,
|
2019-02-18 10:39:49 +08:00
|
|
|
r.creator_id,r.editor_id,r.asn_id,r.issued_ips,r.is_used,r.region_id,r.org_group_id,r.only_group_id
|
2019-01-04 18:28:57 +06:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!-- 查出所有 有效数据-->
|
|
|
|
|
<select id="findAsnGroupInfoList" resultMap="AsnGroupInfoMap">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
<trim prefix="," prefixOverrides=",">
|
|
|
|
|
, s.name as creator_name
|
|
|
|
|
,e.name as editor_name
|
|
|
|
|
</trim>
|
|
|
|
|
FROM asn_group_info r
|
|
|
|
|
left join sys_user s on r.creator_id=s.id
|
|
|
|
|
left join sys_user e on r.editor_id=e.id
|
|
|
|
|
|
|
|
|
|
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
|
|
|
|
<if test="page !=null and page.where != null and page.where != ''">
|
|
|
|
|
AND ${page.where}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="organization != null and organization != ''">
|
|
|
|
|
AND r.organization like concat(concat('%',#{organization,jdbcType=VARCHAR}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="country != null and country != ''">
|
|
|
|
|
AND r.country like concat(concat('%',#{country,jdbcType=VARCHAR}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="detail != null and detail != ''">
|
|
|
|
|
AND r.detail like concat(concat('%',#{detail,jdbcType=VARCHAR}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="asnId != null and asnId != ''">
|
|
|
|
|
AND r.asn_id =#{asnId }
|
|
|
|
|
</if>
|
|
|
|
|
<if test="creatorName != null and creatorName != ''">
|
|
|
|
|
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="editorName != null and editorName != ''">
|
|
|
|
|
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
|
|
|
|
|
</if>
|
2019-01-06 11:24:49 +08:00
|
|
|
<if test="issuedIPs != null and issuedIPs != ''">
|
|
|
|
|
AND r.issued_ips =#{issuedIPs }
|
2019-01-04 18:28:57 +06:00
|
|
|
</if>
|
|
|
|
|
<if test="isValid != null and isValid != ''">
|
|
|
|
|
AND r.is_valid =#{isValid }
|
2019-01-18 11:14:05 +06:00
|
|
|
</if>
|
|
|
|
|
<if test="orgGroupId != null and orgGroupId != ''">
|
|
|
|
|
AND r.org_group_id =#{orgGroupId }
|
2019-01-04 18:28:57 +06:00
|
|
|
</if>
|
|
|
|
|
AND r.is_valid !=-1
|
|
|
|
|
<!-- 数据范围过滤 -->
|
|
|
|
|
<!-- ${sqlMap.dsf} -->
|
|
|
|
|
</trim>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
|
ORDER BY ${page.orderBy}
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
ORDER BY r.group_id desc
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<!-- 查出所有 有效数据-->
|
|
|
|
|
<select id="findAsnGroupInfos" resultMap="AsnGroupInfoMap">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
2019-01-16 14:33:29 +06:00
|
|
|
FROM asn_group_info r where r.is_valid !=-1
|
2019-01-04 18:28:57 +06:00
|
|
|
</select>
|
|
|
|
|
<select id="getCount" resultType="java.lang.Long">
|
|
|
|
|
SELECT count(1)
|
|
|
|
|
FROM asn_group_info r where is_valid !=-1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insert" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
2019-01-16 14:33:29 +06:00
|
|
|
insert into asn_group_info(
|
|
|
|
|
group_id,
|
|
|
|
|
compile_id,
|
|
|
|
|
organization,
|
|
|
|
|
country,
|
|
|
|
|
detail,
|
|
|
|
|
is_valid,
|
|
|
|
|
creator_id,
|
|
|
|
|
create_time,
|
|
|
|
|
editor_id,
|
|
|
|
|
edit_time,
|
|
|
|
|
asn_id,
|
|
|
|
|
is_used,
|
2019-01-18 11:14:05 +06:00
|
|
|
region_id,
|
2019-02-18 10:39:49 +08:00
|
|
|
org_group_id,
|
|
|
|
|
only_group_id
|
2019-01-04 18:28:57 +06:00
|
|
|
)values (
|
|
|
|
|
#{groupId,jdbcType=INTEGER},
|
|
|
|
|
#{compileId,jdbcType=INTEGER},
|
|
|
|
|
#{organization,jdbcType=VARCHAR},
|
|
|
|
|
#{country,jdbcType=VARCHAR},
|
|
|
|
|
#{detail,jdbcType=VARCHAR},
|
|
|
|
|
#{isValid,jdbcType=INTEGER},
|
|
|
|
|
#{creatorId,jdbcType=INTEGER},
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{editorId,jdbcType=INTEGER},
|
|
|
|
|
#{editTime,jdbcType=TIMESTAMP},
|
2019-01-16 14:33:29 +06:00
|
|
|
#{asnId,jdbcType=INTEGER},
|
|
|
|
|
#{isUsed,jdbcType=INTEGER},
|
2019-01-18 11:14:05 +06:00
|
|
|
#{regionId,jdbcType=INTEGER},
|
2019-02-18 10:39:49 +08:00
|
|
|
#{orgGroupId,jdbcType=INTEGER},
|
|
|
|
|
#{onlyGroupId,jdbcType=INTEGER}
|
2019-01-04 18:28:57 +06:00
|
|
|
)
|
|
|
|
|
</insert>
|
2019-01-23 19:32:47 +06:00
|
|
|
<insert id="insertWithoutId" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
|
|
|
|
insert into asn_group_info(
|
|
|
|
|
group_id,
|
|
|
|
|
compile_id,
|
|
|
|
|
organization,
|
|
|
|
|
country,
|
|
|
|
|
detail,
|
|
|
|
|
is_valid,
|
|
|
|
|
creator_id,
|
|
|
|
|
create_time,
|
|
|
|
|
editor_id,
|
|
|
|
|
edit_time,
|
|
|
|
|
asn_id,
|
|
|
|
|
is_used,
|
|
|
|
|
region_id,
|
|
|
|
|
org_group_id
|
|
|
|
|
)values (
|
|
|
|
|
#{groupId,jdbcType=INTEGER},
|
|
|
|
|
#{compileId,jdbcType=INTEGER},
|
|
|
|
|
#{organization,jdbcType=VARCHAR},
|
|
|
|
|
#{country,jdbcType=VARCHAR},
|
|
|
|
|
#{detail,jdbcType=VARCHAR},
|
|
|
|
|
#{isValid,jdbcType=INTEGER},
|
|
|
|
|
#{creatorId,jdbcType=INTEGER},
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{editorId,jdbcType=INTEGER},
|
|
|
|
|
#{editTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{asnId,jdbcType=INTEGER},
|
|
|
|
|
#{isUsed,jdbcType=INTEGER},
|
|
|
|
|
#{regionId,jdbcType=INTEGER},
|
|
|
|
|
#{orgGroupId,jdbcType=INTEGER}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="insertWithId" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
|
|
|
|
insert into asn_group_info(
|
|
|
|
|
id,
|
|
|
|
|
group_id,
|
|
|
|
|
compile_id,
|
|
|
|
|
organization,
|
|
|
|
|
country,
|
|
|
|
|
detail,
|
|
|
|
|
is_valid,
|
|
|
|
|
creator_id,
|
|
|
|
|
create_time,
|
|
|
|
|
editor_id,
|
|
|
|
|
edit_time,
|
|
|
|
|
asn_id,
|
|
|
|
|
is_used,
|
|
|
|
|
region_id,
|
2019-02-18 10:39:49 +08:00
|
|
|
org_group_id,
|
|
|
|
|
only_group_id
|
2019-01-23 19:32:47 +06:00
|
|
|
)values (
|
|
|
|
|
#{id,jdbcType=INTEGER},
|
|
|
|
|
#{groupId,jdbcType=INTEGER},
|
|
|
|
|
#{compileId,jdbcType=INTEGER},
|
|
|
|
|
#{organization,jdbcType=VARCHAR},
|
|
|
|
|
#{country,jdbcType=VARCHAR},
|
|
|
|
|
#{detail,jdbcType=VARCHAR},
|
|
|
|
|
#{isValid,jdbcType=INTEGER},
|
|
|
|
|
#{creatorId,jdbcType=INTEGER},
|
|
|
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{editorId,jdbcType=INTEGER},
|
|
|
|
|
#{editTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{asnId,jdbcType=INTEGER},
|
|
|
|
|
#{isUsed,jdbcType=INTEGER},
|
|
|
|
|
#{regionId,jdbcType=INTEGER},
|
2019-02-18 10:39:49 +08:00
|
|
|
#{orgGroupId,jdbcType=INTEGER},
|
|
|
|
|
#{onlyGroupId,jdbcType=INTEGER}
|
2019-01-23 19:32:47 +06:00
|
|
|
)
|
|
|
|
|
</insert>
|
2019-01-04 18:28:57 +06:00
|
|
|
<update id="update" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
|
|
|
|
update asn_group_info
|
|
|
|
|
<set >
|
|
|
|
|
<trim suffixOverrides=",">
|
|
|
|
|
<if test="organization != null and organization !=''" >
|
|
|
|
|
organization = #{organization,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="country != null and country !=''" >
|
|
|
|
|
country = #{country,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="detail != null and detail !=''" >
|
|
|
|
|
detail = #{detail,jdbcType=VARCHAR},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="asnId != null and asnId !=''" >
|
|
|
|
|
asn_id = #{asnId,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isValid != null and isValid !=''" >
|
|
|
|
|
is_valid = #{isValid,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="groupId != null and groupId !=''" >
|
|
|
|
|
group_id = #{groupId,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
2019-01-06 11:24:49 +08:00
|
|
|
<if test="issuedIPs != null" >
|
|
|
|
|
issued_ips = issued_ips+#{issuedIPs,jdbcType=INTEGER},
|
2019-01-04 18:28:57 +06:00
|
|
|
</if>
|
|
|
|
|
<if test="compileId != null and compileId !=''" >
|
|
|
|
|
compile_id = #{compileId,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="editorId != null" >
|
|
|
|
|
editor_id = #{editorId,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="editTime != null and editTime != ''" >
|
|
|
|
|
edit_time = #{editTime,jdbcType=TIMESTAMP},
|
|
|
|
|
</if>
|
2019-01-16 14:33:29 +06:00
|
|
|
<if test="isUsed != null" >
|
|
|
|
|
is_used = #{isUsed,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="regionId != null" >
|
|
|
|
|
region_id = #{regionId,jdbcType=INTEGER},
|
2019-01-18 11:14:05 +06:00
|
|
|
</if>
|
|
|
|
|
<if test="orgGroupId != null" >
|
|
|
|
|
org_group_id = #{orgGroupId,jdbcType=INTEGER},
|
2019-01-16 14:33:29 +06:00
|
|
|
</if>
|
2019-01-04 18:28:57 +06:00
|
|
|
</trim>
|
|
|
|
|
</set>
|
|
|
|
|
<where>
|
|
|
|
|
<trim suffixOverrides="and">
|
|
|
|
|
<if test="id != null" >
|
|
|
|
|
and id = #{id,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</where>
|
|
|
|
|
</update>
|
2019-01-16 14:33:29 +06:00
|
|
|
<update id="updateIsUsedAndIsValid" >
|
|
|
|
|
update asn_group_info
|
|
|
|
|
<set >
|
|
|
|
|
<if test="isUsed != null" >
|
|
|
|
|
is_used = #{isUsed,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isValid != null" >
|
|
|
|
|
is_valid = #{isValid,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
</set>
|
|
|
|
|
<where>
|
2019-01-18 11:14:05 +06:00
|
|
|
<if test="groupIds != null" >
|
|
|
|
|
and group_id in
|
|
|
|
|
<foreach collection ="groupIds" item="groupId" separator ="," open="(" close=")">
|
|
|
|
|
#{groupId}
|
2019-01-16 14:33:29 +06:00
|
|
|
</foreach >
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isValid != null" >
|
|
|
|
|
and is_valid != #{isValid,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</update>
|
2019-01-04 18:28:57 +06:00
|
|
|
<update id="updateValid" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
|
|
|
|
update asn_group_info
|
|
|
|
|
<set >
|
|
|
|
|
<trim suffixOverrides=",">
|
|
|
|
|
is_valid = #{isValid,jdbcType=INTEGER},
|
2019-01-06 11:24:49 +08:00
|
|
|
<if test="issuedIPs != null" >
|
|
|
|
|
issued_ips = issued_ips+#{issuedIPs,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
2019-01-04 18:28:57 +06:00
|
|
|
</trim>
|
|
|
|
|
</set>
|
|
|
|
|
<where>
|
|
|
|
|
<trim prefixOverrides="and">
|
|
|
|
|
<if test="groupId != null" >
|
|
|
|
|
and group_id = #{groupId,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
2019-01-06 11:24:49 +08:00
|
|
|
<if test="asnId != null" >
|
|
|
|
|
and asn_id = #{asnId,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="id != null and id != ''" >
|
|
|
|
|
and id = #{id,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
and is_valid != -1
|
|
|
|
|
</trim>
|
|
|
|
|
</where>
|
|
|
|
|
</update>
|
|
|
|
|
<update id="modifyIssuedIp" parameterType="com.nis.domain.basics.AsnGroupInfo" >
|
|
|
|
|
update asn_group_info
|
|
|
|
|
<set >
|
|
|
|
|
<trim suffixOverrides=",">
|
|
|
|
|
<if test="issuedIPs != null" >
|
|
|
|
|
issued_ips = issued_ips+#{issuedIPs,jdbcType=INTEGER},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</set>
|
|
|
|
|
<where>
|
|
|
|
|
<trim prefixOverrides="and">
|
|
|
|
|
<if test="groupId != null" >
|
|
|
|
|
and group_id = #{groupId,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="asnId != null and asnId != ''" >
|
|
|
|
|
and asn_id = #{asnId,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
2019-01-04 18:28:57 +06:00
|
|
|
<if test="id != null and id != ''" >
|
|
|
|
|
and id = #{id,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
2019-01-06 11:24:49 +08:00
|
|
|
and is_valid != -1
|
2019-01-04 18:28:57 +06:00
|
|
|
</trim>
|
|
|
|
|
</where>
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getById" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
select <include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
from asn_group_info r
|
|
|
|
|
where r.id =#{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getByGroupId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
select <include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
from asn_group_info r
|
2019-01-16 14:33:29 +06:00
|
|
|
where r.group_id =#{groupId} and r.is_valid !=-1
|
2019-01-04 18:28:57 +06:00
|
|
|
</select>
|
|
|
|
|
<select id="getGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
select <include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
from asn_group_info r
|
|
|
|
|
where r.organization =#{organization}
|
|
|
|
|
<!-- and r.country =#{country} -->
|
|
|
|
|
and r.is_valid != -1 limit 1
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getGroupIdByNameAndASNId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
select <include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
from asn_group_info r
|
|
|
|
|
where r.organization =#{organization}
|
|
|
|
|
<!-- and r.country =#{country} -->
|
|
|
|
|
and r.asn_id=#{asnId} and r.is_valid != -1 limit 1
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getInfoByAsnNo" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
|
|
|
|
asn_group_info r
|
|
|
|
|
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
|
|
|
|
<if test="id != null" >
|
|
|
|
|
AND id != #{id,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="groupId != null" >
|
|
|
|
|
AND group_id = #{groupId,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="asnId != null" >
|
|
|
|
|
AND asn_id = #{asnId,jdbcType=BIGINT}
|
|
|
|
|
</if>
|
|
|
|
|
AND is_valid !=-1
|
|
|
|
|
</trim>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getConfigGroupInfoByGroupId" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
2019-01-16 14:33:29 +06:00
|
|
|
asn_group_info r WHERE r.group_id = #{groupId,jdbcType=INTEGER} AND r.is_valid !=-1
|
2019-01-04 18:28:57 +06:00
|
|
|
</select>
|
|
|
|
|
<select id="getConfigGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
2019-01-16 14:33:29 +06:00
|
|
|
asn_group_info r WHERE r.organization = #{organization,jdbcType=VARCHAR} AND r.is_valid !=-1
|
2019-01-04 18:28:57 +06:00
|
|
|
</select>
|
|
|
|
|
<select id="getValidConfigGroupInfoByName" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
2019-01-06 11:24:49 +08:00
|
|
|
asn_group_info r WHERE organization = #{organization,jdbcType=VARCHAR} AND is_valid =1 AND issued_ips>0
|
2019-01-04 18:28:57 +06:00
|
|
|
</select>
|
|
|
|
|
<select id="getCountGroupInfoByName" resultType="java.lang.Integer">
|
|
|
|
|
SELECT count(1) FROM asn_group_info r WHERE organization = #{organization,jdbcType=VARCHAR} AND is_valid !=-1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getGroupIdByOrganization" resultType="java.lang.Integer">
|
|
|
|
|
SELECT
|
|
|
|
|
r.group_id
|
|
|
|
|
FROM
|
|
|
|
|
asn_group_info r
|
|
|
|
|
WHERE
|
|
|
|
|
r.organization = #{organization}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getGroupInfo" resultType="com.nis.domain.basics.AsnGroupInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
|
|
|
|
asn_group_info r
|
|
|
|
|
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
|
|
|
|
<if test="organization != null and organization != ''" >
|
2019-01-16 14:33:29 +06:00
|
|
|
AND r.organization = #{organization,jdbcType=VARCHAR}
|
2019-01-04 18:28:57 +06:00
|
|
|
</if>
|
|
|
|
|
<if test="asnId != null" >
|
2019-01-16 14:33:29 +06:00
|
|
|
AND r.asn_id = #{asnId,jdbcType=INTEGER}
|
2019-01-04 18:28:57 +06:00
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</select>
|
2019-01-16 14:33:29 +06:00
|
|
|
|
|
|
|
|
<select id="findAsnGroupInfoByAsnGroup" resultMap="AsnGroupInfoMap">
|
|
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
|
|
|
|
asn_group_info r
|
|
|
|
|
<where>
|
|
|
|
|
<if test="asnId != null" >
|
|
|
|
|
AND r.asn_id = #{asnId,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isUsed != null" >
|
|
|
|
|
AND r.is_used = #{isUsed,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="organization != null and organization != ''" >
|
|
|
|
|
AND r.organization = #{organization,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isValid != null" >
|
|
|
|
|
AND r.is_valid = #{isValid,jdbcType=VARCHAR}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
2019-01-18 11:14:05 +06:00
|
|
|
<select id="findAsnGroupInfoByGroupIds" resultMap="AsnGroupInfoMap">
|
2019-01-16 14:33:29 +06:00
|
|
|
SELECT
|
|
|
|
|
<include refid="AsnGroupInfoColumns"/>
|
|
|
|
|
FROM
|
|
|
|
|
asn_group_info r
|
|
|
|
|
<where>
|
|
|
|
|
<if test="isUsed != null" >
|
|
|
|
|
AND r.is_used = #{isUsed,jdbcType=INTEGER}
|
|
|
|
|
</if>
|
2019-01-18 11:14:05 +06:00
|
|
|
<if test="groupIds != null" >
|
|
|
|
|
and r.group_id in
|
|
|
|
|
<foreach collection ="groupIds" item="groupId" separator ="," open="(" close=")">
|
|
|
|
|
#{groupId}
|
|
|
|
|
</foreach >
|
2019-01-16 14:33:29 +06:00
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
2019-01-19 10:32:07 +06:00
|
|
|
<select id="findAsnGroupIdByGroupIds" resultType="java.lang.String">
|
|
|
|
|
SELECT
|
|
|
|
|
group_id
|
|
|
|
|
FROM
|
|
|
|
|
asn_group_info r
|
|
|
|
|
<where>
|
|
|
|
|
AND r.is_valid != -1
|
|
|
|
|
and r.group_id in (${groupIds})
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
2019-01-23 19:32:47 +06:00
|
|
|
<delete id="deleteAll" >
|
|
|
|
|
delete from asn_group_info
|
|
|
|
|
</delete>
|
2019-01-26 19:41:58 +06:00
|
|
|
<update id="updateIpNum" >
|
|
|
|
|
update asn_group_info set v4_num=#{v4Num},v6_num=#{v6Num} where group_id=#{groupId}
|
|
|
|
|
</update>
|
|
|
|
|
<select id="getASNIPNum" resultType="map">
|
|
|
|
|
select v4_num,v6_num from asn_group_info where asn_id=#{asnNo}
|
|
|
|
|
</select>
|
2019-01-04 18:28:57 +06:00
|
|
|
</mapper>
|