<?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.izouma.awesomeadmin.dao.SysMenuMapper" >
	<resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.SysMenu" >
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="parent_id" property="parentId" jdbcType="INTEGER" />
		<result column="parent_ids" property="parentIds" jdbcType="VARCHAR" />
		<result column="name" property="name" jdbcType="VARCHAR" />
		<result column="sort" property="sort" jdbcType="DECIMAL" />
		<result column="href" property="href" jdbcType="VARCHAR" />
		<result column="target" property="target" jdbcType="VARCHAR" />
		<result column="icon" property="icon" jdbcType="VARCHAR" />
		<result column="is_show" property="isShow" jdbcType="CHAR" />
		<result column="permission" property="permission" jdbcType="VARCHAR" />
		<result column="create_by" property="createBy" jdbcType="VARCHAR" />
		<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
		<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
		<result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
		<result column="remarks" property="remarks" jdbcType="VARCHAR" />
		<result column="del_flag" property="delFlag" jdbcType="CHAR" />
		<result column="menu_type" property="menuType" jdbcType="CHAR" />
	</resultMap>
	<sql id="Base_Column_List" >
		 id, parent_id, parent_ids, name, sort, href, target, icon, is_show, permission, create_by, create_date, update_by, update_date, remarks, del_flag, menu_type
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
		select
		<include refid="Base_Column_List" />
		from sys_menu
		where id = #{id,jdbcType=INTEGER}
	</select>
	<select id="selectByPrimaryKeys" resultMap="BaseResultMap" parameterType="java.lang.String" >
		select
		<include refid="Base_Column_List" />
		from sys_menu
		where FIND_IN_SET(id, #{ids,jdbcType=INTEGER}) and del_flag = 'N'
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
		delete from sys_menu
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.SysMenu" useGeneratedKeys="true" keyProperty="id">
		insert into sys_menu
		<trim prefix="(" suffix=")" suffixOverrides="," >
			<if test="id != null" >
				id,	
			</if>
			<if test="parentId != null" >
				parent_id,	
			</if>
			<if test="parentIds != null" >
				parent_ids,	
			</if>
			<if test="name != null" >
				name,	
			</if>
			<if test="sort != null" >
				sort,	
			</if>
			<if test="href != null" >
				href,	
			</if>
			<if test="target != null" >
				target,	
			</if>
			<if test="icon != null" >
				icon,	
			</if>
			<if test="isShow != null" >
				is_show,	
			</if>
			<if test="permission != null" >
				permission,	
			</if>
			<if test="createBy != null" >
				create_by,	
			</if>
			<if test="createDate != null" >
				create_date,	
			</if>
			<if test="updateBy != null" >
				update_by,	
			</if>
			<if test="updateDate != null" >
				update_date,	
			</if>
			<if test="remarks != null" >
				remarks,	
			</if>
			<if test="delFlag != null" >
				del_flag,	
			</if>
			<if test="menuType != null" >
				menu_type,	
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides="," >
			<if test="id != null" >
				#{id,jdbcType=INTEGER},	
			</if>
			<if test="parentId != null" >
				#{parentId,jdbcType=INTEGER},	
			</if>
			<if test="parentIds != null" >
				#{parentIds,jdbcType=VARCHAR},	
			</if>
			<if test="name != null" >
				#{name,jdbcType=VARCHAR},	
			</if>
			<if test="sort != null" >
				#{sort,jdbcType=DECIMAL},	
			</if>
			<if test="href != null" >
				#{href,jdbcType=VARCHAR},	
			</if>
			<if test="target != null" >
				#{target,jdbcType=VARCHAR},	
			</if>
			<if test="icon != null" >
				#{icon,jdbcType=VARCHAR},	
			</if>
			<if test="isShow != null" >
				#{isShow,jdbcType=CHAR},	
			</if>
			<if test="permission != null" >
				#{permission,jdbcType=VARCHAR},	
			</if>
			<if test="createBy != null" >
				#{createBy,jdbcType=VARCHAR},	
			</if>
			<if test="createDate != null" >
				#{createDate,jdbcType=TIMESTAMP},	
			</if>
			<if test="updateBy != null" >
				#{updateBy,jdbcType=VARCHAR},	
			</if>
			<if test="updateDate != null" >
				#{updateDate,jdbcType=TIMESTAMP},	
			</if>
			<if test="remarks != null" >
				#{remarks,jdbcType=VARCHAR},	
			</if>
			<if test="delFlag != null" >
				#{delFlag,jdbcType=CHAR},	
			</if>
			<if test="menuType != null" >
				#{menuType,jdbcType=CHAR},	
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.SysMenu" >
		update sys_menu
		<set >
			<if test="parentId != null" >
				parent_id = #{parentId,jdbcType=INTEGER},	
			</if>
			<if test="parentIds != null" >
				parent_ids = #{parentIds,jdbcType=VARCHAR},	
			</if>
			<if test="name != null" >
				name = #{name,jdbcType=VARCHAR},	
			</if>
			<if test="sort != null" >
				sort = #{sort,jdbcType=DECIMAL},	
			</if>
			<if test="href != null" >
				href = #{href,jdbcType=VARCHAR},	
			</if>
			<if test="target != null" >
				target = #{target,jdbcType=VARCHAR},	
			</if>
			<if test="icon != null" >
				icon = #{icon,jdbcType=VARCHAR},	
			</if>
			<if test="isShow != null" >
				is_show = #{isShow,jdbcType=CHAR},	
			</if>
			<if test="permission != null" >
				permission = #{permission,jdbcType=VARCHAR},	
			</if>
			<if test="createBy != null" >
				create_by = #{createBy,jdbcType=VARCHAR},	
			</if>
			<if test="createDate != null" >
				create_date = #{createDate,jdbcType=TIMESTAMP},	
			</if>
			<if test="updateBy != null" >
				update_by = #{updateBy,jdbcType=VARCHAR},	
			</if>
			<if test="updateDate != null" >
				update_date = #{updateDate,jdbcType=TIMESTAMP},	
			</if>
			<if test="remarks != null" >
				remarks = #{remarks,jdbcType=VARCHAR},	
			</if>
			<if test="delFlag != null" >
				del_flag = #{delFlag,jdbcType=CHAR},	
			</if>
			<if test="menuType != null" >
				menu_type = #{menuType,jdbcType=CHAR},	
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<select id="querySysMenusByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.SysMenu">
		select <include refid="Base_Column_List"/> from sys_menu
		<where>
			and del_flag = 'N'
			<if test="record.id != null and !&quot;&quot;.equals(record.id)">
				and id = #{record.id}	
			</if>
			<if test="record.parentId != null and !&quot;&quot;.equals(record.parentId)">
				and parent_id = #{record.parentId}	
			</if>
			<if test="record.parentIds != null and !&quot;&quot;.equals(record.parentIds)">
				and parent_ids = #{record.parentIds}	
			</if>
			<if test="record.name != null and !&quot;&quot;.equals(record.name)">
				and name = #{record.name}	
			</if>
			<if test="record.sort != null and !&quot;&quot;.equals(record.sort)">
				and sort = #{record.sort}	
			</if>
			<if test="record.href != null and !&quot;&quot;.equals(record.href)">
				and href = #{record.href}	
			</if>
			<if test="record.target != null and !&quot;&quot;.equals(record.target)">
				and target = #{record.target}	
			</if>
			<if test="record.icon != null and !&quot;&quot;.equals(record.icon)">
				and icon = #{record.icon}	
			</if>
			<if test="record.isShow != null and !&quot;&quot;.equals(record.isShow)">
				and is_show = #{record.isShow}	
			</if>
			<if test="record.permission != null and !&quot;&quot;.equals(record.permission)">
				and permission = #{record.permission}	
			</if>
			<if test="record.createBy != null and !&quot;&quot;.equals(record.createBy)">
				and create_by = #{record.createBy}	
			</if>
			<if test="record.createDate != null and !&quot;&quot;.equals(record.createDate)">
				and create_date = #{record.createDate}	
			</if>
			<if test="record.updateBy != null and !&quot;&quot;.equals(record.updateBy)">
				and update_by = #{record.updateBy}	
			</if>
			<if test="record.updateDate != null and !&quot;&quot;.equals(record.updateDate)">
				and update_date = #{record.updateDate}	
			</if>
			<if test="record.remarks != null and !&quot;&quot;.equals(record.remarks)">
				and remarks = #{record.remarks}	
			</if>
			<if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
				and del_flag = #{record.delFlag}	
			</if>
			<if test="record.menuType != null and !&quot;&quot;.equals(record.menuType)">
				and menu_type = #{record.menuType}	
			</if>
		</where>
		order by id desc
	</select>
	<select id="queryAllSysMenu" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.SysMenu">
		select <include refid="Base_Column_List"/> from sys_menu
		<where>
			and del_flag = 'N'
			<if test="id != null and !&quot;&quot;.equals(id)">
				and id = #{id}	
			</if>
			<if test="parentId != null and !&quot;&quot;.equals(parentId)">
				and parent_id = #{parentId}	
			</if>
			<if test="parentIds != null and !&quot;&quot;.equals(parentIds)">
				and parent_ids = #{parentIds}	
			</if>
			<if test="name != null and !&quot;&quot;.equals(name)">
				and name = #{name}	
			</if>
			<if test="sort != null and !&quot;&quot;.equals(sort)">
				and sort = #{sort}	
			</if>
			<if test="href != null and !&quot;&quot;.equals(href)">
				and href = #{href}	
			</if>
			<if test="target != null and !&quot;&quot;.equals(target)">
				and target = #{target}	
			</if>
			<if test="icon != null and !&quot;&quot;.equals(icon)">
				and icon = #{icon}	
			</if>
			<if test="isShow != null and !&quot;&quot;.equals(isShow)">
				and is_show = #{isShow}	
			</if>
			<if test="permission != null and !&quot;&quot;.equals(permission)">
				and permission = #{permission}	
			</if>
			<if test="createBy != null and !&quot;&quot;.equals(createBy)">
				and create_by = #{createBy}	
			</if>
			<if test="createDate != null and !&quot;&quot;.equals(createDate)">
				and create_date = #{createDate}	
			</if>
			<if test="updateBy != null and !&quot;&quot;.equals(updateBy)">
				and update_by = #{updateBy}	
			</if>
			<if test="updateDate != null and !&quot;&quot;.equals(updateDate)">
				and update_date = #{updateDate}	
			</if>
			<if test="remarks != null and !&quot;&quot;.equals(remarks)">
				and remarks = #{remarks}	
			</if>
			<if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
				and del_flag = #{delFlag}	
			</if>
			<if test="menuType != null and !&quot;&quot;.equals(menuType)">
				and menu_type = #{menuType}	
			</if>
		</where>
		order by id desc
	</select>
	<select id="querySysMenu" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.SysMenu">
		select <include refid="Base_Column_List"/> from sys_menu
		<where>
			and del_flag = 'N'
			<if test="id != null and !&quot;&quot;.equals(id)">
				and id = #{id}	
			</if>
			<if test="parentId != null and !&quot;&quot;.equals(parentId)">
				and parent_id = #{parentId}	
			</if>
			<if test="parentIds != null and !&quot;&quot;.equals(parentIds)">
				and parent_ids = #{parentIds}	
			</if>
			<if test="name != null and !&quot;&quot;.equals(name)">
				and name = #{name}	
			</if>
			<if test="sort != null and !&quot;&quot;.equals(sort)">
				and sort = #{sort}	
			</if>
			<if test="href != null and !&quot;&quot;.equals(href)">
				and href = #{href}	
			</if>
			<if test="target != null and !&quot;&quot;.equals(target)">
				and target = #{target}	
			</if>
			<if test="icon != null and !&quot;&quot;.equals(icon)">
				and icon = #{icon}	
			</if>
			<if test="isShow != null and !&quot;&quot;.equals(isShow)">
				and is_show = #{isShow}	
			</if>
			<if test="permission != null and !&quot;&quot;.equals(permission)">
				and permission = #{permission}	
			</if>
			<if test="createBy != null and !&quot;&quot;.equals(createBy)">
				and create_by = #{createBy}	
			</if>
			<if test="createDate != null and !&quot;&quot;.equals(createDate)">
				and create_date = #{createDate}	
			</if>
			<if test="updateBy != null and !&quot;&quot;.equals(updateBy)">
				and update_by = #{updateBy}	
			</if>
			<if test="updateDate != null and !&quot;&quot;.equals(updateDate)">
				and update_date = #{updateDate}	
			</if>
			<if test="remarks != null and !&quot;&quot;.equals(remarks)">
				and remarks = #{remarks}	
			</if>
			<if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
				and del_flag = #{delFlag}	
			</if>
			<if test="menuType != null and !&quot;&quot;.equals(menuType)">
				and menu_type = #{menuType}	
			</if>
		</where>
		LIMIT 1
	</select>
	<update id="delete">
		UPDATE sys_menu SET del_flag = 'Y'
		<where>
			AND id = #{id}
		</where>
	</update>
</mapper>

