|
@@ -34,26 +34,29 @@
|
|
|
|
|
|
<!-- 查询条件 -->
|
|
|
<sql id="queryCondition">
|
|
|
- <if test="userStartDate != null">
|
|
|
- and create_time_ >= #{createStartDate}
|
|
|
- </if>
|
|
|
- <if test="userEndDate != null">
|
|
|
- and create_time_ <= #{createEndDate}
|
|
|
- </if>
|
|
|
- <if test="userType != null">
|
|
|
- and user_type_ = #{userType}
|
|
|
- </if>
|
|
|
+ <where>
|
|
|
+ and del_flag_ = 0
|
|
|
+ <if test="userStartDate != null">
|
|
|
+ and create_time_ >= #{createStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="userEndDate != null">
|
|
|
+ and create_time_ <= #{createEndDate}
|
|
|
+ </if>
|
|
|
+ <if test="userType != null">
|
|
|
+ and user_type_ = #{userType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
</sql>
|
|
|
|
|
|
<!-- 根据主键查询一条记录 -->
|
|
|
<select id="get" resultMap="SysUser">
|
|
|
SELECT su.* FROM sys_user su
|
|
|
- WHERE su.id_ = #{id}
|
|
|
+ WHERE su.del_flag_ = 0 and su.id_ = #{id}
|
|
|
</select>
|
|
|
|
|
|
<!-- 全查询 -->
|
|
|
<select id="findAll" resultMap="SysUser">
|
|
|
- SELECT * FROM sys_user ORDER BY id_
|
|
|
+ SELECT * FROM sys_user where del_flag_ = 0 ORDER BY id_
|
|
|
</select>
|
|
|
|
|
|
<!-- 向数据库增加一条记录 -->
|
|
@@ -151,13 +154,13 @@
|
|
|
certificate_type_ = #{certificateType},
|
|
|
</if>
|
|
|
</set>
|
|
|
- WHERE id_ = #{id}
|
|
|
+ WHERE del_flag_ = 0 and id_ = #{id}
|
|
|
</update>
|
|
|
<update id="updatePasswordReq">
|
|
|
- UPDATE sys_user SET password_ = #{password} WHERE phone_ = #{mobile}
|
|
|
+ UPDATE sys_user SET password_ = #{password} WHERE del_flag_ = 0 and phone_ = #{mobile}
|
|
|
</update>
|
|
|
<update id="refreshImToken">
|
|
|
- UPDATE sys_user SET im_token_ = #{imToken},update_time_ = NOW() WHERE id_ = #{userId}
|
|
|
+ UPDATE sys_user SET im_token_ = #{imToken},update_time_ = NOW() WHERE del_flag_ = 0 and id_ = #{userId}
|
|
|
</update>
|
|
|
|
|
|
<!-- 根据主键删除一条记录 -->
|
|
@@ -167,7 +170,7 @@
|
|
|
|
|
|
<!-- 分页查询 -->
|
|
|
<select id="queryPage" resultMap="SysUser" parameterType="map">
|
|
|
- SELECT * FROM sys_user ORDER BY id_
|
|
|
+ SELECT * FROM sys_user
|
|
|
<include refid="queryCondition"/>
|
|
|
<include refid="global.orderby"/>
|
|
|
<include refid="global.limit"/>
|
|
@@ -180,15 +183,15 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryByUsername" resultMap="SysUser">
|
|
|
- select * from sys_user where username_ = #{username} OR phone_ = #{username} LIMIT 1 FOR UPDATE
|
|
|
+ select * from sys_user where del_flag_ = 0 and username_ = #{username} OR phone_ = #{username} LIMIT 1 FOR UPDATE
|
|
|
</select>
|
|
|
|
|
|
<select id="queryByPhone" resultMap="SysUser">
|
|
|
- select * from sys_user where phone_ = #{phone} OR username_ = #{phone} LIMIT 1
|
|
|
+ select * from sys_user where del_flag_ = 0 and phone_ = #{phone} OR username_ = #{phone} LIMIT 1
|
|
|
</select>
|
|
|
|
|
|
<select id="queryLockByPhone" resultMap="SysUser">
|
|
|
- select * from sys_user where phone_ = #{phone} OR username_ = #{phone} LIMIT 1 FOR UPDATE
|
|
|
+ select * from sys_user where del_flag_ = 0 and phone_ = #{phone} OR username_ = #{phone} LIMIT 1 FOR UPDATE
|
|
|
</select>
|
|
|
<resultMap id="ImUserModel" type="com.yonge.cooleshow.common.entity.ImUserModel">
|
|
|
<result column="id_" property="id"/>
|
|
@@ -197,20 +200,20 @@
|
|
|
</resultMap>
|
|
|
<select id="getBasic" resultMap="ImUserModel">
|
|
|
select CASE WHEN user_type_ LIKE '%TEACHER%' OR user_type_ LIKE '%SYSTEM%' THEN real_name_ ELSE username_ END username_,id_,avatar_
|
|
|
- from sys_user where id_ = #{userId} LIMIT 1
|
|
|
+ from sys_user where del_flag_ = 0 and id_ = #{userId} LIMIT 1
|
|
|
</select>
|
|
|
|
|
|
<select id="queryByStatus" resultMap="SysUser">
|
|
|
- select * from sys_user where lock_flag_ = #{status}
|
|
|
+ select * from sys_user where del_flag_ = 0 and lock_flag_ = #{status}
|
|
|
</select>
|
|
|
<select id="findUserBySalt" resultMap="SysUser">
|
|
|
- SELECT * FROM sys_user WHERE salt_ IS NOT NULL AND salt_ = 'replace' AND user_type_ LIKE CONCAT('%',#{userType},'%') LIMIT 1
|
|
|
+ SELECT * FROM sys_user WHERE del_flag_ = 0 and salt_ IS NOT NULL AND salt_ = 'replace' AND user_type_ LIKE CONCAT('%',#{userType},'%') LIMIT 1
|
|
|
</select>
|
|
|
<select id="getTeacherOrganId" resultType="java.lang.Integer">
|
|
|
SELECT organ_id_ FROM teacher WHERE id_ = #{userId}
|
|
|
</select>
|
|
|
<select id="queryByPhoneAndClient" resultMap="SysUser">
|
|
|
- select * from sys_user where (phone_ = #{phone} OR username_ = #{phone}) AND user_type_ LIKE CONCAT('%',#{client},'%') LIMIT 1 FOR UPDATE
|
|
|
+ select * from sys_user where del_flag_ = 0 and (phone_ = #{phone} OR username_ = #{phone}) AND user_type_ LIKE CONCAT('%',#{client},'%') LIMIT 1 FOR UPDATE
|
|
|
</select>
|
|
|
|
|
|
<update id="updateUserCard">
|
|
@@ -229,7 +232,7 @@
|
|
|
birthdate_ = #{param.birthday},
|
|
|
</if>
|
|
|
update_time_ = now()
|
|
|
- WHERE id_ = #{param.userId}
|
|
|
+ WHERE del_flag_ = 0 and id_ = #{param.userId}
|
|
|
</update>
|
|
|
|
|
|
<select id="getSetDetail" resultType="com.yonge.cooleshow.auth.api.vo.UserSetVo">
|
|
@@ -241,7 +244,7 @@
|
|
|
u.birthdate_ as birthdate,
|
|
|
(case when isnull(u.id_card_no_) then 0 else 1 end) as isReal
|
|
|
FROM sys_user u
|
|
|
- where u.id_ = #{id}
|
|
|
+ where u.del_flag_ = 0 and u.id_ = #{id}
|
|
|
</select>
|
|
|
|
|
|
<update id="updatetSetDetail">
|
|
@@ -260,7 +263,7 @@
|
|
|
birthdate_ = #{param.birthdate},
|
|
|
</if>
|
|
|
update_time_ = now()
|
|
|
- WHERE id_ = #{id}
|
|
|
+ WHERE del_flag_ = 0 and id_ = #{id}
|
|
|
</update>
|
|
|
<update id="updateImGroupMember">
|
|
|
UPDATE im_group_member SET avatar_ = #{avatar},nickname_ = #{username} WHERE user_id_ = #{userId}
|
|
@@ -268,16 +271,15 @@
|
|
|
<update id="updateImUserFriend">
|
|
|
UPDATE im_user_friend SET friend_avatar_ = #{avatar},friend_nickname_ = #{username} WHERE friend_id_ = #{userId}
|
|
|
</update>
|
|
|
-
|
|
|
<update id="logoffById">
|
|
|
- insert into sys_user_off select * from sys_user where id_ = ${userId}
|
|
|
+ update sys_user set del_flag_ = ${num}, phone_ = concat('D', ${num}, '+', phone_) where id_ = ${userId}
|
|
|
</update>
|
|
|
-
|
|
|
<select id="queryEmployeeList" resultMap="SysUser">
|
|
|
select su.*
|
|
|
from employee e
|
|
|
left join sys_user su on su.id_ = e.user_id_
|
|
|
<where>
|
|
|
+ su.del_flag_ = 0
|
|
|
<if test="createStartDate != null and createStartDate != ''">
|
|
|
and #{createStartDate} <= e.create_time_
|
|
|
</if>
|
|
@@ -287,4 +289,9 @@
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="queryMaxVersionById" resultType="java.lang.Integer">
|
|
|
+ select max(del_flag_) from sys_user
|
|
|
+ where phone_ like CONCAT('%',(select phone_ from sys_user where id_ = #{id} and del_flag_ = 0),'%')
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|