<?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="org.springblade.modules.baseinfo.dict.mapper.DictInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="baseinfoDictResultMap" type="org.springblade.modules.baseinfo.dict.entity.DictInfoEntity">
        <result column="id" property="id"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="parent_id" property="parentId"/>
        <result column="code" property="code"/>
        <result column="dict_key" property="dictKey"/>
        <result column="dict_value" property="dictValue"/>
        <result column="sort" property="sort"/>
        <result column="remark" property="remark"/>
        <result column="is_sealed" property="isSealed"/>
    </resultMap>

    <select id="getDict" resultMap="baseinfoDictResultMap">
        SELECT
        n.*
        FROM
        blade_dict_biz n
        WHERE
        n.is_deleted = 0
        <if test="code!=null">
            and n.code = #{code}
        </if>
        <if test="key!=null">
            and n.dict_key = #{key}
        </if>
        limit 1

    </select>
</mapper>
