<?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="cn.iocoder.mall.admin.dao.DataDictMapper">

    <sql id="FIELDS">
        id, enum_value, value, display_name, sort,
        memo, create_time
    </sql>

    <select id="selectByEnumValueAndValue" resultType="DataDictDO">
        SELECT
          <include refid="FIELDS"/>
        FROM data_dict
        WHERE enum_value = #{enumValue}
        AND value = #{value}
        AND deleted = 0
        LIMIT 1
    </select>

    <select id="selectByEnumValueAndValues" resultType="cn.iocoder.mall.admin.dataobject.DataDictDO">
        SELECT
        <include refid="FIELDS"/>
        FROM data_dict
        WHERE deleted = 0
        AND enum_value = #{enumValue}
        AND `value` IN
        <foreach collection="values" item="value" separator="," open="(" close=")">
            #{value}
        </foreach>
    </select>

    <select id="selectByEnumValue" resultType="cn.iocoder.mall.admin.dataobject.DataDictDO">
        SELECT
        <include refid="FIELDS"/>
        FROM data_dict
        WHERE deleted = 0
        AND enum_value = #{enumValue}
    </select>

</mapper>
