删除系统用户

This commit is contained in:
liuchengqian 2022-05-12 09:04:50 +08:00
parent 9f3563121c
commit 2cb11615cd
3 changed files with 52 additions and 15 deletions

View File

@ -88,6 +88,12 @@ public class SysUserController {
return sysUserService.addUser(userQo);
}
@RequestMapping(value = "/general/deletesysuser", method = RequestMethod.DELETE)
@PreAuthorize("hasAnyAuthority('auth_system_manager','auth_general_user')")
public String deleteSysUser(@RequestParam(value = "userName") String userName) {
return sysUserService.deleteSysUser(userName);
}
/**
* 软删除指定id的普通用户
*

View File

@ -3,39 +3,44 @@ package com.xkrs.service;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo;
import com.xkrs.model.vo.SysUserVo;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Map;
/**
* 系统用户服务接口
*
* @author tajochen
*/
public interface SysUserService {
/**
* 检查用户名
*
* @param userName
* @return
*/
boolean checkUserName(String userName);
/**
* 获取所有用户
* @return
*/
//Iterable<SysUserVo> getAllSysUser();
/**
* 保存用户
*
* @param sysUserQo
* @return
*/
String addUser(SysUserQo sysUserQo);
/**
* 删除系统用户
*
* @param userName
* @return
*/
String deleteSysUser(String userName);
/**
* 获取系统用户实体根据用户名
*
* @param userName
* @return
*/
@ -43,6 +48,7 @@ public interface SysUserService {
/**
* 用户登录更新
*
* @param userName
* @param ipAddress
* @return
@ -51,6 +57,7 @@ public interface SysUserService {
/**
* 系统用户更新
*
* @param sysUserQo
* @return
*/
@ -58,6 +65,7 @@ public interface SysUserService {
/**
* 软删除系统用户
*
* @param id
* @return
*/
@ -65,43 +73,49 @@ public interface SysUserService {
/**
* 查询用户的信息
*
* @return
*/
List<SysUserVo> selectAllUser();
/**
* 启用
*
* @param userId
*/
void updateEnable(Integer userId);
/**
* 禁用
*
* @param userId
*/
void updateDisable(Integer userId);
/**
* 用户修改密码
*
* @param oldPassword
* @param newPassword
* @param confirmPassword
* @param sysUserEntity
* @return
*/
String updatePassword(String oldPassword,String newPassword,String confirmPassword,SysUserEntity sysUserEntity);
String updatePassword(String oldPassword, String newPassword, String confirmPassword, SysUserEntity sysUserEntity);
/**
* 管理员修改用户的密码
*
* @param userId
* @param newPassword
* @param confirmPassword
* @return
*/
String adminUpdatePassword(Integer userId,String newPassword,String confirmPassword);
String adminUpdatePassword(Integer userId, String newPassword, String confirmPassword);
/**
* 获取系统用户实体根据用户名
*
* @param userName
* @return
*/
@ -109,6 +123,7 @@ public interface SysUserService {
/**
* 按天数修改账号到期时间
*
* @param userId
* @param dayNum
* @return
@ -117,6 +132,7 @@ public interface SysUserService {
/**
* 按月份修改账号到期时间
*
* @param userId
* @param dayNum
* @return
@ -125,6 +141,7 @@ public interface SysUserService {
/**
* 按年份修改账号到期时间
*
* @param userId
* @param dayNum
* @return
@ -133,6 +150,7 @@ public interface SysUserService {
/**
* 设置账号时间永久有效
*
* @param userId
* @return
*/
@ -140,40 +158,45 @@ public interface SysUserService {
/**
* 修改账号到期时间
*
* @param userId
* @param overTime
* @return
*/
String updateOverTime(Integer userId,String overTime);
String updateOverTime(Integer userId, String overTime);
/**
* 记录用户登录次数
*
* @param userId
* @param loginNum
*/
void updateLoginNum(Integer userId,Integer loginNum);
void updateLoginNum(Integer userId, Integer loginNum);
/**
* 记录用户登录时间
*
* @param userId
* @param loginLastTime
*/
void updateLoginLastTime(Integer userId,String loginLastTime);
void updateLoginLastTime(Integer userId, String loginLastTime);
List<Map<String,String>> findCityByProCode(String proCode);
List<Map<String, String>> findCityByProCode(String proCode);
/**
* 通过省编码查询县名称和编码
*
* @param proCode
* @return
*/
List<Map<String,String>> findCountyByProCode(String proCode);
List<Map<String, String>> findCountyByProCode(String proCode);
/**
* 通过市编码查询区县名称和编码
*
* @param cityCode
* @return
*/
List<Map<String,String>> findCountyByCityCode(String cityCode);
List<Map<String, String>> findCountyByCityCode(String cityCode);
}

View File

@ -181,6 +181,14 @@ public class SysUserServiceImpl implements SysUserService {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "注册成功!", locale);
}
@Transactional(rollbackFor = Exception.class)
@Override
public String deleteSysUser(String userName) {
Locale locale = LocaleContextHolder.getLocale();
int deleteCount = sysUserDao.deleteSysUser(userName);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除" + deleteCount + "个账户", locale);
}
/**
* 查询所有用户Vo
*