<?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.MobileDeviceMapper">

    <resultMap id="mobileDeviceMap" type="com.tofly.pojo.maintain.MobileDevice">
        <id property="id" column="id"/>
        <result property="no" column="no"/>
        <result property="name" column="name"/>
        <result property="type" column="type"/>
        <result property="devicePhone" column="device_phone"/>
        <result property="meid" column="meid"/>
        <result property="note" column="note"/>
        <result property="useDeptId" column="use_dept_id"/>
        <result property="userUserId" column="user_user_id"/>
        <result property="status" column="status"/>
        <result property="createTime" column="CREATE_TIME"/>
        <result property="createUserid" column="CREATE_USERID"/>
        <result property="auditStataus" column="audit_Stataus"/>
        <result property="appVersion" column="app_Version"/>
        <result property="dataSource" column="data_source"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>

    <select id="findMobileUser" resultType="com.tofly.pojo.User">
        SELECT
        id,
        REAL_NAME,
        username
        FROM
        tf_smpn_user_x
        WHERE
        id IN (
        SELECT
        user_user_id
        FROM
        tf_ywpn_mobiledevice_w)

        <if test="deptId !=null and deptId !=''">
            and department_id=#{deptId}

        </if>
    </select>

</mapper>
