<?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.ho.business.mapper.BusiIdControlMapper">

    <sql id="Base_Column_List">
        id
        ,id_type,current_value
    </sql>

    <select id="selectByType" resultType="com.ho.business.entity.BusiIdControl">
        select
        <include refid="Base_Column_List"/>
        from busi_id_control
        <where>
            <if test="idType != null">
                and id_type = #{idType}
            </if>
        </where>
    </select>

    <insert id="insert" keyColumn="id" keyProperty="id"
            useGeneratedKeys="true">
        insert into busi_id_control
            (id_type, current_value)
        values (#{idType}, #{currentValue})
    </insert>

    <update id="update">
        update busi_id_control
                set current_value = #{currentValue}
        where id = #{id}
    </update>

</mapper>
