|
@@ -9,6 +9,8 @@
|
|
|
<result column="device_num_" property="deviceNum" />
|
|
|
<result column="bind_time_" property="bindTime" />
|
|
|
<result column="device_type_" property="deviceType" />
|
|
|
+ <result column="phone_" property="user.phone" />
|
|
|
+ <result column="real_name_" property="user.realName" />
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -63,13 +65,42 @@
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="SysUserDevice" parameterType="map">
|
|
|
- SELECT * FROM sys_user_device ORDER BY id_
|
|
|
+ SELECT ud.*,u.phone_,u.real_name_ FROM sys_user_device ud left join sys_user u on ud.user_id_ = u.id_
|
|
|
+ <where>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="deviceNum != null">
|
|
|
+ and device_num_ = #{deviceNum}
|
|
|
+ </if>
|
|
|
+ <if test="bindStartTime != null">
|
|
|
+ and bind_time_ >= #{bindStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="bindEndTime != null">
|
|
|
+ and bind_time_ <= #{bindEndTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY id_
|
|
|
<include refid="global.limit" />
|
|
|
</select>
|
|
|
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*) FROM sys_user_device
|
|
|
+ SELECT COUNT(ud.user_id_) FROM sys_user_device ud left join sys_user u on ud.user_id_ = u.id_
|
|
|
+ <where>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="deviceNum != null">
|
|
|
+ and device_num_ = #{deviceNum}
|
|
|
+ </if>
|
|
|
+ <if test="bindStartTime != null">
|
|
|
+ and bind_time_ >= #{bindStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="bindEndTime != null">
|
|
|
+ and bind_time_ <= #{bindEndTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<select id="queryByUserId" resultMap="SysUserDevice">
|