<?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.tamguo.admin.dao.MenuMapper">
	
	<select id="findFatherMenus" resultType="MenuEntity">
		SELECT
			uid,name,parent_id,pinyin,is_show,orders,url,reserve_1
		FROM
			tiku_menu
		where parent_id = 1 and is_show = 1
		order by orders desc
	</select>
	
	<select id="findMenuByParentId" resultType="MenuEntity">
		SELECT
			uid,name,parent_id,pinyin,is_show,orders,url,reserve_1
		FROM
			tiku_menu
		where parent_id = #{parentId}
		order by orders desc
	</select>
	
	<select id="findAllFatherMenus" resultType="MenuEntity">
		SELECT
			uid,name,parent_id,pinyin,is_show,orders,url,reserve_1
		FROM
			tiku_menu
		where parent_id = 1
		order by orders desc
	</select>
	
	<select id="findLeftFatherMenus" resultType="MenuEntity">
		SELECT
			uid,name,parent_id,pinyin,is_show,orders,url,reserve_1
		FROM
			tiku_menu
		where parent_id = 2
		order by orders desc
	</select>
	
	<select id="findFooterFatherMenus" resultType="MenuEntity">
		SELECT
			uid,name,parent_id,pinyin,is_show,orders,url,reserve_1
		FROM
			tiku_menu
		where parent_id = 3
		order by orders desc
	</select>
	
	<select id="findByName" resultType="MenuEntity">
		SELECT
			m.is_show,
			m.`name`,
			m.orders,
			m.parent_id,
			m.pinyin,
			m.uid,
			m.url,
			m.reserve_1
		FROM
			tiku_menu m
		<where>
			<if test="name != null and name != ''">
				m.name like #{name}
			</if>
		</where>
	</select>
    
</mapper>