<?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.qiaoba.module.system.mapper.SysDictTypeMapper">

    <select id="checkDictTypeUnique" resultType="string">
        select dict_type from sys_dict_type
        where dict_type = #{dictType}
        <if test="dictId != null and dictId != ''">
            and dict_id != #{dictId}
        </if>
    </select>

    <select id="checkAllowDelete" resultType="string">
        SELECT t1.dict_name FROM sys_dict_type t1
        left join sys_dict_data t2 on t1.dict_type = t2.dict_type
        where t1.dict_id in
        <foreach item="id" collection="list" open="(" separator="," close=")">
            #{id}
        </foreach>
        and t2.dict_code is not null
    </select>
</mapper>
