|
@@ -9,11 +9,13 @@ import com.xiaoan.common.util.ResultJson;
|
|
import com.xiaoan.domain.backend.LogEntity;
|
|
import com.xiaoan.domain.backend.LogEntity;
|
|
import com.xiaoan.domain.backend.UserEntity;
|
|
import com.xiaoan.domain.backend.UserEntity;
|
|
import com.xiaoan.domain.dto.request.UserRequest;
|
|
import com.xiaoan.domain.dto.request.UserRequest;
|
|
|
|
+import com.xiaoan.domain.dto.response.IssueResponse;
|
|
import com.xiaoan.domain.dto.response.LogResponse;
|
|
import com.xiaoan.domain.dto.response.LogResponse;
|
|
import com.xiaoan.domain.dto.response.UserResponse;
|
|
import com.xiaoan.domain.dto.response.UserResponse;
|
|
import com.xiaoan.service.backend.LogService;
|
|
import com.xiaoan.service.backend.LogService;
|
|
import com.xiaoan.service.backend.UserService;
|
|
import com.xiaoan.service.backend.UserService;
|
|
import com.xiaoan.web.aop.WebControllerLog;
|
|
import com.xiaoan.web.aop.WebControllerLog;
|
|
|
|
+import com.xiaoan.web.shiro.JWTUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -37,23 +39,32 @@ public class LogController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private LogService logService;
|
|
private LogService logService;
|
|
|
|
|
|
- @WebControllerLog(description = "操作日志-查看日志列表")
|
|
|
|
- @ApiOperation("分页获取日志列表")
|
|
|
|
- @PostMapping("list")
|
|
|
|
- public ResultJson list(@RequestBody PageDto param){
|
|
|
|
- PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
|
- List<LogResponse> list = logService.findAllToUserName();
|
|
|
|
- PageInfo<LogResponse> pageInfo = new PageInfo<>(list);
|
|
|
|
|
|
+// @WebControllerLog(description = "操作日志-查看日志列表")
|
|
|
|
+// @ApiOperation("分页获取日志列表")
|
|
|
|
+// @PostMapping("list")
|
|
|
|
+// public ResultJson list(@RequestBody PageDto param){
|
|
|
|
+// PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
|
+// List<LogResponse> list = logService.findAllToUserName();
|
|
|
|
+// PageInfo<LogResponse> pageInfo = new PageInfo<>(list);
|
|
|
|
+//
|
|
|
|
+// return new ResultJson(MsgCode.SUCCESS_CODE, pageInfo);
|
|
|
|
+// }
|
|
|
|
|
|
- return new ResultJson(MsgCode.SUCCESS_CODE, pageInfo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @WebControllerLog(description = "操作日志-日志搜索")
|
|
|
|
- @ApiOperation("搜索")
|
|
|
|
|
|
+ @WebControllerLog(description = "操作日志-日志搜索/列表")
|
|
|
|
+ @ApiOperation("搜索/列表共用")
|
|
@PostMapping("search")
|
|
@PostMapping("search")
|
|
public ResultJson search(@RequestBody PageDto param){
|
|
public ResultJson search(@RequestBody PageDto param){
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
- List<LogResponse> list = logService.search(param.getItemName());
|
|
|
|
|
|
+ List<LogResponse> list = null;
|
|
|
|
+
|
|
|
|
+ List userRole = JWTUtil.getUserRole(getToken());
|
|
|
|
+ if (userRole.contains("admin")) {
|
|
|
|
+ list = logService.search(param.getItemName());
|
|
|
|
+ } else {
|
|
|
|
+ Long userId = JWTUtil.getUserId(getToken());
|
|
|
|
+ list = logService.search(param.getItemName(), userId);
|
|
|
|
+ }
|
|
|
|
+
|
|
PageInfo<LogResponse> pageInfo = new PageInfo<>(list);
|
|
PageInfo<LogResponse> pageInfo = new PageInfo<>(list);
|
|
return new ResultJson(MsgCode.SUCCESS_CODE, pageInfo);
|
|
return new ResultJson(MsgCode.SUCCESS_CODE, pageInfo);
|
|
}
|
|
}
|