|
@@ -2,6 +2,7 @@ package com.jeeplus.test.projectRecords.controller;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -11,6 +12,8 @@ import com.jeeplus.aop.logging.annotation.ApiLog;
|
|
import com.jeeplus.core.excel.ExcelOptions;
|
|
import com.jeeplus.core.excel.ExcelOptions;
|
|
import com.jeeplus.core.excel.ExportMode;
|
|
import com.jeeplus.core.excel.ExportMode;
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
|
|
+import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
import com.jeeplus.test.projectRecords.constant.enums.ProjectStatusEnum;
|
|
import com.jeeplus.test.projectRecords.constant.enums.ProjectStatusEnum;
|
|
import com.jeeplus.test.projectRecords.constant.enums.ProjectTypeEnum;
|
|
import com.jeeplus.test.projectRecords.constant.enums.ProjectTypeEnum;
|
|
import com.jeeplus.test.projectRecords.constant.enums.YesOrNoEnum;
|
|
import com.jeeplus.test.projectRecords.constant.enums.YesOrNoEnum;
|
|
@@ -71,7 +74,8 @@ public class ProjectController {
|
|
@PreAuthorize("hasAuthority('sys:project:list')")
|
|
@PreAuthorize("hasAuthority('sys:project:list')")
|
|
@GetMapping("list")
|
|
@GetMapping("list")
|
|
public ResponseEntity<IPage<Project>> data(Project project, Page<Project> page) throws Exception {
|
|
public ResponseEntity<IPage<Project>> data(Project project, Page<Project> page) throws Exception {
|
|
- IPage<Project> result = projectService.selectPage (page,project);
|
|
|
|
|
|
+ QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( project, Project.class );
|
|
|
|
+ IPage<Project> result = projectService.selectPage (page,queryWrapper);
|
|
return ResponseEntity.ok (result);
|
|
return ResponseEntity.ok (result);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -442,15 +446,16 @@ public class ProjectController {
|
|
public void exportFile(ProjectDTO userProjectDTO, Page <ProjectDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
public void exportFile(ProjectDTO userProjectDTO, Page <ProjectDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
String fileName = options.getFilename ( );
|
|
String fileName = options.getFilename ( );
|
|
Project project = ProjectWrapper.INSTANCE.toEntity (userProjectDTO);
|
|
Project project = ProjectWrapper.INSTANCE.toEntity (userProjectDTO);
|
|
|
|
+ QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( project, Project.class );
|
|
Page <Project> userProjectPage = pageAToPageB(page);
|
|
Page <Project> userProjectPage = pageAToPageB(page);
|
|
List <Project> result = new ArrayList<>();
|
|
List <Project> result = new ArrayList<>();
|
|
List <ProjectDTO> userProjectDTOList = new ArrayList<>();
|
|
List <ProjectDTO> userProjectDTOList = new ArrayList<>();
|
|
if ( ExportMode.current.equals ( options.getMode ( ) ) ) {
|
|
if ( ExportMode.current.equals ( options.getMode ( ) ) ) {
|
|
- result = projectService.selectPage ( userProjectPage, project ).getRecords ( );
|
|
|
|
|
|
+ result = projectService.selectPage ( userProjectPage, queryWrapper ).getRecords ( );
|
|
} else {
|
|
} else {
|
|
userProjectPage.setSize ( -1 );
|
|
userProjectPage.setSize ( -1 );
|
|
userProjectPage.setCurrent ( 0 );
|
|
userProjectPage.setCurrent ( 0 );
|
|
- result = projectService.selectPage ( userProjectPage, project ).getRecords ( );
|
|
|
|
|
|
+ result = projectService.selectPage ( userProjectPage, queryWrapper ).getRecords ( );
|
|
}
|
|
}
|
|
result.stream().forEach(item->{
|
|
result.stream().forEach(item->{
|
|
ProjectDTO projectDTO = ProjectWrapper.INSTANCE.toDTO(item);
|
|
ProjectDTO projectDTO = ProjectWrapper.INSTANCE.toDTO(item);
|