mirror of https://github.com/elunez/eladmin
				
				
				
			代码优化
							parent
							
								
									a74cf51c0a
								
							
						
					
					
						commit
						5b9213f25f
					
				|  | @ -54,4 +54,10 @@ public class PageUtil extends cn.hutool.core.util.PageUtil { | |||
|         return new PageResult<>(list, totalElements); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 返回空数据 | ||||
|      */ | ||||
|     public static <T> PageResult<T> noData () { | ||||
|         return new PageResult<>(null, 0); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ public class GenConfigController { | |||
| 
 | ||||
|     @ApiOperation("查询") | ||||
|     @GetMapping(value = "/{tableName}") | ||||
|     public ResponseEntity<Object> queryGenConfig(@PathVariable String tableName){ | ||||
|     public ResponseEntity<GenConfig> queryGenConfig(@PathVariable String tableName){ | ||||
|         return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,9 +19,11 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import me.zhengjie.domain.ColumnInfo; | ||||
| import me.zhengjie.domain.vo.TableInfo; | ||||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.service.GenConfigService; | ||||
| import me.zhengjie.service.GeneratorService; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.http.HttpStatus; | ||||
|  | @ -55,16 +57,16 @@ public class GeneratorController { | |||
| 
 | ||||
|     @ApiOperation("查询数据库数据") | ||||
|     @GetMapping(value = "/tables") | ||||
|     public ResponseEntity<Object> queryTables(@RequestParam(defaultValue = "") String name, | ||||
|                                     @RequestParam(defaultValue = "0")Integer page, | ||||
|                                     @RequestParam(defaultValue = "10")Integer size){ | ||||
|     public ResponseEntity<PageResult<TableInfo>> queryTables(@RequestParam(defaultValue = "") String name, | ||||
|                                                              @RequestParam(defaultValue = "0")Integer page, | ||||
|                                                              @RequestParam(defaultValue = "10")Integer size){ | ||||
|         int[] startEnd = PageUtil.transToStartEnd(page, size); | ||||
|         return new ResponseEntity<>(generatorService.getTables(name,startEnd), HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @ApiOperation("查询字段数据") | ||||
|     @GetMapping(value = "/columns") | ||||
|     public ResponseEntity<Object> queryColumns(@RequestParam String tableName){ | ||||
|     public ResponseEntity<PageResult<ColumnInfo>> queryColumns(@RequestParam String tableName){ | ||||
|         List<ColumnInfo> columnInfos = generatorService.getColumns(tableName); | ||||
|         return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK); | ||||
|     } | ||||
|  |  | |||
|  | @ -17,6 +17,8 @@ package me.zhengjie.service; | |||
| 
 | ||||
| import me.zhengjie.domain.GenConfig; | ||||
| import me.zhengjie.domain.ColumnInfo; | ||||
| import me.zhengjie.domain.vo.TableInfo; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
|  | @ -35,7 +37,7 @@ public interface GeneratorService { | |||
|      * @param startEnd 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object getTables(String name, int[] startEnd); | ||||
|     PageResult<TableInfo> getTables(String name, int[] startEnd); | ||||
| 
 | ||||
|     /** | ||||
|      * 得到数据表的元数据 | ||||
|  |  | |||
|  | @ -25,10 +25,7 @@ import me.zhengjie.domain.vo.TableInfo; | |||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.repository.ColumnInfoRepository; | ||||
| import me.zhengjie.service.GeneratorService; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.GenUtil; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.StringUtils; | ||||
| import me.zhengjie.utils.*; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.http.HttpStatus; | ||||
|  | @ -71,7 +68,7 @@ public class GeneratorServiceImpl implements GeneratorService { | |||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Object getTables(String name, int[] startEnd) { | ||||
|     public PageResult<TableInfo> getTables(String name, int[] startEnd) { | ||||
|         // 使用预编译防止sql注入
 | ||||
|         String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " + | ||||
|                 "where table_schema = (select database()) " + | ||||
|  |  | |||
|  | @ -21,6 +21,8 @@ import lombok.RequiredArgsConstructor; | |||
| import me.zhengjie.annotation.Log; | ||||
| import me.zhengjie.service.SysLogService; | ||||
| import me.zhengjie.service.dto.SysLogQueryCriteria; | ||||
| import me.zhengjie.service.dto.SysLogSmallDto; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.SecurityUtils; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
|  | @ -69,7 +71,7 @@ public class SysLogController { | |||
| 
 | ||||
|     @GetMapping(value = "/user") | ||||
|     @ApiOperation("用户日志查询") | ||||
|     public ResponseEntity<Object> queryUserLog(SysLogQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<SysLogSmallDto>> queryUserLog(SysLogQueryCriteria criteria, Pageable pageable){ | ||||
|         criteria.setLogType("INFO"); | ||||
|         criteria.setUsername(SecurityUtils.getCurrentUsername()); | ||||
|         return new ResponseEntity<>(sysLogService.queryAllByUser(criteria,pageable), HttpStatus.OK); | ||||
|  |  | |||
|  | @ -17,6 +17,8 @@ package me.zhengjie.service; | |||
| 
 | ||||
| import me.zhengjie.domain.SysLog; | ||||
| import me.zhengjie.service.dto.SysLogQueryCriteria; | ||||
| import me.zhengjie.service.dto.SysLogSmallDto; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.aspectj.lang.ProceedingJoinPoint; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
|  | @ -52,7 +54,7 @@ public interface SysLogService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return - | ||||
|      */ | ||||
|     Object queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<SysLogSmallDto> queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 保存日志数据 | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ import me.zhengjie.domain.SysLog; | |||
| import me.zhengjie.repository.LogRepository; | ||||
| import me.zhengjie.service.SysLogService; | ||||
| import me.zhengjie.service.dto.SysLogQueryCriteria; | ||||
| import me.zhengjie.service.dto.SysLogSmallDto; | ||||
| import me.zhengjie.service.mapstruct.LogErrorMapper; | ||||
| import me.zhengjie.service.mapstruct.LogSmallMapper; | ||||
| import me.zhengjie.utils.*; | ||||
|  | @ -60,7 +61,7 @@ public class SysLogServiceImpl implements SysLogService { | |||
|         if (status.equals(criteria.getLogType())) { | ||||
|             return PageUtil.toPage(page.map(logErrorMapper::toDto)); | ||||
|         } | ||||
|         return page; | ||||
|         return PageUtil.toPage(page); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -69,7 +70,7 @@ public class SysLogServiceImpl implements SysLogService { | |||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable) { | ||||
|     public PageResult<SysLogSmallDto> queryAllByUser(SysLogQueryCriteria criteria, Pageable pageable) { | ||||
|         Page<SysLog> page = logRepository.findAll(((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, criteria, cb)), pageable); | ||||
|         return PageUtil.toPage(page.map(logSmallMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor; | |||
| import me.zhengjie.annotation.Log; | ||||
| import me.zhengjie.modules.mnt.domain.App; | ||||
| import me.zhengjie.modules.mnt.service.AppService; | ||||
| import me.zhengjie.modules.mnt.service.dto.AppDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -54,7 +56,7 @@ public class AppController { | |||
|     @ApiOperation(value = "查询应用") | ||||
|     @GetMapping | ||||
| 	@PreAuthorize("@el.check('app:list')") | ||||
|     public ResponseEntity<Object> queryApp(AppQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<AppDto>> queryApp(AppQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(appService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto; | |||
| import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria; | ||||
| import me.zhengjie.modules.mnt.util.SqlUtils; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -62,7 +63,7 @@ public class DatabaseController { | |||
|     @ApiOperation(value = "查询数据库") | ||||
|     @GetMapping | ||||
| 	@PreAuthorize("@el.check('database:list')") | ||||
|     public ResponseEntity<Object> queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<DatabaseDto>> queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(databaseService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,8 +22,10 @@ import me.zhengjie.annotation.Log; | |||
| import me.zhengjie.modules.mnt.domain.Deploy; | ||||
| import me.zhengjie.modules.mnt.domain.DeployHistory; | ||||
| import me.zhengjie.modules.mnt.service.DeployService; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -64,7 +66,7 @@ public class DeployController { | |||
|     @ApiOperation(value = "查询部署") | ||||
|     @GetMapping | ||||
| 	@PreAuthorize("@el.check('deploy:list')") | ||||
|     public ResponseEntity<Object> queryDeployData(DeployQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<DeployDto>> queryDeployData(DeployQueryCriteria criteria, Pageable pageable){ | ||||
|     	return new ResponseEntity<>(deployService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,7 +20,9 @@ import io.swagger.annotations.ApiOperation; | |||
| import lombok.RequiredArgsConstructor; | ||||
| import me.zhengjie.annotation.Log; | ||||
| import me.zhengjie.modules.mnt.service.DeployHistoryService; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -52,7 +54,7 @@ public class DeployHistoryController { | |||
|     @ApiOperation(value = "查询部署历史") | ||||
|     @GetMapping | ||||
| 	@PreAuthorize("@el.check('deployHistory:list')") | ||||
|     public ResponseEntity<Object> queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<DeployHistoryDto>> queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(deployhistoryService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,7 +21,9 @@ import lombok.RequiredArgsConstructor; | |||
| import me.zhengjie.annotation.Log; | ||||
| import me.zhengjie.modules.mnt.domain.ServerDeploy; | ||||
| import me.zhengjie.modules.mnt.service.ServerDeployService; | ||||
| import me.zhengjie.modules.mnt.service.dto.ServerDeployDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -54,7 +56,7 @@ public class ServerDeployController { | |||
|     @ApiOperation(value = "查询服务器") | ||||
|     @GetMapping | ||||
| 	@PreAuthorize("@el.check('serverDeploy:list')") | ||||
|     public ResponseEntity<Object> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<ServerDeployDto>> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){ | ||||
|     	return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service; | |||
| import me.zhengjie.modules.mnt.domain.App; | ||||
| import me.zhengjie.modules.mnt.service.dto.AppDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | @ -37,7 +38,7 @@ public interface AppService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(AppQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<AppDto> queryAll(AppQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部数据 | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service; | |||
| import me.zhengjie.modules.mnt.domain.Database; | ||||
| import me.zhengjie.modules.mnt.service.dto.DatabaseDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | @ -37,7 +38,7 @@ public interface DatabaseService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(DatabaseQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<DatabaseDto> queryAll(DatabaseQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部 | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service; | |||
| import me.zhengjie.modules.mnt.domain.DeployHistory; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | @ -36,7 +37,7 @@ public interface DeployHistoryService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<DeployHistoryDto> queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部 | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ import me.zhengjie.modules.mnt.domain.Deploy; | |||
| import me.zhengjie.modules.mnt.domain.DeployHistory; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | @ -38,7 +39,7 @@ public interface DeployService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(DeployQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<DeployDto> queryAll(DeployQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部数据 | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.modules.mnt.service; | |||
| import me.zhengjie.modules.mnt.domain.ServerDeploy; | ||||
| import me.zhengjie.modules.mnt.service.dto.ServerDeployDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | @ -37,7 +38,7 @@ public interface ServerDeployService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(ServerDeployQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<ServerDeployDto> queryAll(ServerDeployQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部数据 | ||||
|  |  | |||
|  | @ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.AppService; | |||
| import me.zhengjie.modules.mnt.service.dto.AppDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.AppQueryCriteria; | ||||
| import me.zhengjie.modules.mnt.service.mapstruct.AppMapper; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.QueryHelp; | ||||
| import me.zhengjie.utils.ValidationUtil; | ||||
| import me.zhengjie.utils.*; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | @ -47,7 +44,7 @@ public class AppServiceImpl implements AppService { | |||
|     private final AppMapper appMapper; | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(AppQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<AppDto> queryAll(AppQueryCriteria criteria, Pageable pageable){ | ||||
|         Page<App> page = appRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||||
|         return PageUtil.toPage(page.map(appMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -25,10 +25,7 @@ import me.zhengjie.modules.mnt.service.dto.DatabaseDto; | |||
| import me.zhengjie.modules.mnt.service.dto.DatabaseQueryCriteria; | ||||
| import me.zhengjie.modules.mnt.service.mapstruct.DatabaseMapper; | ||||
| import me.zhengjie.modules.mnt.util.SqlUtils; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.QueryHelp; | ||||
| import me.zhengjie.utils.ValidationUtil; | ||||
| import me.zhengjie.utils.*; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | @ -50,7 +47,7 @@ public class DatabaseServiceImpl implements DatabaseService { | |||
|     private final DatabaseMapper databaseMapper; | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(DatabaseQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<DatabaseDto> queryAll(DatabaseQueryCriteria criteria, Pageable pageable){ | ||||
|         Page<Database> page = databaseRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||||
|         return PageUtil.toPage(page.map(databaseMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.DeployHistoryService; | |||
| import me.zhengjie.modules.mnt.service.dto.DeployHistoryDto; | ||||
| import me.zhengjie.modules.mnt.service.dto.DeployHistoryQueryCriteria; | ||||
| import me.zhengjie.modules.mnt.service.mapstruct.DeployHistoryMapper; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.QueryHelp; | ||||
| import me.zhengjie.utils.ValidationUtil; | ||||
| import me.zhengjie.utils.*; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | @ -47,7 +44,7 @@ public class DeployHistoryServiceImpl implements DeployHistoryService { | |||
|     private final DeployHistoryMapper deployhistoryMapper; | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<DeployHistoryDto> queryAll(DeployHistoryQueryCriteria criteria, Pageable pageable){ | ||||
|         Page<DeployHistory> page = deployhistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||||
|         return PageUtil.toPage(page.map(deployhistoryMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -68,7 +68,7 @@ public class DeployServiceImpl implements DeployService { | |||
| 
 | ||||
| 
 | ||||
| 	@Override | ||||
| 	public Object queryAll(DeployQueryCriteria criteria, Pageable pageable) { | ||||
| 	public PageResult<DeployDto> queryAll(DeployQueryCriteria criteria, Pageable pageable) { | ||||
| 		Page<Deploy> page = deployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); | ||||
| 		return PageUtil.toPage(page.map(deployMapper::toDto)); | ||||
| 	} | ||||
|  |  | |||
|  | @ -23,10 +23,7 @@ import me.zhengjie.modules.mnt.service.dto.ServerDeployDto; | |||
| import me.zhengjie.modules.mnt.service.dto.ServerDeployQueryCriteria; | ||||
| import me.zhengjie.modules.mnt.service.mapstruct.ServerDeployMapper; | ||||
| import me.zhengjie.modules.mnt.util.ExecuteShellUtil; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.QueryHelp; | ||||
| import me.zhengjie.utils.ValidationUtil; | ||||
| import me.zhengjie.utils.*; | ||||
| import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | @ -47,7 +44,7 @@ public class ServerDeployServiceImpl implements ServerDeployService { | |||
|     private final ServerDeployMapper serverDeployMapper; | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(ServerDeployQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<ServerDeployDto> queryAll(ServerDeployQueryCriteria criteria, Pageable pageable){ | ||||
|         Page<ServerDeploy> page = serverDeployRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||||
|         return PageUtil.toPage(page.map(serverDeployMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -22,8 +22,10 @@ import lombok.extern.slf4j.Slf4j; | |||
| import me.zhengjie.annotation.Log; | ||||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.modules.quartz.domain.QuartzJob; | ||||
| import me.zhengjie.modules.quartz.domain.QuartzLog; | ||||
| import me.zhengjie.modules.quartz.service.QuartzJobService; | ||||
| import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.SpringContextHolder; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
|  | @ -52,7 +54,7 @@ public class QuartzJobController { | |||
|     @ApiOperation("查询定时任务") | ||||
|     @GetMapping | ||||
|     @PreAuthorize("@el.check('timing:list')") | ||||
|     public ResponseEntity<Object> queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<QuartzJob>> queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  | @ -73,7 +75,7 @@ public class QuartzJobController { | |||
|     @ApiOperation("查询任务执行日志") | ||||
|     @GetMapping(value = "/logs") | ||||
|     @PreAuthorize("@el.check('timing:list')") | ||||
|     public ResponseEntity<Object> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<QuartzLog>> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.modules.quartz.service; | |||
| import me.zhengjie.modules.quartz.domain.QuartzJob; | ||||
| import me.zhengjie.modules.quartz.domain.QuartzLog; | ||||
| import me.zhengjie.modules.quartz.service.dto.JobQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
|  | @ -36,7 +37,7 @@ public interface QuartzJobService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(JobQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<QuartzJob> queryAll(JobQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部 | ||||
|  | @ -51,7 +52,7 @@ public interface QuartzJobService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAllLog(JobQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<QuartzLog> queryAllLog(JobQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部 | ||||
|  |  | |||
|  | @ -50,12 +50,12 @@ public class QuartzJobServiceImpl implements QuartzJobService { | |||
|     private final RedisUtils redisUtils; | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(JobQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<QuartzJob> queryAll(JobQueryCriteria criteria, Pageable pageable){ | ||||
|         return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAllLog(JobQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<QuartzLog> queryAllLog(JobQueryCriteria criteria, Pageable pageable){ | ||||
|         return PageUtil.toPage(quartzLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -44,6 +44,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio | |||
| import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | ||||
| import org.springframework.security.core.Authentication; | ||||
| import org.springframework.security.core.context.SecurityContextHolder; | ||||
| import org.springframework.security.core.userdetails.UserDetails; | ||||
| import org.springframework.validation.annotation.Validated; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import javax.annotation.Resource; | ||||
|  | @ -113,7 +114,7 @@ public class AuthorizationController { | |||
| 
 | ||||
|     @ApiOperation("获取用户信息") | ||||
|     @GetMapping(value = "/info") | ||||
|     public ResponseEntity<Object> getUserInfo() { | ||||
|     public ResponseEntity<UserDetails> getUserInfo() { | ||||
|         return ResponseEntity.ok(SecurityUtils.getCurrentUser()); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,7 +19,9 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import me.zhengjie.modules.security.service.OnlineUserService; | ||||
| import me.zhengjie.modules.security.service.dto.OnlineUserDto; | ||||
| import me.zhengjie.utils.EncryptUtils; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -43,7 +45,7 @@ public class OnlineController { | |||
|     @ApiOperation("查询在线用户") | ||||
|     @GetMapping | ||||
|     @PreAuthorize("@el.check()") | ||||
|     public ResponseEntity<Object> queryOnlineUser(String filter, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<OnlineUserDto>> queryOnlineUser(String filter, Pageable pageable){ | ||||
|         return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ import me.zhengjie.modules.system.domain.Dept; | |||
| import me.zhengjie.modules.system.service.DeptService; | ||||
| import me.zhengjie.modules.system.service.dto.DeptDto; | ||||
| import me.zhengjie.modules.system.service.dto.DeptQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -57,22 +58,22 @@ public class DeptController { | |||
|     @ApiOperation("查询部门") | ||||
|     @GetMapping | ||||
|     @PreAuthorize("@el.check('user:list','dept:list')") | ||||
|     public ResponseEntity<Object> queryDept(DeptQueryCriteria criteria) throws Exception { | ||||
|         List<DeptDto> deptDtos = deptService.queryAll(criteria, true); | ||||
|         return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK); | ||||
|     public ResponseEntity<PageResult<DeptDto>> queryDept(DeptQueryCriteria criteria) throws Exception { | ||||
|         List<DeptDto> depts = deptService.queryAll(criteria, true); | ||||
|         return new ResponseEntity<>(PageUtil.toPage(depts, depts.size()),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @ApiOperation("查询部门:根据ID获取同级与上级数据") | ||||
|     @PostMapping("/superior") | ||||
|     @PreAuthorize("@el.check('user:list','dept:list')") | ||||
|     public ResponseEntity<Object> getDeptSuperior(@RequestBody List<Long> ids) { | ||||
|         Set<DeptDto> deptDtos  = new LinkedHashSet<>(); | ||||
|         Set<DeptDto> deptSet  = new LinkedHashSet<>(); | ||||
|         for (Long id : ids) { | ||||
|             DeptDto deptDto = deptService.findById(id); | ||||
|             List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>()); | ||||
|             deptDtos.addAll(depts); | ||||
|             deptSet.addAll(depts); | ||||
|         } | ||||
|         return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptDtos)),HttpStatus.OK); | ||||
|         return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @Log("新增部门") | ||||
|  |  | |||
|  | @ -22,7 +22,10 @@ import me.zhengjie.annotation.Log; | |||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.modules.system.domain.Dict; | ||||
| import me.zhengjie.modules.system.service.DictService; | ||||
| import me.zhengjie.modules.system.service.dto.DictDto; | ||||
| import me.zhengjie.modules.system.service.dto.DictQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -31,6 +34,7 @@ import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| /** | ||||
|  | @ -56,14 +60,14 @@ public class DictController { | |||
|     @ApiOperation("查询字典") | ||||
|     @GetMapping(value = "/all") | ||||
|     @PreAuthorize("@el.check('dict:list')") | ||||
|     public ResponseEntity<Object> queryAllDict(){ | ||||
|     public ResponseEntity<List<DictDto>> queryAllDict(){ | ||||
|         return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @ApiOperation("查询字典") | ||||
|     @GetMapping | ||||
|     @PreAuthorize("@el.check('dict:list')") | ||||
|     public ResponseEntity<Object> queryDict(DictQueryCriteria resources, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<DictDto>> queryDict(DictQueryCriteria resources, Pageable pageable){ | ||||
|         return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ import me.zhengjie.modules.system.domain.DictDetail; | |||
| import me.zhengjie.modules.system.service.DictDetailService; | ||||
| import me.zhengjie.modules.system.service.dto.DictDetailDto; | ||||
| import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.data.domain.Sort; | ||||
| import org.springframework.data.web.PageableDefault; | ||||
|  | @ -51,8 +52,8 @@ public class DictDetailController { | |||
| 
 | ||||
|     @ApiOperation("查询字典详情") | ||||
|     @GetMapping | ||||
|     public ResponseEntity<Object> queryDictDetail(DictDetailQueryCriteria criteria, | ||||
|                                          @PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<DictDetailDto>> queryDictDetail(DictDetailQueryCriteria criteria, | ||||
|                                                                      @PageableDefault(sort = {"dictSort"}, direction = Sort.Direction.ASC) Pageable pageable){ | ||||
|         return new ResponseEntity<>(dictDetailService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,7 +22,9 @@ import me.zhengjie.annotation.Log; | |||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.modules.system.domain.Job; | ||||
| import me.zhengjie.modules.system.service.JobService; | ||||
| import me.zhengjie.modules.system.service.dto.JobDto; | ||||
| import me.zhengjie.modules.system.service.dto.JobQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -56,7 +58,7 @@ public class JobController { | |||
|     @ApiOperation("查询岗位") | ||||
|     @GetMapping | ||||
|     @PreAuthorize("@el.check('job:list','user:list')") | ||||
|     public ResponseEntity<Object> queryJob(JobQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<JobDto>> queryJob(JobQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -22,10 +22,12 @@ import lombok.RequiredArgsConstructor; | |||
| import me.zhengjie.annotation.Log; | ||||
| import me.zhengjie.modules.system.domain.Menu; | ||||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.modules.system.domain.vo.MenuVo; | ||||
| import me.zhengjie.modules.system.service.MenuService; | ||||
| import me.zhengjie.modules.system.service.dto.MenuDto; | ||||
| import me.zhengjie.modules.system.service.dto.MenuQueryCriteria; | ||||
| import me.zhengjie.modules.system.service.mapstruct.MenuMapper; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.SecurityUtils; | ||||
| import org.springframework.http.HttpStatus; | ||||
|  | @ -61,16 +63,16 @@ public class MenuController { | |||
| 
 | ||||
|     @GetMapping(value = "/build") | ||||
|     @ApiOperation("获取前端所需菜单") | ||||
|     public ResponseEntity<Object> buildMenus(){ | ||||
|     public ResponseEntity<List<MenuVo>> buildMenus(){ | ||||
|         List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId()); | ||||
|         List<MenuDto> menuDtos = menuService.buildTree(menuDtoList); | ||||
|         return new ResponseEntity<>(menuService.buildMenus(menuDtos),HttpStatus.OK); | ||||
|         List<MenuDto> menus = menuService.buildTree(menuDtoList); | ||||
|         return new ResponseEntity<>(menuService.buildMenus(menus),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @ApiOperation("返回全部的菜单") | ||||
|     @GetMapping(value = "/lazy") | ||||
|     @PreAuthorize("@el.check('menu:list','roles:list')") | ||||
|     public ResponseEntity<Object> queryAllMenu(@RequestParam Long pid){ | ||||
|     public ResponseEntity<List<MenuDto>> queryAllMenu(@RequestParam Long pid){ | ||||
|         return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  | @ -89,7 +91,7 @@ public class MenuController { | |||
|     @GetMapping | ||||
|     @ApiOperation("查询菜单") | ||||
|     @PreAuthorize("@el.check('menu:list')") | ||||
|     public ResponseEntity<Object> queryMenu(MenuQueryCriteria criteria) throws Exception { | ||||
|     public ResponseEntity<PageResult<MenuDto>> queryMenu(MenuQueryCriteria criteria) throws Exception { | ||||
|         List<MenuDto> menuDtoList = menuService.queryAll(criteria, true); | ||||
|         return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()),HttpStatus.OK); | ||||
|     } | ||||
|  | @ -97,7 +99,7 @@ public class MenuController { | |||
|     @ApiOperation("查询菜单:根据ID获取同级与上级数据") | ||||
|     @PostMapping("/superior") | ||||
|     @PreAuthorize("@el.check('menu:list')") | ||||
|     public ResponseEntity<Object> getMenuSuperior(@RequestBody List<Long> ids) { | ||||
|     public ResponseEntity<List<MenuDto>> getMenuSuperior(@RequestBody List<Long> ids) { | ||||
|         Set<MenuDto> menuDtos = new LinkedHashSet<>(); | ||||
|         if(CollectionUtil.isNotEmpty(ids)){ | ||||
|             for (Long id : ids) { | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ import me.zhengjie.modules.system.service.RoleService; | |||
| import me.zhengjie.modules.system.service.dto.RoleDto; | ||||
| import me.zhengjie.modules.system.service.dto.RoleQueryCriteria; | ||||
| import me.zhengjie.modules.system.service.dto.RoleSmallDto; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import me.zhengjie.utils.SecurityUtils; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
|  | @ -57,7 +58,7 @@ public class RoleController { | |||
|     @ApiOperation("获取单个role") | ||||
|     @GetMapping(value = "/{id}") | ||||
|     @PreAuthorize("@el.check('roles:list')") | ||||
|     public ResponseEntity<Object> findRoleById(@PathVariable Long id){ | ||||
|     public ResponseEntity<RoleDto> findRoleById(@PathVariable Long id){ | ||||
|         return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  | @ -71,14 +72,14 @@ public class RoleController { | |||
|     @ApiOperation("返回全部的角色") | ||||
|     @GetMapping(value = "/all") | ||||
|     @PreAuthorize("@el.check('roles:list','user:add','user:edit')") | ||||
|     public ResponseEntity<Object> queryAllRole(){ | ||||
|     public ResponseEntity<List<RoleDto>> queryAllRole(){ | ||||
|         return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @ApiOperation("查询角色") | ||||
|     @GetMapping | ||||
|     @PreAuthorize("@el.check('roles:list')") | ||||
|     public ResponseEntity<Object> queryRole(RoleQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<RoleDto>> queryRole(RoleQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -100,7 +100,7 @@ public class UserController { | |||
|             criteria.getDeptIds().addAll(dataScopes); | ||||
|             return new ResponseEntity<>(userService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|         } | ||||
|         return new ResponseEntity<>(PageUtil.toPage(null,0),HttpStatus.OK); | ||||
|         return new ResponseEntity<>(PageUtil.noData(),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|     @Log("新增用户") | ||||
|  |  | |||
|  | @ -111,8 +111,8 @@ public interface DeptService { | |||
| 
 | ||||
|     /** | ||||
|      * 获取 | ||||
|      * @param deptList | ||||
|      * @return | ||||
|      * @param deptList / | ||||
|      * @return / | ||||
|      */ | ||||
|     List<Long> getDeptChildren(List<Dept> deptList); | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,6 +16,7 @@ | |||
| package me.zhengjie.modules.system.service; | ||||
| 
 | ||||
| import me.zhengjie.modules.system.domain.Menu; | ||||
| import me.zhengjie.modules.system.domain.vo.MenuVo; | ||||
| import me.zhengjie.modules.system.service.dto.MenuDto; | ||||
| import me.zhengjie.modules.system.service.dto.MenuQueryCriteria; | ||||
| 
 | ||||
|  | @ -78,7 +79,7 @@ public interface MenuService { | |||
|      * @param menuDtos / | ||||
|      * @return / | ||||
|      */ | ||||
|     Object buildMenus(List<MenuDto> menuDtos); | ||||
|     List<MenuVo> buildMenus(List<MenuDto> menuDtos); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据ID查询 | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ import me.zhengjie.modules.system.service.dto.RoleDto; | |||
| import me.zhengjie.modules.system.service.dto.RoleQueryCriteria; | ||||
| import me.zhengjie.modules.system.service.dto.RoleSmallDto; | ||||
| import me.zhengjie.modules.system.service.dto.UserDto; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.io.IOException; | ||||
|  | @ -97,7 +98,7 @@ public interface RoleService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(RoleQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<RoleDto> queryAll(RoleQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部 | ||||
|  |  | |||
|  | @ -74,7 +74,7 @@ public class RoleServiceImpl implements RoleService { | |||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(RoleQueryCriteria criteria, Pageable pageable) { | ||||
|     public PageResult<RoleDto> queryAll(RoleQueryCriteria criteria, Pageable pageable) { | ||||
|         Page<Role> page = roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); | ||||
|         return PageUtil.toPage(page.map(roleMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -41,7 +41,7 @@ public class EmailController { | |||
|     private final EmailService emailService; | ||||
| 
 | ||||
|     @GetMapping | ||||
|     public ResponseEntity<Object> queryEmailConfig(){ | ||||
|     public ResponseEntity<EmailConfig> queryEmailConfig(){ | ||||
|         return new ResponseEntity<>(emailService.find(),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,8 +20,10 @@ import me.zhengjie.annotation.Log; | |||
| import me.zhengjie.domain.LocalStorage; | ||||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.service.LocalStorageService; | ||||
| import me.zhengjie.service.dto.LocalStorageDto; | ||||
| import me.zhengjie.service.dto.LocalStorageQueryCriteria; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -48,7 +50,7 @@ public class LocalStorageController { | |||
|     @GetMapping | ||||
|     @ApiOperation("查询文件") | ||||
|     @PreAuthorize("@el.check('storage:list')") | ||||
|     public ResponseEntity<Object> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<LocalStorageDto>> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  | @ -69,7 +71,7 @@ public class LocalStorageController { | |||
| 
 | ||||
|     @ApiOperation("上传图片") | ||||
|     @PostMapping("/pictures") | ||||
|     public ResponseEntity<Object> uploadPicture(@RequestParam MultipartFile file){ | ||||
|     public ResponseEntity<LocalStorage> uploadPicture(@RequestParam MultipartFile file){ | ||||
|         // 判断文件是否为图片
 | ||||
|         String suffix = FileUtil.getExtensionName(file.getOriginalFilename()); | ||||
|         if(!FileUtil.IMAGE.equals(FileUtil.getFileType(suffix))){ | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ import me.zhengjie.domain.QiniuConfig; | |||
| import me.zhengjie.domain.QiniuContent; | ||||
| import me.zhengjie.service.dto.QiniuQueryCriteria; | ||||
| import me.zhengjie.service.QiNiuService; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.http.ResponseEntity; | ||||
|  | @ -50,7 +51,7 @@ public class QiniuController { | |||
|     private final QiNiuService qiNiuService; | ||||
| 
 | ||||
|     @GetMapping(value = "/config") | ||||
|     public ResponseEntity<Object> queryQiNiuConfig(){ | ||||
|     public ResponseEntity<QiniuConfig> queryQiNiuConfig(){ | ||||
|         return new ResponseEntity<>(qiNiuService.find(), HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  | @ -71,7 +72,7 @@ public class QiniuController { | |||
| 
 | ||||
|     @ApiOperation("查询文件") | ||||
|     @GetMapping | ||||
|     public ResponseEntity<Object> queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){ | ||||
|     public ResponseEntity<PageResult<QiniuContent>> queryQiNiu(QiniuQueryCriteria criteria, Pageable pageable){ | ||||
|         return new ResponseEntity<>(qiNiuService.queryAll(criteria,pageable),HttpStatus.OK); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -43,7 +43,6 @@ public interface EmailService { | |||
|      * 发送邮件 | ||||
|      * @param emailVo 邮件发送的内容 | ||||
|      * @param emailConfig 邮件配置 | ||||
|      * @throws Exception / | ||||
|      */ | ||||
|     void send(EmailVo emailVo, EmailConfig emailConfig); | ||||
| } | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.service; | |||
| import me.zhengjie.domain.LocalStorage; | ||||
| import me.zhengjie.service.dto.LocalStorageDto; | ||||
| import me.zhengjie.service.dto.LocalStorageQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.web.multipart.MultipartFile; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
|  | @ -36,7 +37,7 @@ public interface LocalStorageService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<LocalStorageDto> queryAll(LocalStorageQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部数据 | ||||
|  |  | |||
|  | @ -18,6 +18,7 @@ package me.zhengjie.service; | |||
| import me.zhengjie.domain.QiniuConfig; | ||||
| import me.zhengjie.domain.QiniuContent; | ||||
| import me.zhengjie.service.dto.QiniuQueryCriteria; | ||||
| import me.zhengjie.utils.PageResult; | ||||
| import org.springframework.data.domain.Pageable; | ||||
| import org.springframework.web.multipart.MultipartFile; | ||||
| 
 | ||||
|  | @ -50,7 +51,7 @@ public interface QiNiuService { | |||
|      * @param pageable 分页参数 | ||||
|      * @return / | ||||
|      */ | ||||
|     Object queryAll(QiniuQueryCriteria criteria, Pageable pageable); | ||||
|     PageResult<QiniuContent> queryAll(QiniuQueryCriteria criteria, Pageable pageable); | ||||
| 
 | ||||
|     /** | ||||
|      * 查询全部 | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { | |||
|     private final FileProperties properties; | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<LocalStorageDto> queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){ | ||||
|         Page<LocalStorage> page = localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); | ||||
|         return PageUtil.toPage(page.map(localStorageMapper::toDto)); | ||||
|     } | ||||
|  |  | |||
|  | @ -29,14 +29,10 @@ import me.zhengjie.domain.QiniuConfig; | |||
| import me.zhengjie.domain.QiniuContent; | ||||
| import me.zhengjie.repository.QiniuContentRepository; | ||||
| import me.zhengjie.service.dto.QiniuQueryCriteria; | ||||
| import me.zhengjie.utils.QiNiuUtil; | ||||
| import me.zhengjie.utils.*; | ||||
| import me.zhengjie.exception.BadRequestException; | ||||
| import me.zhengjie.repository.QiNiuConfigRepository; | ||||
| import me.zhengjie.service.QiNiuService; | ||||
| import me.zhengjie.utils.FileUtil; | ||||
| import me.zhengjie.utils.PageUtil; | ||||
| import me.zhengjie.utils.QueryHelp; | ||||
| import me.zhengjie.utils.ValidationUtil; | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.cache.annotation.CacheConfig; | ||||
| import org.springframework.cache.annotation.CachePut; | ||||
|  | @ -84,7 +80,7 @@ public class QiNiuServiceImpl implements QiNiuService { | |||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){ | ||||
|     public PageResult<QiniuContent> queryAll(QiniuQueryCriteria criteria, Pageable pageable){ | ||||
|         return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Zheng Jie
						Zheng Jie