<?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.stylefeng.roses.kernel.dict.modular.mapper.DictTypeMapper">

    <select id="findDetail" resultType="cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType" parameterType="long">
        SELECT dict_type_id          AS dictTypeId,
               dict_type_class       AS dictTypeClass,
               dict_type_bus_code    AS dictTypeBusCode,
               dict_type_code        AS dictTypeCode,
               dict_type_name        AS dictTypeName,
               dict_type_name_pinyin AS dictTypeNamePinyin,
               dict_type_desc        AS dictTypeDesc,
               status_flag           AS statusFlag,
               dict_type_sort        AS dictTypeSort
        FROM sys_dict_type
        WHERE del_flag = 'N'
        AND dict_type_id = #{dictTypeId}
    </select>

    <!--查询字典类型列表-->
    <select id="findList" resultType="cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType">
        SELECT dict_type_id          AS dictTypeId,
               dict_type_class       AS dictTypeClass,
               dict_type_bus_code    AS dictTypeBusCode,
               dict_type_name_pinyin AS dictTypeNamePinyin,
               dict_type_code        AS dictTypeCode,
               dict_type_name        AS dictTypeName,
               dict_type_desc        AS dictTypeDesc,
               status_flag           AS statusFlag,
               dict_type_sort        AS dictTypeSort
        FROM sys_dict_type
        WHERE del_flag = 'N'
        <if test="dictTypeRequest.dictTypeName != null and dictTypeRequest.dictTypeName !=''">
            AND
            (
            dict_type_name like CONCAT('%', #{dictTypeRequest.dictTypeName}, '%')
            OR
            dict_type_name_pinyin like concat('%', #{dictTypeRequest.dictTypeName}, '%')
            )
        </if>
        <if test="dictTypeRequest.dictTypeClass != null and dictTypeRequest.dictTypeClass !=''">
            AND dict_type_class = #{dictTypeRequest.dictTypeClass}
        </if>
        <if test="dictTypeRequest.dictTypeDesc != null and dictTypeRequest.dictTypeDesc !=''">
            AND dict_type_desc like CONCAT('%', #{dictTypeRequest.dictTypeDesc}, '%')
        </if>
        <if test="dictTypeRequest.dictTypeCode != null and dictTypeRequest.dictTypeCode !=''">
            AND dict_type_code like CONCAT('%', #{dictTypeRequest.dictTypeCode}, '%')
        </if>
        <if test="dictTypeRequest.statusFlag != null and dictTypeRequest.statusFlag !=''">
            AND status_flag = #{dictTypeRequest.statusFlag}
        </if>
        ORDER BY dict_type_sort
    </select>

</mapper>
