<?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.tofly.gpsboot.mapper.maintain.EventMangeMapper">

  <resultMap id="eventMangeMap" type="com.tofly.pojo.maintain.EventMange">
                <id property="id" column="id"/>
                                                                                                                                                                                                              <result property="category" column="category"/>
                      <result property="name" column="name"/>
                      <result property="type" column="type"/>
                      <result property="address" column="address"/>
                      <result property="detail" column="detail"/>
                      <result property="facility" column="facility"/>
                      <result property="x" column="x"/>
                      <result property="y" column="y"/>
                      <result property="handingAdvice" column="handing_advice"/>
                      <result property="findUser" column="find_user"/>
                      <result property="findPhone" column="find_phone"/>
                      <result property="findDate" column="find_date"/>
                      <result property="status" column="status"/>
                      <result property="createTime" column="CREATE_TIME"/>
                      <result property="createUserid" column="CREATE_USERID"/>
                      <result property="uploadFileids" column="UPLOAD_FILEIDS"/>
                      <result property="reciveUser" column="recive_user"/>

                 <association property="findUserName" column="find_user"
                              select="selectUsername"/>
                  <association property="createUseName" column="CREATE_USERID"
                               select="selectUsername"/>
  </resultMap>

    <select id="selectUsername"  resultType="java.lang.String">
        select  real_name  from tf_smpn_user_x where id=#{id}
    </select>

    <select id="findEventMangeUser" resultType="java.util.Map">
        select  id, real_name,phone from  tf_smpn_user_x
        <if test="userIds != null and userIds != ''  ">
        where id in
            <foreach item="userId" collection="userIds.split(',')" open="(" separator="," close=")">
                #{userId}
            </foreach>
        </if>
    </select>
</mapper>
