Commit 6ee234b5 by guojuxing

用户删除接口

parent ae627265
......@@ -82,4 +82,14 @@ public interface TabSysUserMapper {
* @return java.util.List<com.gic.auth.entity.TabSysUser>


 */
List<UserListDTO> listUser(UserListQO params);
/**
* 逻辑删除
* @Title: deleteById

* @Description:

 * @author guojuxing
* @param userId

* @return int


 */
int deleteById(@Param("userId") Integer userId);
}
\ No newline at end of file
......@@ -53,4 +53,14 @@ public interface UserService {
* @return com.github.pagehelper.Page


 */
Page<UserListDTO> pageUser(UserListQO params);
/**
* 逻辑删除
* @Title: delete

* @Description:

 * @author guojuxing
* @param userId

* @return void


 */
void delete(Integer userId);
}
......@@ -75,4 +75,9 @@ public class UserServiceImpl implements UserService {
List<UserListDTO> list = tabSysUserMapper.listUser(params);
return (Page) list;
}
@Override
public void delete(Integer userId) {
tabSysUserMapper.deleteById(userId);
}
}
......@@ -98,6 +98,16 @@ public class RoleApiServiceImpl implements RoleApiService{
}
@Override
public ServiceResponse<Void> delete(Integer id) {
TabSysRole record = roleService.getById(id);
if (record == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "角色数据有误,查无数据");
}
roleService.deleteById(id);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Page<RoleListDTO>> pageRole(RoleListQO params) {
com.github.pagehelper.Page page = roleService.pageRole(params);
Page<RoleListDTO> resultPage = PageHelperUtils.changePageHelperToCurrentPage(page);
......
......@@ -145,6 +145,16 @@ public class UserApiServiceImpl implements UserApiService {
}
@Override
public ServiceResponse<Void> delete(Integer userId) {
TabSysUser tabUser = userService.getUserById(userId);
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户ID输入有误,无此数据");
}
userService.delete(userId);
return ServiceResponse.success();
}
@Override
public ServiceResponse<UserDTO> getUserByEnterpriseId(Integer enterpriseId) {
TabSysUser tabUser = userService.getUserByEnterpriseId(enterpriseId);
if (enterpriseId == null) {
......
......@@ -238,4 +238,12 @@
and c.resource_id = #{resourceId}
</if>
</select>
<update id="deleteById">
update tab_sys_user set status = 0
where user_id = #{userId}
and status = 1
</update>
</mapper>
\ No newline at end of file
......@@ -37,6 +37,11 @@ public class RoleController {
return ResultControllerUtils.commonResult(roleApiService.update(dto));
}
@RequestMapping("/delete")
public RestResponse delete(Integer id) {
return ResultControllerUtils.commonResult(roleApiService.delete(id));
}
@RequestMapping("/list-role")
public RestResponse listRole(RoleListQO params) {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......
......@@ -60,6 +60,11 @@ public class UserController {
return ResultControllerUtils.commonResultOne(userApiService.getUserById(userId), UserDetailVO.class);
}
@RequestMapping("/delete-user-by-id")
public RestResponse delete(Integer userId) {
return ResultControllerUtils.commonResult(userApiService.delete(userId));
}
@RequestMapping("/list-user")
public RestResponse listUser(UserListQO params) {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment