<?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.dgtis.dorm.manager.db.dao.AlumniUserMapper" >
  <resultMap id="BaseResultMap" type="com.dgtis.dorm.manager.db.domain.AlumniUser" >
    <result column="id" property="id" jdbcType="INTEGER" />
    <result column="login_id" property="loginId" jdbcType="VARCHAR" />
    <result column="password" property="password" jdbcType="VARCHAR" />
    <result column="en_user_name" property="enUserName" jdbcType="VARCHAR" />
    <result column="user_name" property="userName" jdbcType="VARCHAR" />
    <result column="role_type" property="roleType" jdbcType="VARCHAR" />
    <result column="working" property="working" jdbcType="VARCHAR" />
    <result column="position" property="position" jdbcType="VARCHAR" />
    <result column="place" property="place" jdbcType="VARCHAR" />
    <result column="photo" property="photo" jdbcType="VARCHAR" />
    <result column="sign" property="sign" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="phone" property="phone" jdbcType="VARCHAR" />
    <result column="hidden_gender" property="hiddenGender" jdbcType="BIT" />
    <result column="hidden_email" property="hiddenEmail" jdbcType="BIT" />
    <result column="hidden_posi" property="hiddenPosi" jdbcType="BIT" />
    <result column="hidden_place" property="hiddenPlace" jdbcType="BIT" />
    <result column="hidden_phone" property="hiddenPhone" jdbcType="BIT" />
    <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
    <result column="open_id" property="openId" jdbcType="VARCHAR" />
    <result column="major" property="major" jdbcType="VARCHAR" />
    <result column="reason" property="reason" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    <result column="last_login_time" property="lastLoginTime" jdbcType="TIMESTAMP" />
    <result column="form_id" property="formId" jdbcType="VARCHAR" />
    <result column="audit_data_time" property="auditDataTime" jdbcType="TIMESTAMP" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="postcode" property="postcode" jdbcType="VARCHAR" />
    <result column="annotation" property="annotation" jdbcType="VARCHAR" />

    <result column="p_document_type" property="pDocumentType" jdbcType="VARCHAR" />
    <result column="p_document_num" property="pDocumentNum" jdbcType="VARCHAR" />
    <result column="p_phone" property="pPhone" jdbcType="VARCHAR" />
    <result column="p_email" property="pEmail" jdbcType="VARCHAR" />
    <result column="p_address" property="pAddress" jdbcType="VARCHAR" />
    <result column="l_institution_name" property="lInstitutionName" jdbcType="VARCHAR" />
    <result column="l_institution_type" property="lInstitutionType" jdbcType="VARCHAR" />
    <result column="l_institution_num" property="lInstitutionNum" jdbcType="VARCHAR" />
    <result column="l_username" property="lUsername" jdbcType="VARCHAR" />
    <result column="l_document_type" property="lDocumentType" jdbcType="VARCHAR" />
    <result column="l_document_num" property="lDocumentNum" jdbcType="VARCHAR" />
    <result column="l_phone" property="lPhone" jdbcType="VARCHAR" />
    <result column="l_email" property="lEmail" jdbcType="VARCHAR" />
    <result column="l_address" property="lAddress" jdbcType="VARCHAR" />
    <result column="is_realname" property="isRealname" jdbcType="VARCHAR" />
    <result column="identity" property="identity" jdbcType="VARCHAR" />

  </resultMap>
  
  <sql id="Base_Column_List">
    id, login_id, `password`, en_user_name, user_name,  role_type, gender,
      working, position, place,  photo, sign, email, phone,
    hidden_gender, hidden_email, hidden_posi, hidden_place,
    hidden_phone, audit_status, open_id, major,
    reason, create_date, last_login_time, form_id, audit_data_time, address, postcode, annotation,
    p_document_type,p_document_num,p_phone,p_email,p_address,l_institution_name,l_institution_type,
    l_institution_num,l_username,l_document_type,l_document_num,l_phone,l_email,l_address,is_realname,identity
  </sql>
 
  <insert id="insert" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser" >
    insert into zhll_user (id, login_id, password, en_user_name,
      user_name, role_type, gender,
       working,
      position, place,
      photo, sign, email, 
      phone, hidden_gender, hidden_email, 
      hidden_posi, hidden_place,
      hidden_phone, audit_status,
      open_id, major, reason,
      create_date, last_login_time, form_id, audit_data_time, address, postcode, annotation,is_realname)
    values (#{id,jdbcType=INTEGER}, #{loginId,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{enUserName,jdbcType=VARCHAR},
      #{userName,jdbcType=VARCHAR},  #{roleType,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR},
       #{working,jdbcType=VARCHAR},
      #{position,jdbcType=VARCHAR}, #{place,jdbcType=VARCHAR},
      #{photo,jdbcType=VARCHAR}, #{sign,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, 
      #{phone,jdbcType=VARCHAR}, #{hiddenGender,jdbcType=BIT}, #{hiddenEmail,jdbcType=BIT}, 
      #{hiddenPosi,jdbcType=BIT}, #{hiddenPlace,jdbcType=BIT},
      #{hiddenPhone,jdbcType=BIT},  #{auditStatus,jdbcType=INTEGER},
      #{openId,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR},
       #{reason,jdbcType=VARCHAR},
      #{createDate,jdbcType=TIMESTAMP}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{formId,jdbcType=VARCHAR},
      #{auditDataTime,jdbcType=TIMESTAMP}, #{address,jdbcType=VARCHAR}, #{postcode,jdbcType=VARCHAR},
      #{annotation,jdbcType=VARCHAR},2)
  </insert>

  <insert id="insertSelective" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser" >
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into zhll_user
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="loginId != null" >
        login_id,
      </if>
      <if test="password != null" >
        password,
      </if>
      <if test="enUserName != null" >
        en_user_name,
      </if>
      <if test="userName != null" >
        user_name,
      </if>

      <if test="roleType != null" >
        role_type,
      </if>
      <if test="gender != null" >
        gender,
      </if>

      <if test="working != null" >
        working,
      </if>
      <if test="position != null" >
        position,
      </if>
      <if test="place != null" >
        place,
      </if>

      <if test="photo != null" >
        photo,
      </if>
      <if test="sign != null" >
        sign,
      </if>
      <if test="email != null" >
        email,
      </if>
      <if test="phone != null" >
        phone,
      </if>
      <if test="hiddenGender != null" >
        hidden_gender,
      </if>
      <if test="hiddenEmail != null" >
        hidden_email,
      </if>
      <if test="hiddenPosi != null" >
        hidden_posi,
      </if>
      <if test="hiddenPlace != null" >
        hidden_place,
      </if>

      <if test="hiddenPhone != null" >
        hidden_phone,
      </if>
      <if test="auditStatus != null" >
        audit_status,
      </if>
      <if test="openId != null" >
        open_id,
      </if>
      <if test="major != null" >
        major,
      </if>
      <if test="reason != null" >
        reason,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
      <if test="lastLoginTime != null" >
        last_login_time,
      </if>
      <if test="formId != null" >
        form_id,
      </if>
      <if test="auditDataTime != null" >
        audit_data_time,
      </if>
      <if test="address != null" >
        address,
      </if>
      <if test="postcode != null" >
        postcode,
      </if>
      <if test="annotation != null and annotation != ''" >
        annotation,
      </if>
      <if test="isRealname != null and isRealname != ''" >
        is_realname,
      </if>
      <if test="identity != null and identity != ''" >
        identity,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="loginId != null" >
        #{loginId,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="enUserName != null" >
        #{enUserName,jdbcType=VARCHAR},
      </if>
      <if test="userName != null" >
        #{userName,jdbcType=VARCHAR},
      </if>

      <if test="roleType != null" >
        #{roleType,jdbcType=VARCHAR},
      </if>
      <if test="gender != null" >
        #{gender,jdbcType=VARCHAR},
      </if>

      <if test="working != null" >
        #{working,jdbcType=VARCHAR},
      </if>
      <if test="position != null" >
        #{position,jdbcType=VARCHAR},
      </if>
      <if test="place != null" >
        #{place,jdbcType=VARCHAR},
      </if>

      <if test="photo != null" >
        #{photo,jdbcType=VARCHAR},
      </if>
      <if test="sign != null" >
        #{sign,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="hiddenGender != null" >
        #{hiddenGender,jdbcType=BIT},
      </if>
      <if test="hiddenEmail != null" >
        #{hiddenEmail,jdbcType=BIT},
      </if>
      <if test="hiddenPosi != null" >
        #{hiddenPosi,jdbcType=BIT},
      </if>
      <if test="hiddenPlace != null" >
        #{hiddenPlace,jdbcType=BIT},
      </if>

      <if test="hiddenPhone != null" >
        #{hiddenPhone,jdbcType=BIT},
      </if>
      <if test="auditStatus != null" >
        #{auditStatus,jdbcType=INTEGER},
      </if>
      <if test="openId != null" >
        #{openId,jdbcType=VARCHAR},
      </if>
      <if test="major != null" >
        #{major,jdbcType=VARCHAR},
      </if>
      <if test="reason != null" >
        #{reason,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="lastLoginTime != null" >
        #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="formId != null" >
        #{formId,jdbcType=VARCHAR},
      </if>
      <if test="auditDataTime != null" >
        #{auditDataTime,jdbcType=TIMESTAMP},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="postcode != null" >
        #{postcode,jdbcType=VARCHAR},
      </if>
      <if test="annotation != null and annotation != ''" >
        #{annotation,jdbcType=VARCHAR},
      </if>
      <if test="isRealname != null and isRealname != ''" >
        #{isRealname,jdbcType=VARCHAR},
      </if>
      <if test="identity != null and identity != ''" >
        #{identity,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <select id="selectAlumniUser" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser" resultMap="BaseResultMap" >
  	select
    distinct
    <include refid="Base_Column_List" />
    from zhll_user
    where audit_status != 1 and role_type != '游客'
      <if test="userName != null and userName != '' ">
        and user_name like concat('%', #{userName }, '%')
      </if>
      <if test="phone != null and phone != '' ">
        and phone like concat('%', #{phone }, '%') 
      </if>
      <if test="roleType != null and roleType != '' ">
      	and role_type = #{roleType}
      </if>

      <if test="gender != null and gender != '' ">
        and gender = #{gender}
      </if>
      order by create_date desc
  </select>

  <select id="selectAlumniUserNotYK" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser" resultMap="BaseResultMap" >
    select
    distinct
    <include refid="Base_Column_List" />
    from zhll_user
    where audit_status != 1 and role_type = '游客'
  </select>

  <select id="selectByExample" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser" resultMap="BaseResultMap">
    select
    distinct
    <include refid="Base_Column_List" />
    from zhll_user
    where 1=1
      <if test="auditStatus != null and auditStatus != '' ">
        and audit_status = #{auditStatus }
      </if>
      <if test="userName != null and userName != '' ">
        and user_name like concat('%', #{userName }, '%')
      </if>
      <if test="phone != null and phone != '' ">
        and phone like concat('%', #{phone }, '%') 
      </if>
      <if test="roleType != null and roleType != '' ">
      	and role_type = #{roleType}
      </if>

  </select>
  
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  	select 
    <include refid="Base_Column_List" />
    from zhll_user
    where
      id = #{id,jdbcType=INTEGER }
  </select>
  
  <select id="selectById" parameterType="java.lang.Integer" resultType="java.util.Map">
  	select au.id, au.user_name AS userName,  au.role_type AS roleType,
  	au.gender,
  	au.working, au.position, au.place, au.photo, au.sign, au.email, au.phone,
  	au.hidden_gender AS hiddenGender, au.hidden_email AS hiddenEmail, au.hidden_posi AS hiddenPosi,
  	au.hidden_place AS hiddenPlace,  au.hidden_phone AS hiddenPhone,
  	au.audit_status AS auditStatus,
  	DATE_FORMAT(au.create_date,"%Y-%m-%d") AS createDate,
  	DATE_FORMAT(au.last_login_time,"%Y-%m-%d %H:%i:%s") AS lastLoginTime
    from zhll_user au
    where
      au.id = #{userId,jdbcType=INTEGER }
  </select>
  
  <update id="updateByPrimaryKeySelective" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser">
    update zhll_user
    <set >
      <if test="loginId != null" >
        login_id = #{loginId,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="enUserName != null" >
        en_user_name = #{enUserName,jdbcType=VARCHAR},
      </if>
      <if test="userName != null" >
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="roleType != null" >
        role_type = #{roleType,jdbcType=VARCHAR},
      </if>
      <if test="gender != null" >
        gender = #{gender,jdbcType=VARCHAR},
      </if>
      <if test="working != null" >
        working = #{working,jdbcType=VARCHAR},
      </if>
      <if test="position != null" >
        position = #{position,jdbcType=VARCHAR},
      </if>
      <if test="place != null" >
        place = #{place,jdbcType=VARCHAR},
      </if>
      <if test="photo != null" >
        photo = #{photo,jdbcType=VARCHAR},
      </if>
      <if test="sign != null" >
        sign = #{sign,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="phone != null" >
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="hiddenGender != null" >
        hidden_gender = #{hiddenGender,jdbcType=BIT},
      </if>
      <if test="hiddenEmail != null" >
        hidden_email = #{hiddenEmail,jdbcType=BIT},
      </if>
      <if test="hiddenPosi != null" >
        hidden_posi = #{hiddenPosi,jdbcType=BIT},
      </if>
      <if test="hiddenPlace != null" >
        hidden_place = #{hiddenPlace,jdbcType=BIT},
      </if>
      <if test="hiddenPhone != null" >
        hidden_phone = #{hiddenPhone,jdbcType=BIT},
      </if>
      <if test="auditStatus != null" >
        audit_status = #{auditStatus,jdbcType=INTEGER},
      </if>
      <if test="openId != null" >
        open_id = #{openId,jdbcType=VARCHAR},
      </if>
      <if test="major != null" >
        major = #{major,jdbcType=VARCHAR},
      </if>
      <if test="reason != null" >
        reason = #{reason,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="lastLoginTime != null" >
        last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="formId != null" >
        form_id = #{formId,jdbcType=VARCHAR},
      </if>
      <if test="auditDataTime != null" >
        audit_data_time = #{auditDataTime,jdbcType=TIMESTAMP},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="postcode != null" >
        postcode = #{postcode,jdbcType=VARCHAR},
      </if>
      <if test="annotation != null" >
        annotation = #{annotation,jdbcType=VARCHAR},
      </if>
      <if test="pDocumentType != null" >
        p_document_type = #{pDocumentType,jdbcType=VARCHAR},
      </if>
      <if test="pDocumentNum != null" >
        p_document_num = #{pDocumentNum,jdbcType=VARCHAR},
      </if>
      <if test="pPhone != null" >
        p_phone = #{pPhone,jdbcType=VARCHAR},
      </if>
      <if test="pEmail != null" >
        p_email = #{pEmail,jdbcType=VARCHAR},
      </if>
      <if test="pAddress != null" >
        p_address = #{pAddress,jdbcType=VARCHAR},
      </if>
      <if test="lInstitutionName != null" >
        l_institution_name = #{lInstitutionName,jdbcType=VARCHAR},
      </if>
      <if test="lInstitutionType != null" >
        l_institution_type = #{lInstitutionType,jdbcType=VARCHAR},
      </if>
      <if test="lInstitutionNum != null" >
        l_institution_num = #{lInstitutionNum,jdbcType=VARCHAR},
      </if>
      <if test="lUsername != null" >
        l_username = #{lUsername,jdbcType=VARCHAR},
      </if>
      <if test="lDocumentType != null" >
        l_document_type = #{lDocumentType,jdbcType=VARCHAR},
      </if>
      <if test="lDocumentNum != null" >
        l_document_num = #{lDocumentNum,jdbcType=VARCHAR},
      </if>
      <if test="lPhone != null" >
        l_phone = #{lPhone,jdbcType=VARCHAR},
      </if>
      <if test="lEmail != null" >
        l_email = #{lEmail,jdbcType=VARCHAR},
      </if>
      <if test="lAddress != null" >
        l_address = #{lAddress,jdbcType=VARCHAR},
      </if>
      <if test="isRealname != null" >
        is_realname = #{isRealname,jdbcType=VARCHAR},
      </if>
      <if test="identity != null" >
        identity = #{identity,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>

  <update id="updateByPrimaryKey" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser">
    update zhll_user
    set login_id = #{loginId,jdbcType=VARCHAR},
      `password` = #{password,jdbcType=VARCHAR},
      en_user_name = #{enUserName,jdbcType=VARCHAR},
      user_name = #{userName,jdbcType=VARCHAR},

      role_type = #{roleType,jdbcType=VARCHAR},
      gender = #{gender,jdbcType=VARCHAR},
      working = #{working,jdbcType=VARCHAR},
      position = #{position,jdbcType=VARCHAR},
      place = #{place,jdbcType=VARCHAR},
      photo = #{photo,jdbcType=VARCHAR},
      sign = #{sign,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      hidden_gender = #{hiddenGender,jdbcType=BIT},
      hidden_email = #{hiddenEmail,jdbcType=BIT},
      hidden_posi = #{hiddenPosi,jdbcType=BIT},
      hidden_place = #{hiddenPlace,jdbcType=BIT},
      hidden_phone = #{hiddenPhone,jdbcType=BIT},
      audit_status = #{auditStatus,jdbcType=INTEGER},
      open_id = #{openId,jdbcType=VARCHAR},
      major = #{major,jdbcType=VARCHAR},
      reason = #{reason,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP},
      last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      form_id = #{formId,jdbcType=VARCHAR},
      audit_data_time = #{auditDataTime,jdbcType=TIMESTAMP},
      address = #{address,jdbcType=VARCHAR},
      postcode = #{postcode,jdbcType=VARCHAR},
      annotation = #{annotation,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="countByUser" parameterType="com.dgtis.dorm.manager.db.domain.AlumniUser" resultType="java.lang.Long">
    select count(*) from zhll_user where 1=1
      <if test="userName != null and userName != ''">
        and user_name like concat('%', #{userName}, '%')
      </if>
      <if test="phone != null and phone != ''">
        and phone = #{phone }
      </if>
      <if test="roleType != null and roleType != ''">
       and role_type = #{roleType }
      </if>
      <if test="auditStatus != null">
        and audit_status = #{auditStatus }
      </if>
      <if test="lastLoginTimeStr != null and lastLoginTimeStr != ''">
        and last_login_time like concat('%', #{lastLoginTimeStr}, '%')
      </if>

  </select>

  <!--校友录数量-->
  <select id="selectCountNotYK" resultType="java.lang.Long">
    select count(*) from zhll_user where 1=1 and role_type != '游客'

  </select>
  
  <select id="selectOneByOpenId" parameterType="java.lang.String" resultMap="BaseResultMap">
  	 select
    <include refid="Base_Column_List" />
    from zhll_user
    where 
      open_id = #{openId }
    limit 1
  </select>
  
  <select id="findAlumniRecordById" parameterType="java.lang.Integer" resultType="java.util.Map">
  	select au.id, au.en_user_name, au.user_name, au.gender, au.role_type, au.photo, au.sign, au.place,
	(select COUNT(afu.id) from zhll_fri_user afu
	where afu.fk_user_id = #{userId } and au.id = afu.fri_user_id) as isAttention
 	from zhll_user au where 1=1
 	and au.id != #{userId }
 	and (au.role_type IS NOT NULL and au.role_type != '游客' and au.role_type != '非清华公管人')
 		ORDER BY au.en_user_name asc, au.id asc 
	limit #{pageIndex}, #{pageSize}
  </select>
  
  <select id="selectTotalCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  	select count(a.id) from zhll_user a
    where 1=1 
    and a.id != #{userId }
    and (a.role_type IS NOT NULL and a.role_type != '游客' and a.role_type != '非清华公管人')
  </select>
  
  <select id="findAlumniRecord" resultType="java.util.Map">
  	select au.id, au.en_user_name, au.user_name,  au.gender, au.role_type, au.photo, au.sign, au.place,
	(select COUNT(afu.id) from zhll_fri_user afu
	where afu.fk_user_id = #{userId } and au.id = afu.fri_user_id) as isAttention
 	from zhll_user au where 1=1
 	and au.id != #{userId }
 	and (au.role_type IS NOT NULL and au.role_type != '游客' and au.role_type != '非清华公管人')
 	<if test="valString != null and valString != ''">
       and (
       au.user_name like concat('%', #{valString}, '%')
       or au.role_type = #{valString}
       or au.working = #{valString}
       or au.place like concat('%', #{valString}, '%') 
       or au.phone = #{valString}
       )
    </if>

    	ORDER BY au.en_user_name asc, au.id asc 
    	LIMIT 0,100
  </select>
  
  <select id="selectMyOrganizeByUserId" parameterType="java.lang.Integer" resultType="java.util.Map">
  	SELECT
      o.id,
      o.organize_name,
      o.organize_type,
      o.organize_memo,
      o.url,
      (SELECT count(1) from zhll_organize_user WHERE fk_organize_id = o.id) AS organize_user_count
    FROM zhll_organize_user ou
      LEFT JOIN (SELECT * FROM zhll_organize WHERE 1 = 1) o ON ou.fk_organize_id = o.id
    WHERE 1 = 1
      AND ou.is_normal = 1
      AND ou.is_delete = 1
      AND o.is_delete = 1
      AND ou.fk_user_id = #{userId}
  </select>
  <select id="selectUserByUserName" parameterType="java.lang.String" resultMap="BaseResultMap" >
      SELECT  <include refid="Base_Column_List" />
      FROM zhll_user
      WHERE 1 = 1
        AND user_name LIKE concat('%', #{userName,jdbcType=VARCHAR},'%')
  </select>
</mapper>