<?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.SysMenuMapper">

  <resultMap id="BaseResultMap" type="com.tamguo.admin.model.SysMenuEntity" >
    <id column="uid" property="uid" jdbcType="VARCHAR" />
    <result column="parent_id" property="parentId" jdbcType="BIGINT" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="url" property="url" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="perms" property="perms" jdbcType="INTEGER" />
    <result column="order_num" property="orderNum" jdbcType="INTEGER" />
    <result column="parentName" property="parentName" jdbcType="INTEGER" />
  </resultMap>
  
  <sql id="Base_Column_List" >
    uid, parent_id, name, url, type, perms ,  order_num
  </sql>


  <select id="queryList" resultMap="BaseResultMap">
		select m.*,(select p.name from sys_menu p where p.uid = m.parent_id) as parentName 
			from sys_menu m order by m.order_num asc 
  </select>
	
  <select id="queryNotButtonList" resultMap="BaseResultMap">
		select <include refid="Base_Column_List" /> 
		from sys_menu where type != 2 order by order_num asc 
  </select>
  
  
  <select id="queryByUid" resultMap="BaseResultMap">
		select m.*,(select p.name from sys_menu p where p.uid = m.parent_id) as parentName 
			from sys_menu m where m.uid = #{uid}
  </select>
  
</mapper>