<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.base.system.menu.dao.ibatis.MenuDaoImpl">
    
	<!-- 字段和属性映射 -->
	<resultMap type="MenuEntity" id="MenuEntity-Map">
		<result property="id" column="id" />
		<result property="name" column="name" />
		<result property="url" column="url" />
		<result property="parentId" column="parentId" />
		<result property="orderId" column="orderId" />
		<result property="status" column="status" />
		<result property="linkType" column="linkType" />
		<result property="groupId" column="groupId" />
		<result property="groupName" column="groupName" />
		<result property="imgPath" column="imgPath" />
		<result property="buttonImgPath" column="buttonImgPath" />
		<result property="imgCommPath" column="imgCommPath" />
		<result property="commMenu" column="commMenu" />
		<result property="menuType" column="menuType" />
		<result property="authType" column="authType" />
		<result property="createTime" column="createTime" />
		<result property="createUserId" column="createUserId" />
		<result property="createUserName" column="createUserName" />
	</resultMap>
	
	
	
	<!-- 表所有列 -->
	<sql id="_columns">
		<trim suffixOverrides="," suffix="">
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
				a.id as id,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('name') or colPickMode == 1 and data.containsKey('name')))">
				a.name as name,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('url') or colPickMode == 1 and data.containsKey('url')))">
				a.url as url,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('parentId') or colPickMode == 1 and data.containsKey('parentId')))">
				a.parentId as parentId,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('orderId') or colPickMode == 1 and data.containsKey('orderId')))">
				a.orderId as orderId,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))">
				a.status as status,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('linkType') or colPickMode == 1 and data.containsKey('linkType')))">
				a.linkType as linkType,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('groupId') or colPickMode == 1 and data.containsKey('groupId')))">
				a.groupId as groupId,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('groupName') or colPickMode == 1 and data.containsKey('groupName')))">
				a.groupName as groupName,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('imgPath') or colPickMode == 1 and data.containsKey('imgPath')))">
				a.imgPath as imgPath,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('buttonImgPath') or colPickMode == 1 and data.containsKey('buttonImgPath')))">
				a.buttonImgPath as buttonImgPath,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('imgCommPath') or colPickMode == 1 and data.containsKey('imgCommPath')))">
				a.imgCommPath as imgCommPath,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('commMenu') or colPickMode == 1 and data.containsKey('commMenu')))">
				a.commMenu as commMenu,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('menuType') or colPickMode == 1 and data.containsKey('menuType')))">
				a.menuType as menuType,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('authType') or colPickMode == 1 and data.containsKey('authType')))">
				a.authType as authType,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
				a.createTime as createTime,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
				a.createUserId as createUserId,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserName') or colPickMode == 1 and data.containsKey('createUserName')))">
				a.createUserName as createUserName,
			</if>
		</trim>
	</sql>
	<!-- 新增 -->
	<insert id="insert" parameterType="MenuEntity" useGeneratedKeys="true" keyProperty="id">
		insert into mortals_xhx_menu 
		(name,url,parentId,orderId,status,
			linkType,groupId,groupName,imgPath,buttonImgPath,
			imgCommPath,commMenu,menuType,authType,createTime,
			createUserId,createUserName
		)VALUES(#{name},#{url},#{parentId},#{orderId},#{status},
			#{linkType},#{groupId},#{groupName},#{imgPath},#{buttonImgPath},
			#{imgCommPath},#{commMenu},#{menuType},#{authType},#{createTime},
			#{createUserId},#{createUserName})
	</insert>
	<!-- 批量新增 -->
	<insert id="insertBatch" parameterType="paramDto">
		insert into mortals_xhx_menu 
		(name,url,parentId,orderId,status,
			linkType,groupId,groupName,imgPath,buttonImgPath,
			imgCommPath,commMenu,menuType,authType,createTime,
			createUserId,createUserName
		)
		VALUES
		<foreach collection="data.dataList" item="item" index="index" separator="," >  
		(#{item.name},#{item.url},#{item.parentId},#{item.orderId},#{item.status},
			#{item.linkType},#{item.groupId},#{item.groupName},#{item.imgPath},#{item.buttonImgPath},
			#{item.imgCommPath},#{item.commMenu},#{item.menuType},#{item.authType},#{item.createTime},
			#{item.createUserId},#{item.createUserName})
		</foreach>
	</insert>
	<!-- 根据ParamDto更新 -->
	<update id="update" parameterType="paramDto">
		update mortals_xhx_menu as a
		   set
		   <trim suffixOverrides="," suffix="">
				<if test="(colPickMode==0 and data.containsKey('name')) or (colPickMode==1 and !data.containsKey('name'))">
					a.name=#{data.name},
				</if>
				<if test="(colPickMode==0 and data.containsKey('url')) or (colPickMode==1 and !data.containsKey('url'))">
					a.url=#{data.url},
				</if>
				<if test="(colPickMode==0 and data.containsKey('parentId')) or (colPickMode==1 and !data.containsKey('parentId'))">
					a.parentId=#{data.parentId},
				</if>
				<if test="(colPickMode==0 and data.containsKey('parentIdIncrement')) or (colPickMode==1 and !data.containsKey('parentIdIncrement'))">
					a.parentId=ifnull(a.parentId,0) + #{data.parentIdIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('orderId')) or (colPickMode==1 and !data.containsKey('orderId'))">
					a.orderId=#{data.orderId},
				</if>
				<if test="(colPickMode==0 and data.containsKey('orderIdIncrement')) or (colPickMode==1 and !data.containsKey('orderIdIncrement'))">
					a.orderId=ifnull(a.orderId,0) + #{data.orderIdIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))">
					a.status=#{data.status},
				</if>
				<if test="(colPickMode==0 and data.containsKey('statusIncrement')) or (colPickMode==1 and !data.containsKey('statusIncrement'))">
					a.status=ifnull(a.status,0) + #{data.statusIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('linkType')) or (colPickMode==1 and !data.containsKey('linkType'))">
					a.linkType=#{data.linkType},
				</if>
				<if test="(colPickMode==0 and data.containsKey('linkTypeIncrement')) or (colPickMode==1 and !data.containsKey('linkTypeIncrement'))">
					a.linkType=ifnull(a.linkType,0) + #{data.linkTypeIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('groupId')) or (colPickMode==1 and !data.containsKey('groupId'))">
					a.groupId=#{data.groupId},
				</if>
				<if test="(colPickMode==0 and data.containsKey('groupIdIncrement')) or (colPickMode==1 and !data.containsKey('groupIdIncrement'))">
					a.groupId=ifnull(a.groupId,0) + #{data.groupIdIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('groupName')) or (colPickMode==1 and !data.containsKey('groupName'))">
					a.groupName=#{data.groupName},
				</if>
				<if test="(colPickMode==0 and data.containsKey('imgPath')) or (colPickMode==1 and !data.containsKey('imgPath'))">
					a.imgPath=#{data.imgPath},
				</if>
				<if test="(colPickMode==0 and data.containsKey('buttonImgPath')) or (colPickMode==1 and !data.containsKey('buttonImgPath'))">
					a.buttonImgPath=#{data.buttonImgPath},
				</if>
				<if test="(colPickMode==0 and data.containsKey('imgCommPath')) or (colPickMode==1 and !data.containsKey('imgCommPath'))">
					a.imgCommPath=#{data.imgCommPath},
				</if>
				<if test="(colPickMode==0 and data.containsKey('commMenu')) or (colPickMode==1 and !data.containsKey('commMenu'))">
					a.commMenu=#{data.commMenu},
				</if>
				<if test="(colPickMode==0 and data.containsKey('commMenuIncrement')) or (colPickMode==1 and !data.containsKey('commMenuIncrement'))">
					a.commMenu=ifnull(a.commMenu,0) + #{data.commMenuIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('menuType')) or (colPickMode==1 and !data.containsKey('menuType'))">
					a.menuType=#{data.menuType},
				</if>
				<if test="(colPickMode==0 and data.containsKey('menuTypeIncrement')) or (colPickMode==1 and !data.containsKey('menuTypeIncrement'))">
					a.menuType=ifnull(a.menuType,0) + #{data.menuTypeIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('authType')) or (colPickMode==1 and !data.containsKey('authType'))">
					a.authType=#{data.authType},
				</if>
				<if test="(colPickMode==0 and data.containsKey('authTypeIncrement')) or (colPickMode==1 and !data.containsKey('authTypeIncrement'))">
					a.authType=ifnull(a.authType,0) + #{data.authTypeIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
					a.createTime=#{data.createTime},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
					a.createUserId=#{data.createUserId},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
					a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createUserName')) or (colPickMode==1 and !data.containsKey('createUserName'))">
					a.createUserName=#{data.createUserName},
				</if>
		    </trim>
		   <trim suffixOverrides="where" suffix="">
			    where
			    <trim prefixOverrides="and" prefix="">
					<include refid="_condition_"/>
			   	</trim>
			</trim>
	</update>

	<!-- 根据主健查询 -->
	<select id="getByKey" parameterType="paramDto" resultMap="MenuEntity-Map">
		select <include refid="_columns"/>
		from mortals_xhx_menu as a
	   where a.id=#{condition.id}
	</select>
	<!-- 根据主健删除 -->
	<delete id="deleteByKey" parameterType="paramDto">
		delete a.* from mortals_xhx_menu as a where a.id=#{condition.id}
	</delete>
	<!-- 根据主健删除一批，针对单一主健有效 -->
	<delete id="deleteByKeys">
		delete from mortals_xhx_menu where id in
		<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
			#{item}
		</foreach>
	</delete>
	<!-- 根据paramDto删除一批 -->
	<delete id="deleteByMap" parameterType="paramDto">
		delete a.* from mortals_xhx_menu as a
		<trim suffixOverrides="where" suffix="">
			 where 
			<trim prefixOverrides="and" prefix="">
				<include refid="_condition_"/>
			</trim>
		</trim>
	</delete>
	<!-- 获取列表 -->
	<select id="getList" parameterType="paramDto" resultMap="MenuEntity-Map">
		select <include refid="_columns"/>
		  from mortals_xhx_menu as a
		 <trim suffixOverrides="where" suffix="">
			 where 
			 <trim prefixOverrides="and" prefix="">
			 	<include refid="_condition_"/>
			 </trim>
		 </trim>
		 <include refid="_orderCols_"/>
	</select>
	<!-- 获取 -->
	<select id="getListCount" parameterType="paramDto" resultType="int">
		select count(1)
		  from mortals_xhx_menu as a
		 <trim suffixOverrides="where" suffix="">
			 where 
			 <trim prefixOverrides="and" prefix="">
				<include refid="_condition_"/>
			</trim>
		</trim>
	</select>
	
	<!-- 条件映射 -->
	<sql id="_condition_">
		<if test="condition != null and !condition.isEmpty()">
				<if test="condition.containsKey('id')">
					<if test="condition.id != null">
						and a.id=#{condition.id}
					</if>
				</if>
				<if test="condition.containsKey('id')">
					<if test="condition.id != null ">
						and a.id = #{condition.id}
					</if>
					<if test="condition.id == null">
						and a.id is null
					</if>
				</if>
				<if test="condition.containsKey('idList')">
					 and a.id in 
					<foreach collection="condition.idList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('idStart') and condition.idStart != null">
					<![CDATA[ and a.id >= #{condition.idStart} ]]>
				</if>
				<if test="condition.containsKey('idEnd') and condition.idEnd != null">
					<![CDATA[ and a.id <= #{condition.idEnd} ]]>
				</if>
				<if test="condition.containsKey('name')">
					<if test="condition.name != null and condition.name != ''">
						and a.name like #{condition.name}
					</if>
					<if test="condition.name == null">
						and a.name is null
					</if>
				</if>
				<if test="condition.containsKey('nameList')">
					 and a.name in 
					<foreach collection="condition.nameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('url')">
					<if test="condition.url != null and condition.url != ''">
						and a.url like #{condition.url}
					</if>
					<if test="condition.url == null">
						and a.url is null
					</if>
				</if>
				<if test="condition.containsKey('urlList')">
					 and a.url in 
					<foreach collection="condition.urlList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('parentId')">
					<if test="condition.parentId != null ">
						and a.parentId = #{condition.parentId}
					</if>
					<if test="condition.parentId == null">
						and a.parentId is null
					</if>
				</if>
				<if test="condition.containsKey('parentIdList')">
					 and a.parentId in 
					<foreach collection="condition.parentIdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('parentIdStart') and condition.parentIdStart != null">
					<![CDATA[ and a.parentId >= #{condition.parentIdStart} ]]>
				</if>
				<if test="condition.containsKey('parentIdEnd') and condition.parentIdEnd != null">
					<![CDATA[ and a.parentId <= #{condition.parentIdEnd} ]]>
				</if>
				<if test="condition.containsKey('orderId')">
					<if test="condition.orderId != null ">
						and a.orderId = #{condition.orderId}
					</if>
					<if test="condition.orderId == null">
						and a.orderId is null
					</if>
				</if>
				<if test="condition.containsKey('orderIdList')">
					 and a.orderId in 
					<foreach collection="condition.orderIdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('orderIdStart') and condition.orderIdStart != null">
					<![CDATA[ and a.orderId >= #{condition.orderIdStart} ]]>
				</if>
				<if test="condition.containsKey('orderIdEnd') and condition.orderIdEnd != null">
					<![CDATA[ and a.orderId <= #{condition.orderIdEnd} ]]>
				</if>
				<if test="condition.containsKey('status')">
					<if test="condition.status != null ">
						and a.status = #{condition.status}
					</if>
					<if test="condition.status == null">
						and a.status is null
					</if>
				</if>
				<if test="condition.containsKey('statusList')">
					 and a.status in 
					<foreach collection="condition.statusList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('statusStart') and condition.statusStart != null">
					<![CDATA[ and a.status >= #{condition.statusStart} ]]>
				</if>
				<if test="condition.containsKey('statusEnd') and condition.statusEnd != null">
					<![CDATA[ and a.status <= #{condition.statusEnd} ]]>
				</if>
				<if test="condition.containsKey('linkType')">
					<if test="condition.linkType != null ">
						and a.linkType = #{condition.linkType}
					</if>
					<if test="condition.linkType == null">
						and a.linkType is null
					</if>
				</if>
				<if test="condition.containsKey('linkTypeList')">
					 and a.linkType in 
					<foreach collection="condition.linkTypeList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('linkTypeStart') and condition.linkTypeStart != null">
					<![CDATA[ and a.linkType >= #{condition.linkTypeStart} ]]>
				</if>
				<if test="condition.containsKey('linkTypeEnd') and condition.linkTypeEnd != null">
					<![CDATA[ and a.linkType <= #{condition.linkTypeEnd} ]]>
				</if>
				<if test="condition.containsKey('groupId')">
					<if test="condition.groupId != null ">
						and a.groupId = #{condition.groupId}
					</if>
					<if test="condition.groupId == null">
						and a.groupId is null
					</if>
				</if>
				<if test="condition.containsKey('groupIdList')">
					 and a.groupId in 
					<foreach collection="condition.groupIdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('groupIdStart') and condition.groupIdStart != null">
					<![CDATA[ and a.groupId >= #{condition.groupIdStart} ]]>
				</if>
				<if test="condition.containsKey('groupIdEnd') and condition.groupIdEnd != null">
					<![CDATA[ and a.groupId <= #{condition.groupIdEnd} ]]>
				</if>
				<if test="condition.containsKey('groupName')">
					<if test="condition.groupName != null and condition.groupName != ''">
						and a.groupName like #{condition.groupName}
					</if>
					<if test="condition.groupName == null">
						and a.groupName is null
					</if>
				</if>
				<if test="condition.containsKey('groupNameList')">
					 and a.groupName in 
					<foreach collection="condition.groupNameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('imgPath')">
					<if test="condition.imgPath != null and condition.imgPath != ''">
						and a.imgPath like #{condition.imgPath}
					</if>
					<if test="condition.imgPath == null">
						and a.imgPath is null
					</if>
				</if>
				<if test="condition.containsKey('imgPathList')">
					 and a.imgPath in 
					<foreach collection="condition.imgPathList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('buttonImgPath')">
					<if test="condition.buttonImgPath != null and condition.buttonImgPath != ''">
						and a.buttonImgPath like #{condition.buttonImgPath}
					</if>
					<if test="condition.buttonImgPath == null">
						and a.buttonImgPath is null
					</if>
				</if>
				<if test="condition.containsKey('buttonImgPathList')">
					 and a.buttonImgPath in 
					<foreach collection="condition.buttonImgPathList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('imgCommPath')">
					<if test="condition.imgCommPath != null and condition.imgCommPath != ''">
						and a.imgCommPath like #{condition.imgCommPath}
					</if>
					<if test="condition.imgCommPath == null">
						and a.imgCommPath is null
					</if>
				</if>
				<if test="condition.containsKey('imgCommPathList')">
					 and a.imgCommPath in 
					<foreach collection="condition.imgCommPathList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('commMenu')">
					<if test="condition.commMenu != null ">
						and a.commMenu = #{condition.commMenu}
					</if>
					<if test="condition.commMenu == null">
						and a.commMenu is null
					</if>
				</if>
				<if test="condition.containsKey('commMenuList')">
					 and a.commMenu in 
					<foreach collection="condition.commMenuList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('commMenuStart') and condition.commMenuStart != null">
					<![CDATA[ and a.commMenu >= #{condition.commMenuStart} ]]>
				</if>
				<if test="condition.containsKey('commMenuEnd') and condition.commMenuEnd != null">
					<![CDATA[ and a.commMenu <= #{condition.commMenuEnd} ]]>
				</if>
				<if test="condition.containsKey('menuType')">
					<if test="condition.menuType != null ">
						and a.menuType = #{condition.menuType}
					</if>
					<if test="condition.menuType == null">
						and a.menuType is null
					</if>
				</if>
				<if test="condition.containsKey('menuTypeList')">
					 and a.menuType in 
					<foreach collection="condition.menuTypeList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('menuTypeStart') and condition.menuTypeStart != null">
					<![CDATA[ and a.menuType >= #{condition.menuTypeStart} ]]>
				</if>
				<if test="condition.containsKey('menuTypeEnd') and condition.menuTypeEnd != null">
					<![CDATA[ and a.menuType <= #{condition.menuTypeEnd} ]]>
				</if>
				<if test="condition.containsKey('authType')">
					<if test="condition.authType != null ">
						and a.authType = #{condition.authType}
					</if>
					<if test="condition.authType == null">
						and a.authType is null
					</if>
				</if>
				<if test="condition.containsKey('authTypeList')">
					 and a.authType in 
					<foreach collection="condition.authTypeList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('authTypeStart') and condition.authTypeStart != null">
					<![CDATA[ and a.authType >= #{condition.authTypeStart} ]]>
				</if>
				<if test="condition.containsKey('authTypeEnd') and condition.authTypeEnd != null">
					<![CDATA[ and a.authType <= #{condition.authTypeEnd} ]]>
				</if>
				<if test="condition.containsKey('createTime')">
					<if test="condition.createTime != null ">
						and a.createTime = #{condition.createTime}
					</if>
					<if test="condition.createTime == null">
						and a.createTime is null
					</if>
				</if>
				<if test="condition.containsKey('createTimeStart') and condition.createTimeStart != null and condition.createTimeStart!=''">
					<![CDATA[ and a.createTime >= STR_TO_DATE(left(concat(#{condition.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('createTimeEnd') and condition.createTimeEnd != null and condition.createTimeEnd!=''">
					<![CDATA[ and a.createTime <= STR_TO_DATE(left(concat(#{condition.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('createUserId')">
					<if test="condition.createUserId != null ">
						and a.createUserId = #{condition.createUserId}
					</if>
					<if test="condition.createUserId == null">
						and a.createUserId is null
					</if>
				</if>
				<if test="condition.containsKey('createUserIdList')">
					 and a.createUserId in 
					<foreach collection="condition.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('createUserIdStart') and condition.createUserIdStart != null">
					<![CDATA[ and a.createUserId >= #{condition.createUserIdStart} ]]>
				</if>
				<if test="condition.containsKey('createUserIdEnd') and condition.createUserIdEnd != null">
					<![CDATA[ and a.createUserId <= #{condition.createUserIdEnd} ]]>
				</if>
				<if test="condition.containsKey('createUserName')">
					<if test="condition.createUserName != null and condition.createUserName != ''">
						and a.createUserName like #{condition.createUserName}
					</if>
					<if test="condition.createUserName == null">
						and a.createUserName is null
					</if>
				</if>
				<if test="condition.containsKey('createUserNameList')">
					 and a.createUserName in 
					<foreach collection="condition.createUserNameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
		</if>
	</sql>
	<sql id="_orderCols_">
		<if test="orderColList != null and !orderColList.isEmpty()">
	        order by
	        <trim suffixOverrides=","  suffix="">
				<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
						${item.colName} ${item.sortKind}
				</foreach>
			</trim>
		</if>
		<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
			order by
			<trim suffixOverrides=","  suffix="">
				<if test="orderCol.containsKey('id')">
					a.id
					<if test="orderCol.id!= null">
						${orderCol.id}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('name')">
					a.name
					<if test="orderCol.name!= null">
						${orderCol.name}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('url')">
					a.url
					<if test="orderCol.url!= null">
						${orderCol.url}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('parentId')">
					a.parentId
					<if test="orderCol.parentId!= null">
						${orderCol.parentId}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('orderId')">
					a.orderId
					<if test="orderCol.orderId!= null">
						${orderCol.orderId}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('status')">
					a.status
					<if test="orderCol.status!= null">
						${orderCol.status}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('linkType')">
					a.linkType
					<if test="orderCol.linkType!= null">
						${orderCol.linkType}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('groupId')">
					a.groupId
					<if test="orderCol.groupId!= null">
						${orderCol.groupId}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('groupName')">
					a.groupName
					<if test="orderCol.groupName!= null">
						${orderCol.groupName}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('imgPath')">
					a.imgPath
					<if test="orderCol.imgPath!= null">
						${orderCol.imgPath}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('buttonImgPath')">
					a.buttonImgPath
					<if test="orderCol.buttonImgPath!= null">
						${orderCol.buttonImgPath}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('imgCommPath')">
					a.imgCommPath
					<if test="orderCol.imgCommPath!= null">
						${orderCol.imgCommPath}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('commMenu')">
					a.commMenu
					<if test="orderCol.commMenu!= null">
						${orderCol.commMenu}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('menuType')">
					a.menuType
					<if test="orderCol.menuType!= null">
						${orderCol.menuType}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('authType')">
					a.authType
					<if test="orderCol.authType!= null">
						${orderCol.authType}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('createTime')">
					a.createTime
					<if test="orderCol.createTime!= null">
						${orderCol.createTime}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('createUserId')">
					a.createUserId
					<if test="orderCol.createUserId!= null">
						${orderCol.createUserId}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('createUserName')">
					a.createUserName
					<if test="orderCol.createUserName!= null">
						${orderCol.createUserName}
					</if>
					,
				</if>
			</trim>
		</if>
	</sql>
	<sql id="_group_by_">
		<if test="groupList != null and !groupList.isEmpty()">
			GROUP BY
			<trim suffixOverrides=","  suffix="">
				<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
						${item}
				</foreach>
			</trim>
		</if>
	</sql>
</mapper>