zouxuan 1 gadu atpakaļ
vecāks
revīzija
8ccb5022bc

+ 1 - 1
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/dal/dao/SysUserDao.java

@@ -179,5 +179,5 @@ public interface SysUserDao extends BaseDAO<Long, SysUser> {
 
     void updateLockStatusByPhone(@Param("phone") String phone);
 
-    int countByPhont(@Param("phone") String phone);
+    int countByPhone(@Param("phone") String phone);
 }

+ 1 - 1
cooleshow-auth/auth-server/src/main/java/com/yonge/cooleshow/auth/service/impl/SysUserServiceImpl.java

@@ -412,7 +412,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<Long, SysUser> implement
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void logoffByPhone(String phone) {
-        int num = sysUserDao.countByPhont(phone);
+        int num = sysUserDao.countByPhone(phone);
         //冻结相关所有客户端账号
         sysUserDao.updateLockStatusByPhone(phone);
         //注销用户

+ 11 - 0
cooleshow-auth/auth-server/src/main/resources/config/mybatis/SysUserMapper.xml

@@ -316,5 +316,16 @@
             update employee set lock_flag_ = #{lockFlag} where user_id_ = #{userId}
         </if>
     </update>
+    <update id="logoffByPhone">
+        update sys_user set del_flag_ = 1, phone_ = concat(#{num},'D', phone_),update_time_ = now() where phone_ = #{phone}
+    </update>
+    <update id="updateLockStatusByPhone">
+        update student set lock_flag_ = 1 where user_id_ = (select id_ from sys_user where phone_ = #{phone});
+        update teacher set lock_flag_ = 1 where user_id_ = (select id_ from sys_user where phone_ = #{phone});
+        update employee set lock_flag_ = 1 where user_id_ = (select id_ from sys_user where phone_ = #{phone});
+    </update>
+    <select id="countByPhone" resultType="java.lang.Integer">
+        SELECT count(1) FROM sys_user WHERE phone_ LIKE CONCAT('%',#{phone},'%')
+    </select>
 
 </mapper>