<?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.bonus.core.menu.mapper.MenuCustomDictMapper">

    <!-- 批量插入数据 -->
    <insert id="insertBatch">
        insert into
        menu_custom_dict (custom_id) values
        <foreach collection="customIdList" item="customId" separator="," close=";">
            (#{customId})
        </foreach>
    </insert>

    <!-- 获取指定商户的最小自定义id -->
    <select id="selectMinCustomId" resultType="java.lang.Integer">
        select min(custom_id)
        from menu_custom_dict
        where if_use = #{ifUse}
    </select>

    <!-- 获取指定商户的最小自定义卡号 shihao.li -->
    <select id="selectMinCardNum" resultType="java.lang.Integer">
        select min(custom_id)
        from menu_custom_dict
        where if_card_num_use = #{ifCardNumUse}
    </select>

    <!-- 获取指定商户的最小人员限制id shihao.li -->
    <select id="selectMinCustLimitId" resultType="java.lang.Integer">
        select min(custom_id)
        from menu_custom_dict
        where if_cust_limit_id_use = #{ifCustLimitIdUse}
    </select>
</mapper>
