<?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.user.dao.ibatis.UserDaoImpl">
    
	<!-- 字段和属性映射 -->
	<resultMap type="UserEntity" id="UserEntity-Map">
		<result property="id" column="id" />
		<result property="loginName" column="loginName" />
		<result property="loginPwd" column="loginPwd" />
		<result property="loginPwd1" column="loginPwd1" />
		<result property="loginPwd2" column="loginPwd2" />
		<result property="loginPwd3" column="loginPwd3" />
		<result property="loginLimitAddress" column="loginLimitAddress" />
		<result property="realName" column="realName" />
		<result property="mobile" column="mobile" />
		<result property="phone" column="phone" />
		<result property="email" column="email" />
		<result property="qq" column="qq" />
		<result property="userType" column="userType" />
		<result property="status" column="status" />
		<result property="customerId" column="customerId" />
		<result property="createTime" column="createTime" />
		<result property="createUserId" column="createUserId" />
		<result property="createUserName" column="createUserName" />
		<result property="lastLoginTime" column="lastLoginTime" />
		<result property="lastLoginAddress" column="lastLoginAddress" />
		<result property="lastModPwdTime" column="lastModPwdTime" />
		<result property="lastModPwdAddr" column="lastModPwdAddr" />
	</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('loginName') or colPickMode == 1 and data.containsKey('loginName')))">
				a.loginName as loginName,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginPwd') or colPickMode == 1 and data.containsKey('loginPwd')))">
				a.loginPwd as loginPwd,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginPwd1') or colPickMode == 1 and data.containsKey('loginPwd1')))">
				a.loginPwd1 as loginPwd1,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginPwd2') or colPickMode == 1 and data.containsKey('loginPwd2')))">
				a.loginPwd2 as loginPwd2,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginPwd3') or colPickMode == 1 and data.containsKey('loginPwd3')))">
				a.loginPwd3 as loginPwd3,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('loginLimitAddress') or colPickMode == 1 and data.containsKey('loginLimitAddress')))">
				a.loginLimitAddress as loginLimitAddress,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('realName') or colPickMode == 1 and data.containsKey('realName')))">
				a.realName as realName,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('mobile') or colPickMode == 1 and data.containsKey('mobile')))">
				a.mobile as mobile,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('phone') or colPickMode == 1 and data.containsKey('phone')))">
				a.phone as phone,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('email') or colPickMode == 1 and data.containsKey('email')))">
				a.email as email,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('qq') or colPickMode == 1 and data.containsKey('qq')))">
				a.qq as qq,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('userType') or colPickMode == 1 and data.containsKey('userType')))">
				a.userType as userType,
			</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('customerId') or colPickMode == 1 and data.containsKey('customerId')))">
				a.customerId as customerId,
			</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>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginTime') or colPickMode == 1 and data.containsKey('lastLoginTime')))">
				a.lastLoginTime as lastLoginTime,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginAddress') or colPickMode == 1 and data.containsKey('lastLoginAddress')))">
				a.lastLoginAddress as lastLoginAddress,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastModPwdTime') or colPickMode == 1 and data.containsKey('lastModPwdTime')))">
				a.lastModPwdTime as lastModPwdTime,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastModPwdAddr') or colPickMode == 1 and data.containsKey('lastModPwdAddr')))">
				a.lastModPwdAddr as lastModPwdAddr,
			</if>
		</trim>
	</sql>
	<!-- 新增 -->
	<insert id="insert" parameterType="UserEntity" useGeneratedKeys="true" keyProperty="id">
		insert into mortals_xhx_user 
		(id,loginName,loginPwd,loginPwd1,loginPwd2,loginPwd3,
			loginLimitAddress,realName,mobile,phone,email,
			qq,userType,status,customerId,createTime,
			createUserId,createUserName,lastLoginTime,lastLoginAddress,lastModPwdTime,
			lastModPwdAddr
		)VALUES(#{id},#{loginName},#{loginPwd},#{loginPwd1},#{loginPwd2},#{loginPwd3},
			#{loginLimitAddress},#{realName},#{mobile},#{phone},#{email},
			#{qq},#{userType},#{status},#{customerId},#{createTime},
			#{createUserId},#{createUserName},#{lastLoginTime},#{lastLoginAddress},#{lastModPwdTime},
			#{lastModPwdAddr})
	</insert>
	<!-- 批量新增 -->
	<insert id="insertBatch" parameterType="paramDto">
		insert into mortals_xhx_user 
		(loginName,loginPwd,loginPwd1,loginPwd2,loginPwd3,
			loginLimitAddress,realName,mobile,phone,email,
			qq,userType,status,customerId,createTime,
			createUserId,createUserName,lastLoginTime,lastLoginAddress,lastModPwdTime,
			lastModPwdAddr
		)
		VALUES
		<foreach collection="data.dataList" item="item" index="index" separator="," >  
		(#{item.loginName},#{item.loginPwd},#{item.loginPwd1},#{item.loginPwd2},#{item.loginPwd3},
			#{item.loginLimitAddress},#{item.realName},#{item.mobile},#{item.phone},#{item.email},
			#{item.qq},#{item.userType},#{item.status},#{item.customerId},#{item.createTime},
			#{item.createUserId},#{item.createUserName},#{item.lastLoginTime},#{item.lastLoginAddress},#{item.lastModPwdTime},
			#{item.lastModPwdAddr})
		</foreach>
	</insert>
	<!-- 根据ParamDto更新 -->
	<update id="update" parameterType="paramDto">
		update mortals_xhx_user as a
		   set
		   <trim suffixOverrides="," suffix="">
				<if test="(colPickMode==0 and data.containsKey('loginName')) or (colPickMode==1 and !data.containsKey('loginName'))">
					a.loginName=#{data.loginName},
				</if>
				<if test="(colPickMode==0 and data.containsKey('loginPwd')) or (colPickMode==1 and !data.containsKey('loginPwd'))">
					a.loginPwd=#{data.loginPwd},
				</if>
				<if test="(colPickMode==0 and data.containsKey('loginPwd1')) or (colPickMode==1 and !data.containsKey('loginPwd1'))">
					a.loginPwd1=#{data.loginPwd1},
				</if>
				<if test="(colPickMode==0 and data.containsKey('loginPwd2')) or (colPickMode==1 and !data.containsKey('loginPwd2'))">
					a.loginPwd2=#{data.loginPwd2},
				</if>
				<if test="(colPickMode==0 and data.containsKey('loginPwd3')) or (colPickMode==1 and !data.containsKey('loginPwd3'))">
					a.loginPwd3=#{data.loginPwd3},
				</if>
				<if test="(colPickMode==0 and data.containsKey('loginLimitAddress')) or (colPickMode==1 and !data.containsKey('loginLimitAddress'))">
					a.loginLimitAddress=#{data.loginLimitAddress},
				</if>
				<if test="(colPickMode==0 and data.containsKey('realName')) or (colPickMode==1 and !data.containsKey('realName'))">
					a.realName=#{data.realName},
				</if>
				<if test="(colPickMode==0 and data.containsKey('mobile')) or (colPickMode==1 and !data.containsKey('mobile'))">
					a.mobile=#{data.mobile},
				</if>
				<if test="(colPickMode==0 and data.containsKey('phone')) or (colPickMode==1 and !data.containsKey('phone'))">
					a.phone=#{data.phone},
				</if>
				<if test="(colPickMode==0 and data.containsKey('email')) or (colPickMode==1 and !data.containsKey('email'))">
					a.email=#{data.email},
				</if>
				<if test="(colPickMode==0 and data.containsKey('qq')) or (colPickMode==1 and !data.containsKey('qq'))">
					a.qq=#{data.qq},
				</if>
				<if test="(colPickMode==0 and data.containsKey('userType')) or (colPickMode==1 and !data.containsKey('userType'))">
					a.userType=#{data.userType},
				</if>
				<if test="(colPickMode==0 and data.containsKey('userTypeIncrement')) or (colPickMode==1 and !data.containsKey('userTypeIncrement'))">
					a.userType=ifnull(a.userType,0) + #{data.userTypeIncrement},
				</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('customerId')) or (colPickMode==1 and !data.containsKey('customerId'))">
					a.customerId=#{data.customerId},
				</if>
				<if test="(colPickMode==0 and data.containsKey('customerIdIncrement')) or (colPickMode==1 and !data.containsKey('customerIdIncrement'))">
					a.customerId=ifnull(a.customerId,0) + #{data.customerIdIncrement},
				</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>
				<if test="(colPickMode==0 and data.containsKey('lastLoginTime')) or (colPickMode==1 and !data.containsKey('lastLoginTime'))">
					a.lastLoginTime=#{data.lastLoginTime},
				</if>
				<if test="(colPickMode==0 and data.containsKey('lastLoginAddress')) or (colPickMode==1 and !data.containsKey('lastLoginAddress'))">
					a.lastLoginAddress=#{data.lastLoginAddress},
				</if>
				<if test="(colPickMode==0 and data.containsKey('lastModPwdTime')) or (colPickMode==1 and !data.containsKey('lastModPwdTime'))">
					a.lastModPwdTime=#{data.lastModPwdTime},
				</if>
				<if test="(colPickMode==0 and data.containsKey('lastModPwdAddr')) or (colPickMode==1 and !data.containsKey('lastModPwdAddr'))">
					a.lastModPwdAddr=#{data.lastModPwdAddr},
				</if>
		    </trim>
		   <trim suffixOverrides="where" suffix="">
			    where
			    <trim prefixOverrides="and" prefix="">
					<include refid="_condition_"/>
			   	</trim>
			</trim>
	</update>

	<!-- 根据主健查询 -->
	<select id="getByKey" parameterType="paramDto" resultMap="UserEntity-Map">
		select <include refid="_columns"/>
		from mortals_xhx_user as a
	   where a.id=#{condition.id}
	</select>
	<!-- 根据主健删除 -->
	<delete id="deleteByKey" parameterType="paramDto">
		delete a.* from mortals_xhx_user as a where a.id=#{condition.id}
	</delete>
	<!-- 根据主健删除一批，针对单一主健有效 -->
	<delete id="deleteByKeys">
		delete from mortals_xhx_user 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_user as a
		<trim suffixOverrides="where" suffix="">
			 where 
			<trim prefixOverrides="and" prefix="">
				<include refid="_condition_"/>
			</trim>
		</trim>
	</delete>
	<!-- 获取列表 -->
	<select id="getList" parameterType="paramDto" resultMap="UserEntity-Map">
		select <include refid="_columns"/>
		  from mortals_xhx_user 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_user 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('loginName')">
					<if test="condition.loginName != null and condition.loginName != ''">
						and a.loginName like #{condition.loginName}
					</if>
					<if test="condition.loginName == null">
						and a.loginName is null
					</if>
				</if>
				<if test="condition.containsKey('loginNameList')">
					 and a.loginName in 
					<foreach collection="condition.loginNameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('loginPwd')">
					<if test="condition.loginPwd != null and condition.loginPwd != ''">
						and a.loginPwd like #{condition.loginPwd}
					</if>
					<if test="condition.loginPwd == null">
						and a.loginPwd is null
					</if>
				</if>
				<if test="condition.containsKey('loginPwdList')">
					 and a.loginPwd in 
					<foreach collection="condition.loginPwdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('loginPwd1')">
					<if test="condition.loginPwd1 != null and condition.loginPwd1 != ''">
						and a.loginPwd1 like #{condition.loginPwd1}
					</if>
					<if test="condition.loginPwd1 == null">
						and a.loginPwd1 is null
					</if>
				</if>
				<if test="condition.containsKey('loginPwd1List')">
					 and a.loginPwd1 in 
					<foreach collection="condition.loginPwd1List" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('loginPwd2')">
					<if test="condition.loginPwd2 != null and condition.loginPwd2 != ''">
						and a.loginPwd2 like #{condition.loginPwd2}
					</if>
					<if test="condition.loginPwd2 == null">
						and a.loginPwd2 is null
					</if>
				</if>
				<if test="condition.containsKey('loginPwd2List')">
					 and a.loginPwd2 in 
					<foreach collection="condition.loginPwd2List" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('loginPwd3')">
					<if test="condition.loginPwd3 != null and condition.loginPwd3 != ''">
						and a.loginPwd3 like #{condition.loginPwd3}
					</if>
					<if test="condition.loginPwd3 == null">
						and a.loginPwd3 is null
					</if>
				</if>
				<if test="condition.containsKey('loginPwd3List')">
					 and a.loginPwd3 in 
					<foreach collection="condition.loginPwd3List" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('loginLimitAddress')">
					<if test="condition.loginLimitAddress != null and condition.loginLimitAddress != ''">
						and a.loginLimitAddress like #{condition.loginLimitAddress}
					</if>
					<if test="condition.loginLimitAddress == null">
						and a.loginLimitAddress is null
					</if>
				</if>
				<if test="condition.containsKey('loginLimitAddressList')">
					 and a.loginLimitAddress in 
					<foreach collection="condition.loginLimitAddressList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('realName')">
					<if test="condition.realName != null and condition.realName != ''">
						and a.realName like #{condition.realName}
					</if>
					<if test="condition.realName == null">
						and a.realName is null
					</if>
				</if>
				<if test="condition.containsKey('realNameList')">
					 and a.realName in 
					<foreach collection="condition.realNameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('mobile')">
					<if test="condition.mobile != null and condition.mobile != ''">
						and a.mobile like #{condition.mobile}
					</if>
					<if test="condition.mobile == null">
						and a.mobile is null
					</if>
				</if>
				<if test="condition.containsKey('mobileList')">
					 and a.mobile in 
					<foreach collection="condition.mobileList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('phone')">
					<if test="condition.phone != null and condition.phone != ''">
						and a.phone like #{condition.phone}
					</if>
					<if test="condition.phone == null">
						and a.phone is null
					</if>
				</if>
				<if test="condition.containsKey('phoneList')">
					 and a.phone in 
					<foreach collection="condition.phoneList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('email')">
					<if test="condition.email != null and condition.email != ''">
						and a.email like #{condition.email}
					</if>
					<if test="condition.email == null">
						and a.email is null
					</if>
				</if>
				<if test="condition.containsKey('emailList')">
					 and a.email in 
					<foreach collection="condition.emailList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('qq')">
					<if test="condition.qq != null and condition.qq != ''">
						and a.qq like #{condition.qq}
					</if>
					<if test="condition.qq == null">
						and a.qq is null
					</if>
				</if>
				<if test="condition.containsKey('qqList')">
					 and a.qq in 
					<foreach collection="condition.qqList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('userType')">
					<if test="condition.userType != null ">
						and a.userType = #{condition.userType}
					</if>
					<if test="condition.userType == null">
						and a.userType is null
					</if>
				</if>
				<if test="condition.containsKey('userTypeList')">
					 and a.userType in 
					<foreach collection="condition.userTypeList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('userTypeStart') and condition.userTypeStart != null">
					<![CDATA[ and a.userType >= #{condition.userTypeStart} ]]>
				</if>
				<if test="condition.containsKey('userTypeEnd') and condition.userTypeEnd != null">
					<![CDATA[ and a.userType <= #{condition.userTypeEnd} ]]>
				</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('customerId')">
					<if test="condition.customerId != null ">
						and a.customerId = #{condition.customerId}
					</if>
					<if test="condition.customerId == null">
						and a.customerId is null
					</if>
				</if>
				<if test="condition.containsKey('customerIdList')">
					 and a.customerId in 
					<foreach collection="condition.customerIdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('customerIdStart') and condition.customerIdStart != null">
					<![CDATA[ and a.customerId >= #{condition.customerIdStart} ]]>
				</if>
				<if test="condition.containsKey('customerIdEnd') and condition.customerIdEnd != null">
					<![CDATA[ and a.customerId <= #{condition.customerIdEnd} ]]>
				</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 test="condition.containsKey('lastLoginTime')">
					<if test="condition.lastLoginTime != null ">
						and a.lastLoginTime = #{condition.lastLoginTime}
					</if>
					<if test="condition.lastLoginTime == null">
						and a.lastLoginTime is null
					</if>
				</if>
				<if test="condition.containsKey('lastLoginTimeStart') and condition.lastLoginTimeStart != null and condition.lastLoginTimeStart!=''">
					<![CDATA[ and a.lastLoginTime >= STR_TO_DATE(left(concat(#{condition.lastLoginTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('lastLoginTimeEnd') and condition.lastLoginTimeEnd != null and condition.lastLoginTimeEnd!=''">
					<![CDATA[ and a.lastLoginTime <= STR_TO_DATE(left(concat(#{condition.lastLoginTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('lastLoginAddress')">
					<if test="condition.lastLoginAddress != null and condition.lastLoginAddress != ''">
						and a.lastLoginAddress like #{condition.lastLoginAddress}
					</if>
					<if test="condition.lastLoginAddress == null">
						and a.lastLoginAddress is null
					</if>
				</if>
				<if test="condition.containsKey('lastLoginAddressList')">
					 and a.lastLoginAddress in 
					<foreach collection="condition.lastLoginAddressList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('lastModPwdTime')">
					<if test="condition.lastModPwdTime != null ">
						and a.lastModPwdTime = #{condition.lastModPwdTime}
					</if>
					<if test="condition.lastModPwdTime == null">
						and a.lastModPwdTime is null
					</if>
				</if>
				<if test="condition.containsKey('lastModPwdTimeStart') and condition.lastModPwdTimeStart != null and condition.lastModPwdTimeStart!=''">
					<![CDATA[ and a.lastModPwdTime >= STR_TO_DATE(left(concat(#{condition.lastModPwdTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('lastModPwdTimeEnd') and condition.lastModPwdTimeEnd != null and condition.lastModPwdTimeEnd!=''">
					<![CDATA[ and a.lastModPwdTime <= STR_TO_DATE(left(concat(#{condition.lastModPwdTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('lastModPwdAddr')">
					<if test="condition.lastModPwdAddr != null and condition.lastModPwdAddr != ''">
						and a.lastModPwdAddr like #{condition.lastModPwdAddr}
					</if>
					<if test="condition.lastModPwdAddr == null">
						and a.lastModPwdAddr is null
					</if>
				</if>
				<if test="condition.containsKey('lastModPwdAddrList')">
					 and a.lastModPwdAddr in 
					<foreach collection="condition.lastModPwdAddrList" 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('loginName')">
					a.loginName
					<if test="orderCol.loginName!= null">
						${orderCol.loginName}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('loginPwd')">
					a.loginPwd
					<if test="orderCol.loginPwd!= null">
						${orderCol.loginPwd}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('loginPwd1')">
					a.loginPwd1
					<if test="orderCol.loginPwd1!= null">
						${orderCol.loginPwd1}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('loginPwd2')">
					a.loginPwd2
					<if test="orderCol.loginPwd2!= null">
						${orderCol.loginPwd2}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('loginPwd3')">
					a.loginPwd3
					<if test="orderCol.loginPwd3!= null">
						${orderCol.loginPwd3}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('loginLimitAddress')">
					a.loginLimitAddress
					<if test="orderCol.loginLimitAddress!= null">
						${orderCol.loginLimitAddress}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('realName')">
					a.realName
					<if test="orderCol.realName!= null">
						${orderCol.realName}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('mobile')">
					a.mobile
					<if test="orderCol.mobile!= null">
						${orderCol.mobile}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('phone')">
					a.phone
					<if test="orderCol.phone!= null">
						${orderCol.phone}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('email')">
					a.email
					<if test="orderCol.email!= null">
						${orderCol.email}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('qq')">
					a.qq
					<if test="orderCol.qq!= null">
						${orderCol.qq}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('userType')">
					a.userType
					<if test="orderCol.userType!= null">
						${orderCol.userType}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('status')">
					a.status
					<if test="orderCol.status!= null">
						${orderCol.status}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('customerId')">
					a.customerId
					<if test="orderCol.customerId!= null">
						${orderCol.customerId}
					</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>
				<if test="orderCol.containsKey('lastLoginTime')">
					a.lastLoginTime
					<if test="orderCol.lastLoginTime!= null">
						${orderCol.lastLoginTime}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('lastLoginAddress')">
					a.lastLoginAddress
					<if test="orderCol.lastLoginAddress!= null">
						${orderCol.lastLoginAddress}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('lastModPwdTime')">
					a.lastModPwdTime
					<if test="orderCol.lastModPwdTime!= null">
						${orderCol.lastModPwdTime}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('lastModPwdAddr')">
					a.lastModPwdAddr
					<if test="orderCol.lastModPwdAddr!= null">
						${orderCol.lastModPwdAddr}
					</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>