删除无用接口

This commit is contained in:
liuchengqian 2023-03-10 09:16:11 +08:00
parent 5667ef5525
commit 25faa09c83
5 changed files with 4 additions and 58 deletions

View File

@ -206,20 +206,6 @@ public class SysUserController {
return sysUserService.deleteSysUser(userName);
}
/**
* 软删除指定id的普通用户
*/
@RequestMapping(value = "/general/delete", method = RequestMethod.DELETE)
public String deleteCustomUser(@RequestParam(value = "userId", required = false) Long id) {
// 验证数据合法性
int res = sysUserService.softDeleteGeneralUser(id);
if (res == 1) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "", locale);
} else {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
}
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String updateUser(@Validated({SysUserQoUpdate.class}) @RequestBody SysUserQo userQo, BindingResult bindingResult) {
// 验证数据合法性

View File

@ -13,15 +13,6 @@ import java.util.List;
@Component
public interface SysRoleDao extends JpaRepository<SysRoleEntity, Long>, JpaSpecificationExecutor<SysRoleEntity> {
/**
* 查询用户角色列表根据用户id
*
* @param id
* @return
*/
@Query(value = "SELECT sys_role.id,sys_role.role_name,sys_role.role_name_zh,sys_role.role_desc FROM sys_role,rel_user_role WHERE sys_role.id = rel_user_role.role_id AND rel_user_role.user_id = :id ", nativeQuery = true)
List<SysRoleEntity> selectByUserId(@Param("id") Long id);
/**
* 查询用户角色列表根据用户名
*

View File

@ -35,13 +35,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Long>, JpaSpeci
@Query(value = "SELECT * FROM sys_user WHERE user_name = :userName", nativeQuery = true)
SysUserEntity selectByUserName(@Param("userName") String userName);
/**
* 软删除系统用户根据id
*/
@Modifying
@Query(value = "UPDATE sys_user SET delete_flag = 1 " + "WHERE id = :id ;", nativeQuery = true)
void softDeleteGeneralUserById(@Param("id") Long id);
/**
* 删除系统用户危险操作
*/

View File

@ -51,14 +51,6 @@ public interface SysUserService {
*/
int updateSysUser(SysUserQo sysUserQo);
/**
* 软删除系统用户
*
* @param id
* @return
*/
int softDeleteGeneralUser(Long id);
/**
* 查询用户的信息
*

View File

@ -2,7 +2,10 @@ package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.*;
import com.xkrs.model.entity.*;
import com.xkrs.model.entity.RelRoleAuthorityEntity;
import com.xkrs.model.entity.RelUserRoleEntity;
import com.xkrs.model.entity.StreetEntity;
import com.xkrs.model.entity.SysUserEntity;
import com.xkrs.model.qo.SysUserQo;
import com.xkrs.service.RedisService;
import com.xkrs.service.SysUserService;
@ -203,25 +206,6 @@ public class SysUserServiceImpl implements SysUserService {
return 1;
}
/**
* 软删除普通用户
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int softDeleteGeneralUser(Long id) {
String adminRole = "role_administor";
String sysRole = "role_system_manager";
List<SysRoleEntity> list = sysRoleDao.selectByUserId(id);
if (list.size() > 0) {
SysRoleEntity sysRoleEntity = list.get(1);
if (sysRole.equals(sysRoleEntity.getRoleName()) || adminRole.equals(sysRoleEntity.getRoleName())) {
sysUserDao.softDeleteGeneralUserById(id);
return 0;
}
}
return 1;
}
/**
* 查询用户的信息
*/