| <?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="doumeemes.dao.ext.UserDeviceExtMapper"> | 
|   | 
|   <!-- 管理页面查询 --> | 
|   <resultMap id="UserDeviceExtListVO" type="doumeemes.dao.ext.vo.UserDeviceExtListVO" autoMapping="true"> | 
|     <id column="ID" jdbcType="INTEGER" property="id"/> | 
|     <association property="umodel" javaType="doumeemes.dao.business.model.CompanyUser"> | 
|       <id column="UMODEL_ID" jdbcType="INTEGER" property="id"/> | 
|       <result column="UMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> | 
|       <result column="UMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> | 
|       <result column="UMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> | 
|       <result column="UMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> | 
|       <result column="UMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> | 
|       <result column="UMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> | 
|       <result column="UMODEL_COM_DEPART_ID" jdbcType="INTEGER" property="comDepartId"/> | 
|       <result column="UMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> | 
|       <result column="UMODEL_NAME" jdbcType="VARCHAR" property="name"/> | 
|       <result column="UMODEL_PHONE" jdbcType="VARCHAR" property="phone"/> | 
|       <result column="UMODEL_PHONE_AUTH_STATUS" jdbcType="VARCHAR" property="phoneAuthStatus"/> | 
|       <result column="UMODEL_IDCARD_NO" jdbcType="TINYINT" property="idcardNo"/> | 
|       <result column="UMODEL_EMAIL" jdbcType="VARCHAR" property="email"/> | 
|       <result column="UMODEL_EMAIL_AUTH_STATUS" jdbcType="TINYINT" property="emailAuthStatus"/> | 
|       <result column="UMODEL_CODE" jdbcType="VARCHAR" property="code"/> | 
|       <result column="UMODEL_QRCODEID" jdbcType="VARCHAR" property="qrcodeid"/> | 
|       <result column="UMODEL_LEGAL_USER" jdbcType="TINYINT" property="legalUser"/> | 
|       <result column="UMODEL_POSITION" jdbcType="VARCHAR" property="position"/> | 
|       <result column="UMODEL_DEPARTMENT_ID" jdbcType="INTEGER" property="departmentId"/> | 
|       <result column="UMODEL_DEVICE_ID" jdbcType="INTEGER" property="deviceId"/> | 
|       <result column="UMODEL_DEVICE_DATE" jdbcType="TIMESTAMP" property="deviceDate"/> | 
|       <result column="UMODEL_ORIGIN" jdbcType="TINYINT" property="origin"/> | 
|       <result column="UMODEL_USER_ID" jdbcType="INTEGER" property="userId"/> | 
|       <result column="UMODEL_POSITION_ID" jdbcType="INTEGER" property="positionId"/> | 
|       <result column="UMODEL_PROCEDURE_IDS" jdbcType="LONGVARCHAR" property="procedureIds"/> | 
|     </association> | 
|     <association property="dmodel" javaType="doumeemes.dao.business.model.Device"> | 
|       <id column="DMODEL_ID" jdbcType="INTEGER" property="id"/> | 
|       <result column="DMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> | 
|       <result column="DMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> | 
|       <result column="DMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> | 
|       <result column="DMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> | 
|       <result column="DMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> | 
|       <result column="DMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> | 
|       <result column="DMODEL_ROOT_DEPART_ID" jdbcType="INTEGER" property="rootDepartId"/> | 
|       <result column="DMODEL_DEPART_ID" jdbcType="INTEGER" property="departId"/> | 
|       <result column="DMODEL_PROCEDURE_ID" jdbcType="INTEGER" property="procedureId"/> | 
|       <result column="DMODEL_CODE" jdbcType="INTEGER" property="code"/> | 
|       <result column="DMODEL_TYPE" jdbcType="TINYINT" property="type"/> | 
|       <result column="DMODEL_NAME" jdbcType="VARCHAR" property="name"/> | 
|       <result column="DMODEL_MODEL" jdbcType="VARCHAR" property="model"/> | 
|       <result column="DMODEL_STATUS" jdbcType="TINYINT" property="status"/> | 
|       <result column="DMODEL_SUPPLIER" jdbcType="VARCHAR" property="supplier"/> | 
|       <result column="DMODEL_STATION_CODE" jdbcType="VARCHAR" property="stationCode"/> | 
|       <result column="DMODEL_GROUP_ID" jdbcType="INTEGER" property="groupId"/> | 
|       <result column="DMODEL_SERIAL_NUM" jdbcType="VARCHAR" property="serialNum"/> | 
|     </association> | 
|     <association property="tmodel" javaType="doumeemes.dao.business.model.Department"> | 
|       <id column="TMODEL_ID" jdbcType="INTEGER" property="id"/> | 
|       <result column="TMODEL_DELETED" jdbcType="TINYINT" property="deleted"/> | 
|       <result column="TMODEL_CREATE_USER" jdbcType="INTEGER" property="createUser"/> | 
|       <result column="TMODEL_CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/> | 
|       <result column="TMODEL_UPDATE_USER" jdbcType="INTEGER" property="updateUser"/> | 
|       <result column="TMODEL_UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/> | 
|       <result column="TMODEL_NAME" jdbcType="VARCHAR" property="name"/> | 
|       <result column="TMODEL_REMARK" jdbcType="VARCHAR" property="remark"/> | 
|       <result column="TMODEL_ROOT_ID" jdbcType="INTEGER" property="rootId"/> | 
|       <result column="TMODEL_PARENT_ID" jdbcType="INTEGER" property="parentId"/> | 
|       <result column="TMODEL_COMPANY_ID" jdbcType="INTEGER" property="companyId"/> | 
|       <result column="TMODEL_TYPE" jdbcType="TINYINT" property="type"/> | 
|       <result column="TMODEL_ERP_ID" jdbcType="VARCHAR" property="erpId"/> | 
|       <result column="TMODEL_STATUS" jdbcType="INTEGER" property="status"/> | 
|       <result column="TMODEL_VALID_TIME" jdbcType="TIMESTAMP" property="validTime"/> | 
|       <result column="TMODEL_INVALID_TIME" jdbcType="TIMESTAMP" property="invalidTime"/> | 
|     </association> | 
|   </resultMap> | 
|   <select id="selectList" parameterType="doumeemes.dao.ext.dto.QueryUserDeviceExtDTO" resultMap="UserDeviceExtListVO"> | 
|     SELECT | 
|       `a`.*, | 
|       `umodel`.`ID` AS UMODEL_ID, | 
|       `umodel`.`DELETED` AS UMODEL_DELETED, | 
|       `umodel`.`CREATE_USER` AS UMODEL_CREATE_USER, | 
|       `umodel`.`CREATE_TIME` AS UMODEL_CREATE_TIME, | 
|       `umodel`.`UPDATE_USER` AS UMODEL_UPDATE_USER, | 
|       `umodel`.`UPDATE_TIME` AS UMODEL_UPDATE_TIME, | 
|       `umodel`.`REMARK` AS UMODEL_REMARK, | 
|       `umodel`.`COM_DEPART_ID` AS UMODEL_COM_DEPART_ID, | 
|       `umodel`.`ROOT_DEPART_ID` AS UMODEL_ROOT_DEPART_ID, | 
|       `umodel`.`NAME` AS UMODEL_NAME, | 
|       `umodel`.`PHONE` AS UMODEL_PHONE, | 
|       `umodel`.`PHONE_AUTH_STATUS` AS UMODEL_PHONE_AUTH_STATUS, | 
|       `umodel`.`IDCARD_NO` AS UMODEL_IDCARD_NO, | 
|       `umodel`.`EMAIL` AS UMODEL_EMAIL, | 
|       `umodel`.`EMAIL_AUTH_STATUS` AS UMODEL_EMAIL_AUTH_STATUS, | 
|       `umodel`.`CODE` AS UMODEL_CODE, | 
|       `umodel`.`QRCODEID` AS UMODEL_QRCODEID, | 
|       `umodel`.`LEGAL_USER` AS UMODEL_LEGAL_USER, | 
|       `umodel`.`POSITION` AS UMODEL_POSITION, | 
|       `umodel`.`DEPARTMENT_ID` AS UMODEL_DEPARTMENT_ID, | 
|       `umodel`.`DEVICE_ID` AS UMODEL_DEVICE_ID, | 
|       `umodel`.`DEVICE_DATE` AS UMODEL_DEVICE_DATE, | 
|       `umodel`.`ORIGIN` AS UMODEL_ORIGIN, | 
|       `umodel`.`USER_ID` AS UMODEL_USER_ID, | 
|       `umodel`.`POSITION_ID` AS UMODEL_POSITION_ID, | 
|       `umodel`.`PROCEDURE_IDS` AS UMODEL_PROCEDURE_IDS, | 
|       `dmodel`.`ID` AS DMODEL_ID, | 
|       `dmodel`.`DELETED` AS DMODEL_DELETED, | 
|       `dmodel`.`CREATE_USER` AS DMODEL_CREATE_USER, | 
|       `dmodel`.`CREATE_TIME` AS DMODEL_CREATE_TIME, | 
|       `dmodel`.`UPDATE_USER` AS DMODEL_UPDATE_USER, | 
|       `dmodel`.`UPDATE_TIME` AS DMODEL_UPDATE_TIME, | 
|       `dmodel`.`REMARK` AS DMODEL_REMARK, | 
|       `dmodel`.`ROOT_DEPART_ID` AS DMODEL_ROOT_DEPART_ID, | 
|       `dmodel`.`DEPART_ID` AS DMODEL_DEPART_ID, | 
|       `dmodel`.`PROCEDURE_ID` AS DMODEL_PROCEDURE_ID, | 
|       `dmodel`.`CODE` AS DMODEL_CODE, | 
|       `dmodel`.`TYPE` AS DMODEL_TYPE, | 
|       `dmodel`.`NAME` AS DMODEL_NAME, | 
|       `dmodel`.`MODEL` AS DMODEL_MODEL, | 
|       `dmodel`.`STATUS` AS DMODEL_STATUS, | 
|       `dmodel`.`SUPPLIER` AS DMODEL_SUPPLIER, | 
|       `dmodel`.`STATION_CODE` AS DMODEL_STATION_CODE, | 
|       `dmodel`.`GROUP_ID` AS DMODEL_GROUP_ID, | 
|       `dmodel`.`SERIAL_NUM` AS DMODEL_SERIAL_NUM, | 
|     `tmodel`.`ID` AS TMODEL_ID, | 
|     `tmodel`.`DELETED` AS TMODEL_DELETED, | 
|     `tmodel`.`CREATE_USER` AS TMODEL_CREATE_USER, | 
|     `tmodel`.`CREATE_TIME` AS TMODEL_CREATE_TIME, | 
|     `tmodel`.`UPDATE_USER` AS TMODEL_UPDATE_USER, | 
|     `tmodel`.`UPDATE_TIME` AS TMODEL_UPDATE_TIME, | 
|     `tmodel`.`NAME` AS TMODEL_NAME, | 
|     `tmodel`.`REMARK` AS TMODEL_REMARK, | 
|     `tmodel`.`ROOT_ID` AS TMODEL_ROOT_ID, | 
|     `tmodel`.`PARENT_ID` AS TMODEL_PARENT_ID, | 
|     `tmodel`.`COMPANY_ID` AS TMODEL_COMPANY_ID, | 
|     `tmodel`.`TYPE` AS TMODEL_TYPE, | 
|     `tmodel`.`ERP_ID` AS TMODEL_ERP_ID, | 
|     `tmodel`.`STATUS` AS TMODEL_STATUS, | 
|     `tmodel`.`VALID_TIME` AS TMODEL_VALID_TIME, | 
|     `tmodel`.`INVALID_TIME` AS TMODEL_INVALID_TIME | 
|     FROM `user_device` `a` | 
|     LEFT JOIN `company_user` `umodel` ON a.COMPANY_USER_ID=umodel.ID | 
|     LEFT JOIN `device` `dmodel` ON a.DEVICE_ID=dmodel.ID | 
|     LEFT JOIN `department` `tmodel` ON umodel.DEPARTMENT_ID=tmodel.ID | 
|     <where> | 
|       <if test="id != null"> | 
|         AND `a`.`ID` = #{id} | 
|       </if> | 
|       <if test="deleted != null"> | 
|         AND `a`.`DELETED` = #{deleted} | 
|       </if> | 
|   | 
|       <if test="createTime != null"> | 
|         AND `a`.`CREATE_TIME` = #{createTime} | 
|       </if> | 
|      <!-- <if test="updateUser != null"> | 
|         AND `a`.`UPDATE_USER` = #{updateUser} | 
|       </if>--> | 
|       <if test="updateTime != null"> | 
|         AND `a`.`UPDATE_TIME` = #{updateTime} | 
|       </if> | 
|       <if test="remark != null and remark != ''"> | 
|         AND `a`.`REMARK` = #{remark} | 
|       </if> | 
|       <if test="companyUserId != null"> | 
|         AND `a`.`COMPANY_USER_ID` = #{companyUserId} | 
|       </if> | 
|       <if test="deviceId != null"> | 
|         AND `a`.`DEVICE_ID` = #{deviceId} | 
|       </if> | 
|       <if test="deviceDate != null"> | 
|         AND `a`.`DEVICE_DATE` = #{deviceDate} | 
|       </if> | 
|       <if test="userId != null"> | 
|         AND `a`.`USER_ID` = #{userId} | 
|       </if> | 
|       <if test="umodelId != null"> | 
|         AND `umodel`.`ID` = #{umodelId} | 
|       </if> | 
|       <if test="umodelDeleted != null"> | 
|         AND `umodel`.`DELETED` = #{umodelDeleted} | 
|       </if> | 
|       <if test="umodelCreateUser != null"> | 
|         AND `umodel`.`CREATE_USER` = #{umodelCreateUser} | 
|       </if> | 
|       <if test="umodelCreateTime != null"> | 
|         AND `umodel`.`CREATE_TIME` = #{umodelCreateTime} | 
|       </if> | 
|       <if test="umodelUpdateUser != null"> | 
|         AND `umodel`.`UPDATE_USER` = #{umodelUpdateUser} | 
|       </if> | 
|       <if test="umodelUpdateTime != null"> | 
|         AND `umodel`.`UPDATE_TIME` = #{umodelUpdateTime} | 
|       </if> | 
|       <if test="umodelRemark != null and umodelRemark != ''"> | 
|         AND `umodel`.`REMARK` = #{umodelRemark} | 
|       </if> | 
|       <if test="umodelComDepartId != null"> | 
|         AND `umodel`.`COM_DEPART_ID` = #{umodelComDepartId} | 
|       </if> | 
|       <if test="umodelRootDepartId != null"> | 
|         AND `umodel`.`ROOT_DEPART_ID` = #{umodelRootDepartId} | 
|       </if> | 
|       <if test="umodelName != null and umodelName != ''"> | 
|         AND `umodel`.`NAME` like concat('%', #{umodelName} , '%') | 
|       </if> | 
|       <if test="umodelPhone != null and umodelPhone != ''"> | 
|         AND `umodel`.`PHONE` = #{umodelPhone} | 
|       </if> | 
|       <if test="umodelPhoneAuthStatus != null and umodelPhoneAuthStatus != ''"> | 
|         AND `umodel`.`PHONE_AUTH_STATUS` = #{umodelPhoneAuthStatus} | 
|       </if> | 
|       <if test="umodelIdcardNo != null"> | 
|         AND `umodel`.`IDCARD_NO` = #{umodelIdcardNo} | 
|       </if> | 
|       <if test="umodelEmail != null and umodelEmail != ''"> | 
|         AND `umodel`.`EMAIL` = #{umodelEmail} | 
|       </if> | 
|       <if test="umodelEmailAuthStatus != null"> | 
|         AND `umodel`.`EMAIL_AUTH_STATUS` = #{umodelEmailAuthStatus} | 
|       </if> | 
|       <if test="umodelCode != null and umodelCode != ''"> | 
|         AND `umodel`.`CODE` = #{umodelCode} | 
|       </if> | 
|       <if test="umodelQrcodeid != null and umodelQrcodeid != ''"> | 
|         AND `umodel`.`QRCODEID` = #{umodelQrcodeid} | 
|       </if> | 
|       <if test="umodelLegalUser != null"> | 
|         AND `umodel`.`LEGAL_USER` = #{umodelLegalUser} | 
|       </if> | 
|       <if test="umodelPosition != null and umodelPosition != ''"> | 
|         AND `umodel`.`POSITION` = #{umodelPosition} | 
|       </if> | 
|       <if test="umodelDepartmentId != null"> | 
|         AND `umodel`.`DEPARTMENT_ID` = #{umodelDepartmentId} | 
|       </if> | 
|       <if test="umodelDeviceId != null"> | 
|         AND `umodel`.`DEVICE_ID` = #{umodelDeviceId} | 
|       </if> | 
|       <if test="umodelDeviceDate != null"> | 
|         AND `umodel`.`DEVICE_DATE` = #{umodelDeviceDate} | 
|       </if> | 
|       <if test="umodelOrigin != null"> | 
|         AND `umodel`.`ORIGIN` = #{umodelOrigin} | 
|       </if> | 
|       <if test="umodelUserId != null"> | 
|         AND `umodel`.`USER_ID` = #{umodelUserId} | 
|       </if> | 
|       <if test="umodelPositionId != null"> | 
|         AND `umodel`.`POSITION_ID` = #{umodelPositionId} | 
|       </if> | 
|       <if test="umodelProcedureIds != null and umodelProcedureIds != ''"> | 
|         AND `umodel`.`PROCEDURE_IDS` = #{umodelProcedureIds} | 
|       </if> | 
|       <if test="dmodelId != null"> | 
|         AND `dmodel`.`ID` = #{dmodelId} | 
|       </if> | 
|       <if test="dmodelDeleted != null"> | 
|         AND `dmodel`.`DELETED` = #{dmodelDeleted} | 
|       </if> | 
|       <if test="dmodelCreateUser != null"> | 
|         AND `dmodel`.`CREATE_USER` = #{dmodelCreateUser} | 
|       </if> | 
|       <if test="dmodelCreateTime != null"> | 
|         AND `dmodel`.`CREATE_TIME` = #{dmodelCreateTime} | 
|       </if> | 
|       <if test="dmodelUpdateUser != null"> | 
|         AND `dmodel`.`UPDATE_USER` = #{dmodelUpdateUser} | 
|       </if> | 
|       <if test="dmodelUpdateTime != null"> | 
|         AND `dmodel`.`UPDATE_TIME` = #{dmodelUpdateTime} | 
|       </if> | 
|       <if test="dmodelRemark != null and dmodelRemark != ''"> | 
|         AND `dmodel`.`REMARK` = #{dmodelRemark} | 
|       </if> | 
|       <if test="dmodelRootDepartId != null"> | 
|         AND `dmodel`.`ROOT_DEPART_ID` = #{dmodelRootDepartId} | 
|       </if> | 
|       <if test="dmodelDepartId != null"> | 
|         AND `dmodel`.`DEPART_ID` = #{dmodelDepartId} | 
|       </if> | 
|       <if test="dmodelProcedureId != null"> | 
|         AND `dmodel`.`PROCEDURE_ID` = #{dmodelProcedureId} | 
|       </if> | 
|       <if test="dmodelCode != null"> | 
|         AND `dmodel`.`CODE` = #{dmodelCode} | 
|       </if> | 
|       <if test="dmodelType != null"> | 
|         AND `dmodel`.`TYPE` = #{dmodelType} | 
|       </if> | 
|       <if test="dmodelName != null and dmodelName != ''"> | 
|         AND `dmodel`.`NAME` = #{dmodelName} | 
|       </if> | 
|       <if test="dmodelModel != null and dmodelModel != ''"> | 
|         AND `dmodel`.`MODEL` = #{dmodelModel} | 
|       </if> | 
|       <if test="dmodelStatus != null"> | 
|         AND `dmodel`.`STATUS` = #{dmodelStatus} | 
|       </if> | 
|       <if test="dmodelSupplier != null and dmodelSupplier != ''"> | 
|         AND `dmodel`.`SUPPLIER` = #{dmodelSupplier} | 
|       </if> | 
|       <if test="dmodelStationCode != null and dmodelStationCode != ''"> | 
|         AND `dmodel`.`STATION_CODE` = #{dmodelStationCode} | 
|       </if> | 
|       <if test="dmodelGroupId != null"> | 
|         AND `dmodel`.`GROUP_ID` = #{dmodelGroupId} | 
|       </if> | 
|       <if test="dmodelSerialNum != null and dmodelSerialNum != ''"> | 
|         AND `dmodel`.`SERIAL_NUM` = #{dmodelSerialNum} | 
|       </if> | 
|   | 
|       <if test="userIdList != null and userIdList.size()>0"> | 
|         AND a.USER_ID in <foreach collection="userIdList" item="item" separator="," open="(" close=")">#{item}</foreach> | 
|       </if> | 
|   | 
|       <choose> | 
|         <when test="departIds != null and departIds.size()>0"> | 
|           AND (  `a`.`USER_ID` = #{createUser} | 
|   | 
|           or exists (select d.id from company_user d where  (  d.user_id= a.USER_ID) and d.department_id | 
|             in <foreach collection="departIds" item="item" separator="," open="(" close=")">#{item}</foreach>) | 
|             ) | 
|         </when> | 
|        <otherwise> | 
|          <if test="createUser != null "> | 
|            AND ( `a`.`USER_ID` = #{createUser} ) | 
|          </if> | 
|        </otherwise> | 
|        </choose> | 
|   | 
|   | 
|   | 
|   | 
|       <if test="rootDepartId != null "> | 
|         AND `dmodel`.`ROOT_DEPART_ID` = #{rootDepartId} | 
|       </if> | 
|   | 
|       <if test="departId != null "> | 
|         AND `dmodel`.`DEPART_ID` = #{departId} | 
|       </if> | 
|   | 
|       <if test="tmodelName != null and tmodelName!=''"> | 
|         AND `tmodel`.`NAME` like concat('%',#{tmodelName},'%') | 
|       </if> | 
|   | 
|     </where> | 
|     order by `a`.`ID` desc | 
|   </select> | 
|   <select id="selectByModel" parameterType="doumeemes.dao.ext.dto.QueryUserDeviceExtDTO" resultMap="UserDeviceExtListVO"> | 
|     SELECT | 
|       `a`.*, | 
|       `umodel`.`ID` AS UMODEL_ID, | 
|       `umodel`.`DELETED` AS UMODEL_DELETED, | 
|       `umodel`.`CREATE_USER` AS UMODEL_CREATE_USER, | 
|       `umodel`.`CREATE_TIME` AS UMODEL_CREATE_TIME, | 
|       `umodel`.`UPDATE_USER` AS UMODEL_UPDATE_USER, | 
|       `umodel`.`UPDATE_TIME` AS UMODEL_UPDATE_TIME, | 
|       `umodel`.`REMARK` AS UMODEL_REMARK, | 
|       `umodel`.`COM_DEPART_ID` AS UMODEL_COM_DEPART_ID, | 
|       `umodel`.`ROOT_DEPART_ID` AS UMODEL_ROOT_DEPART_ID, | 
|       `umodel`.`NAME` AS UMODEL_NAME, | 
|       `umodel`.`PHONE` AS UMODEL_PHONE, | 
|       `umodel`.`PHONE_AUTH_STATUS` AS UMODEL_PHONE_AUTH_STATUS, | 
|       `umodel`.`IDCARD_NO` AS UMODEL_IDCARD_NO, | 
|       `umodel`.`EMAIL` AS UMODEL_EMAIL, | 
|       `umodel`.`EMAIL_AUTH_STATUS` AS UMODEL_EMAIL_AUTH_STATUS, | 
|       `umodel`.`CODE` AS UMODEL_CODE, | 
|       `umodel`.`QRCODEID` AS UMODEL_QRCODEID, | 
|       `umodel`.`LEGAL_USER` AS UMODEL_LEGAL_USER, | 
|       `umodel`.`POSITION` AS UMODEL_POSITION, | 
|       `umodel`.`DEPARTMENT_ID` AS UMODEL_DEPARTMENT_ID, | 
|       `umodel`.`DEVICE_ID` AS UMODEL_DEVICE_ID, | 
|       `umodel`.`DEVICE_DATE` AS UMODEL_DEVICE_DATE, | 
|       `umodel`.`ORIGIN` AS UMODEL_ORIGIN, | 
|       `umodel`.`USER_ID` AS UMODEL_USER_ID, | 
|       `umodel`.`POSITION_ID` AS UMODEL_POSITION_ID, | 
|       `umodel`.`PROCEDURE_IDS` AS UMODEL_PROCEDURE_IDS, | 
|       `dmodel`.`ID` AS DMODEL_ID, | 
|       `dmodel`.`DELETED` AS DMODEL_DELETED, | 
|       `dmodel`.`CREATE_USER` AS DMODEL_CREATE_USER, | 
|       `dmodel`.`CREATE_TIME` AS DMODEL_CREATE_TIME, | 
|       `dmodel`.`UPDATE_USER` AS DMODEL_UPDATE_USER, | 
|       `dmodel`.`UPDATE_TIME` AS DMODEL_UPDATE_TIME, | 
|       `dmodel`.`REMARK` AS DMODEL_REMARK, | 
|       `dmodel`.`ROOT_DEPART_ID` AS DMODEL_ROOT_DEPART_ID, | 
|       `dmodel`.`DEPART_ID` AS DMODEL_DEPART_ID, | 
|       `dmodel`.`PROCEDURE_ID` AS DMODEL_PROCEDURE_ID, | 
|       `dmodel`.`CODE` AS DMODEL_CODE, | 
|       `dmodel`.`TYPE` AS DMODEL_TYPE, | 
|       `dmodel`.`NAME` AS DMODEL_NAME, | 
|       `dmodel`.`MODEL` AS DMODEL_MODEL, | 
|       `dmodel`.`STATUS` AS DMODEL_STATUS, | 
|       `dmodel`.`SUPPLIER` AS DMODEL_SUPPLIER, | 
|       `dmodel`.`STATION_CODE` AS DMODEL_STATION_CODE, | 
|       `dmodel`.`GROUP_ID` AS DMODEL_GROUP_ID, | 
|       `dmodel`.`SERIAL_NUM` AS DMODEL_SERIAL_NUM | 
|     FROM `user_device` `a` | 
|     LEFT JOIN `company_user` `umodel` ON a.COMPANY_USER_ID=umodel.ID | 
|     LEFT JOIN `device` `dmodel` ON a.DEVICE_ID=dmodel.ID | 
|     <where> | 
|       <if test="id != null"> | 
|         AND `a`.`ID` = #{id} | 
|       </if> | 
|       <if test="deleted != null"> | 
|         AND `a`.`DELETED` = #{deleted} | 
|       </if> | 
|       <if test="createUser != null"> | 
|         AND `a`.`CREATE_USER` = #{createUser} | 
|       </if> | 
|       <if test="createTime != null"> | 
|         AND `a`.`CREATE_TIME` = #{createTime} | 
|       </if> | 
|       <if test="updateUser != null"> | 
|         AND `a`.`UPDATE_USER` = #{updateUser} | 
|       </if> | 
|       <if test="updateTime != null"> | 
|         AND `a`.`UPDATE_TIME` = #{updateTime} | 
|       </if> | 
|       <if test="remark != null and remark != ''"> | 
|         AND `a`.`REMARK` = #{remark} | 
|       </if> | 
|       <if test="companyUserId != null"> | 
|         AND `a`.`COMPANY_USER_ID` = #{companyUserId} | 
|       </if> | 
|       <if test="deviceId != null"> | 
|         AND `a`.`DEVICE_ID` = #{deviceId} | 
|       </if> | 
|       <if test="deviceDate != null"> | 
|         AND `a`.`DEVICE_DATE` = #{deviceDate} | 
|       </if> | 
|       <if test="userId != null"> | 
|         AND `a`.`USER_ID` = #{userId} | 
|       </if> | 
|       <if test="umodelId != null"> | 
|         AND `umodel`.`ID` = #{umodelId} | 
|       </if> | 
|       <if test="umodelDeleted != null"> | 
|         AND `umodel`.`DELETED` = #{umodelDeleted} | 
|       </if> | 
|       <if test="umodelCreateUser != null"> | 
|         AND `umodel`.`CREATE_USER` = #{umodelCreateUser} | 
|       </if> | 
|       <if test="umodelCreateTime != null"> | 
|         AND `umodel`.`CREATE_TIME` = #{umodelCreateTime} | 
|       </if> | 
|       <if test="umodelUpdateUser != null"> | 
|         AND `umodel`.`UPDATE_USER` = #{umodelUpdateUser} | 
|       </if> | 
|       <if test="umodelUpdateTime != null"> | 
|         AND `umodel`.`UPDATE_TIME` = #{umodelUpdateTime} | 
|       </if> | 
|       <if test="umodelRemark != null and umodelRemark != ''"> | 
|         AND `umodel`.`REMARK` = #{umodelRemark} | 
|       </if> | 
|       <if test="umodelComDepartId != null"> | 
|         AND `umodel`.`COM_DEPART_ID` = #{umodelComDepartId} | 
|       </if> | 
|       <if test="umodelRootDepartId != null"> | 
|         AND `umodel`.`ROOT_DEPART_ID` = #{umodelRootDepartId} | 
|       </if> | 
|       <if test="umodelName != null and umodelName != ''"> | 
|         AND `umodel`.`NAME` = #{umodelName} | 
|       </if> | 
|       <if test="umodelPhone != null and umodelPhone != ''"> | 
|         AND `umodel`.`PHONE` = #{umodelPhone} | 
|       </if> | 
|       <if test="umodelPhoneAuthStatus != null and umodelPhoneAuthStatus != ''"> | 
|         AND `umodel`.`PHONE_AUTH_STATUS` = #{umodelPhoneAuthStatus} | 
|       </if> | 
|       <if test="umodelIdcardNo != null"> | 
|         AND `umodel`.`IDCARD_NO` = #{umodelIdcardNo} | 
|       </if> | 
|       <if test="umodelEmail != null and umodelEmail != ''"> | 
|         AND `umodel`.`EMAIL` = #{umodelEmail} | 
|       </if> | 
|       <if test="umodelEmailAuthStatus != null"> | 
|         AND `umodel`.`EMAIL_AUTH_STATUS` = #{umodelEmailAuthStatus} | 
|       </if> | 
|       <if test="umodelCode != null and umodelCode != ''"> | 
|         AND `umodel`.`CODE` = #{umodelCode} | 
|       </if> | 
|       <if test="umodelQrcodeid != null and umodelQrcodeid != ''"> | 
|         AND `umodel`.`QRCODEID` = #{umodelQrcodeid} | 
|       </if> | 
|       <if test="umodelLegalUser != null"> | 
|         AND `umodel`.`LEGAL_USER` = #{umodelLegalUser} | 
|       </if> | 
|       <if test="umodelPosition != null and umodelPosition != ''"> | 
|         AND `umodel`.`POSITION` = #{umodelPosition} | 
|       </if> | 
|       <if test="umodelDepartmentId != null"> | 
|         AND `umodel`.`DEPARTMENT_ID` = #{umodelDepartmentId} | 
|       </if> | 
|       <if test="umodelDeviceId != null"> | 
|         AND `umodel`.`DEVICE_ID` = #{umodelDeviceId} | 
|       </if> | 
|       <if test="umodelDeviceDate != null"> | 
|         AND `umodel`.`DEVICE_DATE` = #{umodelDeviceDate} | 
|       </if> | 
|       <if test="umodelOrigin != null"> | 
|         AND `umodel`.`ORIGIN` = #{umodelOrigin} | 
|       </if> | 
|       <if test="umodelUserId != null"> | 
|         AND `umodel`.`USER_ID` = #{umodelUserId} | 
|       </if> | 
|       <if test="umodelPositionId != null"> | 
|         AND `umodel`.`POSITION_ID` = #{umodelPositionId} | 
|       </if> | 
|       <if test="umodelProcedureIds != null and umodelProcedureIds != ''"> | 
|         AND `umodel`.`PROCEDURE_IDS` = #{umodelProcedureIds} | 
|       </if> | 
|       <if test="dmodelId != null"> | 
|         AND `dmodel`.`ID` = #{dmodelId} | 
|       </if> | 
|       <if test="dmodelDeleted != null"> | 
|         AND `dmodel`.`DELETED` = #{dmodelDeleted} | 
|       </if> | 
|       <if test="dmodelCreateUser != null"> | 
|         AND `dmodel`.`CREATE_USER` = #{dmodelCreateUser} | 
|       </if> | 
|       <if test="dmodelCreateTime != null"> | 
|         AND `dmodel`.`CREATE_TIME` = #{dmodelCreateTime} | 
|       </if> | 
|       <if test="dmodelUpdateUser != null"> | 
|         AND `dmodel`.`UPDATE_USER` = #{dmodelUpdateUser} | 
|       </if> | 
|       <if test="dmodelUpdateTime != null"> | 
|         AND `dmodel`.`UPDATE_TIME` = #{dmodelUpdateTime} | 
|       </if> | 
|       <if test="dmodelRemark != null and dmodelRemark != ''"> | 
|         AND `dmodel`.`REMARK` = #{dmodelRemark} | 
|       </if> | 
|       <if test="dmodelRootDepartId != null"> | 
|         AND `dmodel`.`ROOT_DEPART_ID` = #{dmodelRootDepartId} | 
|       </if> | 
|       <if test="dmodelDepartId != null"> | 
|         AND `dmodel`.`DEPART_ID` = #{dmodelDepartId} | 
|       </if> | 
|       <if test="dmodelProcedureId != null"> | 
|         AND `dmodel`.`PROCEDURE_ID` = #{dmodelProcedureId} | 
|       </if> | 
|       <if test="dmodelCode != null"> | 
|         AND `dmodel`.`CODE` = #{dmodelCode} | 
|       </if> | 
|       <if test="dmodelType != null"> | 
|         AND `dmodel`.`TYPE` = #{dmodelType} | 
|       </if> | 
|       <if test="dmodelName != null and dmodelName != ''"> | 
|         AND `dmodel`.`NAME` = #{dmodelName} | 
|       </if> | 
|       <if test="dmodelModel != null and dmodelModel != ''"> | 
|         AND `dmodel`.`MODEL` = #{dmodelModel} | 
|       </if> | 
|       <if test="dmodelStatus != null"> | 
|         AND `dmodel`.`STATUS` = #{dmodelStatus} | 
|       </if> | 
|       <if test="dmodelSupplier != null and dmodelSupplier != ''"> | 
|         AND `dmodel`.`SUPPLIER` = #{dmodelSupplier} | 
|       </if> | 
|       <if test="dmodelStationCode != null and dmodelStationCode != ''"> | 
|         AND `dmodel`.`STATION_CODE` = #{dmodelStationCode} | 
|       </if> | 
|       <if test="dmodelGroupId != null"> | 
|         AND `dmodel`.`GROUP_ID` = #{dmodelGroupId} | 
|       </if> | 
|       <if test="dmodelSerialNum != null and dmodelSerialNum != ''"> | 
|         AND `dmodel`.`SERIAL_NUM` = #{dmodelSerialNum} | 
|       </if> | 
|     </where> | 
| limit 1 | 
|   </select> | 
| </mapper> |