修复日志删除Long型Id问题

This commit is contained in:
liuweijw
2018-07-04 18:35:07 +08:00
parent 82380f044a
commit 2f0eba10a8
2 changed files with 12 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
package com.github.liuweijw.business.admin.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@@ -50,6 +52,13 @@ public class LogInfoServiceImpl implements LogInfoService {
Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "id"));
PageRequest pageRequest = PageUtils.of(pageParams, sort);
Page<LogInfo> pageList = logInfoRepository.findAll(predicate, pageRequest);
List<LogInfo> cList = pageList.getContent();
if (null != cList && cList.size() > 0) {
cList.forEach(log -> {
log.setIdView(log.getId() + "");
});
}
return PageUtils.of(pageList);
}

View File

@@ -37,7 +37,9 @@ public class LogController extends BaseController {
@RequestMapping(value = "/del/{id}", method = RequestMethod.POST)
@PrePermissions(value = Functional.DEL)
public R<Boolean> del(HttpServletRequest request, @PathVariable Long id) {
if (null == id || id.intValue() <= 0) return new R<Boolean>().failure("日志id为空");
if (null == id || id <= 0)
return new R<Boolean>().data(false).failure("日志id为空");
boolean isDel = this.logInfoService.delById(id);
return new R<Boolean>().data(isDel);
}