<?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="io.renren.modules.sys.dao.serverport.ServerPortDao">
    <resultMap id="BaseResultMap" type="io.renren.modules.sys.entity.serverport.ServerPort">
        <id column="server_port_id" jdbcType="BIGINT" property="serverPortId" />
        <result column="is_used" jdbcType="INTEGER" property="isUsed" />
    </resultMap>
    <sql id="Base_Column_List">
        server_port_id,is_used
    </sql>
    <select id="selectNotUsedPort" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from server_port
        where is_used=0
        limit 1
    </select>

    <update id="updateServerPort" parameterType="io.renren.modules.sys.entity.serverport.ServerPort">
        update server_port
        set is_used=#{isUsed,jdbcType=INTEGER}
        where server_port_id=#{serverPortId,jdbcType=BIGINT}
    </update>
</mapper>