<?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.yeejoin.amos.fas.business.dao.mapper.DictMapper">
	<select id="countDict" resultType="long" parameterType="com.yeejoin.amos.fas.dao.entity.Dict">
		select count(1) from f_dict fd
		 <where>
            <if test="dictName != null">fd.dict_name like concat('%', #{dictName}, '%')</if>
            <if test="dictCode != null">fd.dict_code = #{dictCode}</if>
            <if test="parentId != null  and parentId > 0 ">fd.parent_id = #{parentId}</if>
        </where>
	</select>
	
	<select id="getDictPage" resultType="com.yeejoin.amos.fas.dao.entity.Dict">
		select fd.dict_name, fd.dict_svalue, fd.dict_code, fd.id, fd.parent_id, fd.remark, fd.dict_order from f_dict fd
		 <where>
            <if test="dictName != null">fd.dict_name like concat('%', #{dict.dictName}, '%')</if>
            <if test="dictCode != null">fd.dict_code = #{dictCode}</if>
            <if test="parentId != null  and parentId > 0 ">fd.parent_id = #{parentId}</if>
        </where>
        limit #{pageNumber} * #{pageSize}, #{pageSize}
	</select>
	
	<select id="getDictList" resultType="com.yeejoin.amos.fas.dao.entity.Dict">
		select fd.dict_name, fd.dict_value, fd.dict_code, fd.id, fd.parent_id, fd.remark, fd.dict_order from f_dict fd
		 <where>
            <if test="dictName != null">fd.dict_name like concat('%', #{dict.dictName}, '%')</if>
            <if test="dictCode != null"> and fd.dict_code = #{dictCode}</if>
            <if test="dictValue !=null">and fd.dict_value = #{dictValue}</if>
            <if test="parentId != null and parentId > 0 ">and fd.parent_id = #{parentId}</if>
        </where>
	</select>
</mapper>