用户模块接口优化

This commit is contained in:
linfeng 2023-08-21 09:05:14 +08:00
parent 7f1aa34efd
commit 99312a646f
2 changed files with 3 additions and 7 deletions

View File

@ -64,14 +64,7 @@ public class AppUserController {
}
@PostMapping("/save")
@RequiresPermissions("admin:user:save")
@ApiOperation("用户保存")
public R save(@RequestBody AppUserEntity user){
appUserService.save(user);
return R.ok();
}
@PostMapping("/update")

View File

@ -97,6 +97,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override
@Transactional(rollbackFor = Exception.class)
public void ban(Integer id) {
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
if (status.equals(Constant.USER_BANNER)) {
@ -104,6 +105,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
}
this.lambdaUpdate()
.set(AppUserEntity::getStatus, 1)
.set(AppUserEntity::getUpdateTime,new Date())
.eq(AppUserEntity::getUid, id)
.update();
}
@ -117,6 +119,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
}
boolean update = this.lambdaUpdate()
.set(AppUserEntity::getStatus, 0)
.set(AppUserEntity::getUpdateTime,new Date())
.eq(AppUserEntity::getUid, id)
.update();
if(!update){