提交roll全部删除功能
This commit is contained in:
+39
-10
@@ -113,16 +113,45 @@ public class TtRollController extends BaseController {
|
||||
}
|
||||
|
||||
@ApiOperation("删除roll房")
|
||||
@DeleteMapping("/remove/{rollId}")
|
||||
public AjaxResult remove(@PathVariable Long rollId) {
|
||||
LambdaQueryWrapper<TtRollUser> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TtRollUser::getRollId, rollId);
|
||||
List<TtRollUser> list = rollUserService.list(wrapper);
|
||||
TtRoll ttRoll = rollService.getById(rollId);
|
||||
ttRoll.setUpdateBy(getUsername());
|
||||
ttRoll.setUpdateTime(DateUtils.getNowDate());
|
||||
rollService.updateById(ttRoll);
|
||||
return toAjax(rollService.removeById(rollId));
|
||||
@DeleteMapping("/remove/{rollIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] rollIds) {
|
||||
int count = 0;
|
||||
for (Long rollId : rollIds) {
|
||||
LambdaQueryWrapper<TtRollUser> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TtRollUser::getRollId, rollId);
|
||||
List<TtRollUser> list = rollUserService.list(wrapper);
|
||||
TtRoll ttRoll = rollService.getById(rollId);
|
||||
if (ttRoll == null) {
|
||||
continue;
|
||||
}
|
||||
ttRoll.setUpdateBy(getUsername());
|
||||
ttRoll.setUpdateTime(DateUtils.getNowDate());
|
||||
rollService.updateById(ttRoll);
|
||||
if (rollService.removeById(rollId)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return toAjax(count);
|
||||
}
|
||||
|
||||
@ApiOperation("一键删除所有roll房")
|
||||
@DeleteMapping("/removeAll")
|
||||
public AjaxResult removeAll() {
|
||||
List<TtRoll> list = rollService.list();
|
||||
int count = 0;
|
||||
for (TtRoll roll : list) {
|
||||
Long rollId = roll.getId();
|
||||
LambdaQueryWrapper<TtRollUser> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(TtRollUser::getRollId, rollId);
|
||||
List<TtRollUser> rollUserList = rollUserService.list(wrapper);
|
||||
roll.setUpdateBy(getUsername());
|
||||
roll.setUpdateTime(DateUtils.getNowDate());
|
||||
rollService.updateById(roll);
|
||||
if (rollService.removeById(rollId)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return toAjax(count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user