<?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.ruoyi.platform.mapper.SysDictDataMapper">
	
	<resultMap type="com.ruoyi.common.core.domain.platform.vo.SysDictDataVO" id="SysDictDataResult">
		<id     property="id"   column="id"   />
		<result property="dictSort"   column="dict_sort"   />
		<result property="dictLabel"  column="dict_label"  />
		<result property="dictValue"  column="dict_value"  />
		<result property="dictType"   column="dict_type"   />
		<result property="cssClass"   column="css_class"   />
		<result property="listClass"  column="list_class"  />
		<result property="isDefault"  column="is_default"  />
		<result property="status"     column="status"      />
		<result property="createBy"   column="create_by"   />
		<result property="createTime" column="create_time" />
		<result property="updateBy"   column="update_by"   />
		<result property="updateTime" column="update_time" />
	</resultMap>
	
	<sql id="selectDictDataVo">
        select id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
		from sys_dict_data
    </sql>

	<select id="selectDictDataList" parameterType="com.ruoyi.common.core.domain.platform.dto.SysDictDataDTO" resultMap="SysDictDataResult">
	    <include refid="selectDictDataVo"/>
		<where>
		    <if test="dictType != null and dictType != ''">
				AND dict_type = #{dictType}
			</if>
			<if test="dictLabel != null and dictLabel != ''">
				AND dict_label like concat('%', #{dictLabel}, '%')
			</if>
			<if test="status != null and status != ''">
				AND status = #{status}
			</if>
		</where>
	</select>
	
	<select id="selectDictDataByType" parameterType="com.ruoyi.common.core.domain.platform.dto.SysDictDataDTO" resultMap="SysDictDataResult">
		<include refid="selectDictDataVo"/>
		where status = '0' and dict_type = #{dictType} order by dict_sort asc
	</select>
	
	<select id="selectDictLabel" resultType="String">
		select dict_label from sys_dict_data
		where dict_type = #{dictType} and dict_value = #{dictValue}
	</select>
	
</mapper> 