<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.WeixinQrcodeGenerationDaoImpl">
    <resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.WeixinQrcodeGeneration">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="generation" property="generation" jdbcType="INTEGER"/>
        <result column="wechat_group_ip" property="wechatGroupIp" jdbcType="VARCHAR"/>
        <result column="virtual_machine_ip" property="virtualMachineIp" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, generation, wechat_group_ip, virtual_machine_ip
    </sql>

    <!--根据Id查询详情-->
    <select id="getById" parameterType="Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from weixin_qrcode_generation
        where id = #{id}
    </select>

    <!--根据版本号查询详情-->
    <select id="getByGeneration" parameterType="Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from weixin_qrcode_generation
        where generation = #{generation}
        limit 1
    </select>

    <!--根据版本号批量获取-->
    <select id="getListByGenerations" parameterType="Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from weixin_qrcode_generation
        where generation in
        <foreach collection="list" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>

    </select>

</mapper>