|
@@ -9,6 +9,9 @@
|
|
|
<result column="device_num_" property="deviceNum" />
|
|
|
<result column="bind_time_" property="bindTime" />
|
|
|
<result column="device_type_" property="deviceType" />
|
|
|
+ <result column="client_id_" property="clientId" />
|
|
|
+ <result column="del_flag_" property="delFlag" />
|
|
|
+ <result column="update_time_" property="updateTime" />
|
|
|
<result column="phone_" property="user.phone" />
|
|
|
<result column="real_name_" property="user.realName" />
|
|
|
</resultMap>
|
|
@@ -31,8 +34,8 @@
|
|
|
<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
|
|
|
AS ID FROM DUAL </selectKey> -->
|
|
|
INSERT INTO sys_user_device
|
|
|
- (id_,user_id_,device_num_,bind_time_,device_type_)
|
|
|
- VALUES(#{id},#{userId},#{deviceNum},#{bindTime},#{deviceType})
|
|
|
+ (id_,user_id_,device_num_,bind_time_,device_type_,client_id_,del_flag_)
|
|
|
+ VALUES(#{id},#{userId},#{deviceNum},#{bindTime},#{deviceType},#{clientId},0)
|
|
|
</insert>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
@@ -54,6 +57,13 @@
|
|
|
<if test="bindTime != null">
|
|
|
bind_time_ = #{bindTime},
|
|
|
</if>
|
|
|
+ <if test="clientId != null">
|
|
|
+ client_id_ = #{clientId},
|
|
|
+ </if>
|
|
|
+ <if test="delFlag != null">
|
|
|
+ del_flag_ = #{delFlag},
|
|
|
+ </if>
|
|
|
+ update_time_ = now()
|
|
|
</set>
|
|
|
WHERE id_ = #{id}
|
|
|
</update>
|
|
@@ -66,20 +76,19 @@
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="SysUserDevice" parameterType="map">
|
|
|
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 date(bind_time_) >= #{bindStartTime}
|
|
|
- </if>
|
|
|
- <if test="bindEndTime != null">
|
|
|
- and date(bind_time_) <= #{bindEndTime}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ where del_flag_ = 0
|
|
|
+ <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 date(bind_time_) >= #{bindStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="bindEndTime != null">
|
|
|
+ and date(bind_time_) <= #{bindEndTime}
|
|
|
+ </if>
|
|
|
ORDER BY id_
|
|
|
<include refid="global.limit" />
|
|
|
</select>
|
|
@@ -87,28 +96,33 @@
|
|
|
<!-- 查询当前表的总记录数 -->
|
|
|
<select id="queryCount" resultType="int">
|
|
|
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 date(bind_time_) >= #{bindStartTime}
|
|
|
- </if>
|
|
|
- <if test="bindEndTime != null">
|
|
|
- and date(bind_time_) <= #{bindEndTime}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ where del_flag_ = 0
|
|
|
+ <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 date(bind_time_) >= #{bindStartTime}
|
|
|
+ </if>
|
|
|
+ <if test="bindEndTime != null">
|
|
|
+ and date(bind_time_) <= #{bindEndTime}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryByUserId" resultMap="SysUserDevice">
|
|
|
- SELECT * FROM sys_user_device WHERE user_id_ = #{userId}
|
|
|
+ <select id="queryByUserId" resultMap="SysUserDevice" parameterType="map">
|
|
|
+ SELECT * FROM sys_user_device WHERE user_id_ = #{userId} and del_flag_ = 0
|
|
|
+ <if test="clientId != null">
|
|
|
+ and client_id_ = #{clientId}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryByDeviceNum" resultMap="SysUserDevice">
|
|
|
- SELECT * FROM sys_user_device WHERE device_num_ = #{deviceNum}
|
|
|
+ <select id="queryByDeviceNum" resultMap="SysUserDevice" parameterType="map">
|
|
|
+ SELECT * FROM sys_user_device WHERE device_num_ = #{deviceNum} and del_flag_ = 0
|
|
|
+ <if test="clientId != null">
|
|
|
+ and client_id_ = #{clientId}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|