<?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.cool.store.mapper.config.ConfigOptionMapper">

    <resultMap id="BaseResultMap" type="com.cool.store.entity.config.ConfigOptionDO">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="category_code" property="categoryCode" jdbcType="VARCHAR"/>
        <result column="item_code" property="itemCode" jdbcType="VARCHAR"/>
        <result column="option_code" property="optionCode" jdbcType="VARCHAR"/>
        <result column="option_name" property="optionName" jdbcType="VARCHAR"/>
        <result column="option_description" property="optionDescription" jdbcType="VARCHAR"/>
        <result column="option_unit" property="optionUnit" jdbcType="VARCHAR"/>
        <result column="option_price" property="optionPrice" jdbcType="DECIMAL"/>
        <result column="original_option_price" property="originalOptionPrice" jdbcType="DECIMAL"/>
        <result column="image_url" property="imageUrl" jdbcType="VARCHAR"/>
        <result column="video_url" property="videoUrl" jdbcType="VARCHAR"/>
        <result column="is_active" property="active" jdbcType="BOOLEAN"/>
        <result column="sort_order" property="sortOrder" jdbcType="INTEGER"/>
        <result column="option_remark" property="optionRemark" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="expense_type_code" property="expenseTypeCode" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, category_code, item_code, option_code, option_name, option_description,
        option_price, original_option_price, image_url, video_url,
        is_active, sort_order, option_remark,
        create_time, update_time, option_unit,expense_type_code
    </sql>

    <select id="listActiveByIds" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"/>
        FROM zxjp_config_option
        WHERE is_active = 1
          AND id IN
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        ORDER BY sort_order ASC
    </select>

</mapper>
