From 90a4a80a7f9f0842b0f5bb57bfc9838f8450d446 Mon Sep 17 00:00:00 2001 From: ZhengJie <201507802@qq.com> Date: Thu, 14 May 2020 13:31:52 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BB=A3=E7=A0=81=E5=AE=8C=E5=96=84](v2.5):?= =?UTF-8?q?=20v2.5=20beta=20=E8=8F=9C=E5=8D=95=E9=83=A8=E9=97=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96,=E5=85=B6=E4=BB=96=E6=9D=82=E9=A1=B9=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 菜单和部门表加入 sub_count 字段,记录子节点数目,树形表格懒加载使用。 脚本同步更新 2.5 Beta 详情:https://www.ydyno.com/archives/1225.html --- .../java/me/zhengjie/utils/RedisUtils.java | 15 +- .../modules/mnt/rest/AppController.java | 3 +- .../modules/mnt/rest/DatabaseController.java | 3 +- .../modules/mnt/rest/DeployController.java | 3 +- .../mnt/rest/ServerDeployController.java | 3 +- .../modules/mnt/service/AppService.java | 3 +- .../modules/mnt/service/DatabaseService.java | 3 +- .../mnt/service/DeployHistoryService.java | 3 +- .../modules/mnt/service/DeployService.java | 3 +- .../mnt/service/ServerDeployService.java | 3 +- .../mnt/service/impl/AppServiceImpl.java | 4 +- .../mnt/service/impl/DatabaseServiceImpl.java | 4 +- .../impl/DeployHistoryServiceImpl.java | 4 +- .../mnt/service/impl/DeployServiceImpl.java | 4 +- .../service/impl/ServerDeployServiceImpl.java | 5 +- .../quartz/rest/QuartzJobController.java | 3 +- .../quartz/service/QuartzJobService.java | 3 +- .../service/impl/QuartzJobServiceImpl.java | 3 +- .../zhengjie/modules/system/domain/Dept.java | 3 + .../zhengjie/modules/system/domain/Menu.java | 3 + .../system/repository/DeptRepository.java | 15 +- .../system/repository/DictRepository.java | 7 + .../system/repository/MenuRepository.java | 14 +- .../system/repository/RoleRepository.java | 3 +- .../modules/system/rest/DeptController.java | 3 +- .../modules/system/rest/DictController.java | 3 +- .../system/rest/DictDetailController.java | 3 +- .../modules/system/rest/JobController.java | 3 +- .../modules/system/rest/MenuController.java | 3 +- .../modules/system/rest/RoleController.java | 7 +- .../modules/system/rest/UserController.java | 5 +- .../modules/system/service/DeptService.java | 3 +- .../system/service/DictDetailService.java | 3 +- .../modules/system/service/DictService.java | 2 +- .../modules/system/service/JobService.java | 2 +- .../modules/system/service/MenuService.java | 3 +- .../modules/system/service/RoleService.java | 16 +- .../modules/system/service/UserService.java | 3 +- .../modules/system/service/dto/DeptDto.java | 10 +- .../modules/system/service/dto/MenuDto.java | 10 +- .../system/service/impl/DataServiceImpl.java | 5 - .../system/service/impl/DeptServiceImpl.java | 34 ++- .../service/impl/DictDetailServiceImpl.java | 13 +- .../system/service/impl/DictServiceImpl.java | 24 +- .../system/service/impl/JobServiceImpl.java | 22 +- .../system/service/impl/MenuServiceImpl.java | 41 +-- .../system/service/impl/RoleServiceImpl.java | 29 +-- .../system/service/impl/UserServiceImpl.java | 23 +- .../system/service/mapstruct/DeptMapper.java | 20 -- .../system/service/mapstruct/MenuMapper.java | 19 -- .../zhengjie/rest/LocalStorageController.java | 3 +- .../zhengjie/service/LocalStorageService.java | 3 +- .../service/impl/LocalStorageServiceImpl.java | 4 +- .../service/impl/QiNiuServiceImpl.java | 1 - sql/eladmin.sql | 239 ++++++++---------- sql/sys_ 相关表字段调整.sql | 8 +- sql/相关数据更新.sql | 15 +- 57 files changed, 331 insertions(+), 368 deletions(-) diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java b/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java index b3f0042c..2c2c6161 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java @@ -39,8 +39,6 @@ public class RedisUtils { this.redisTemplate = redisTemplate; } - // =============================common============================ - /** * 指定缓存失效时间 * @param key 键 @@ -645,4 +643,17 @@ public class RedisUtils { return 0; } } + + /** + * + * @param dict + * @param ids + */ + public void delByKeys(String prefix, Set ids) { + List keys = new ArrayList<>(); + for (Long id : ids) { + keys.add(new StringBuffer(prefix).append(id).toString()); + } + redisTemplate.delete(keys); + } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java index 6a64861c..16a5c003 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/AppController.java @@ -65,7 +65,8 @@ public class AppController { @PostMapping @PreAuthorize("@el.check('app:add')") public ResponseEntity create(@Validated @RequestBody App resources){ - return new ResponseEntity<>(appService.create(resources),HttpStatus.CREATED); + appService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改应用") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java index 9337e4ca..ff844e31 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DatabaseController.java @@ -73,7 +73,8 @@ public class DatabaseController { @PostMapping @PreAuthorize("@el.check('database:add')") public ResponseEntity create(@Validated @RequestBody Database resources){ - return new ResponseEntity<>(databaseService.create(resources),HttpStatus.CREATED); + databaseService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改数据库") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java index e065c1bf..5ea3bf26 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/DeployController.java @@ -75,7 +75,8 @@ public class DeployController { @PostMapping @PreAuthorize("@el.check('deploy:add')") public ResponseEntity create(@Validated @RequestBody Deploy resources){ - return new ResponseEntity<>(deployService.create(resources),HttpStatus.CREATED); + deployService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改部署") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java index 62626f49..5bdcb342 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/rest/ServerDeployController.java @@ -65,7 +65,8 @@ public class ServerDeployController { @PostMapping @PreAuthorize("@el.check('serverDeploy:add')") public ResponseEntity create(@Validated @RequestBody ServerDeploy resources){ - return new ResponseEntity<>(serverDeployService.create(resources),HttpStatus.CREATED); + serverDeployService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改服务器") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java index 896554ea..c8227785 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/AppService.java @@ -56,9 +56,8 @@ public interface AppService { /** * 创建 * @param resources / - * @return / */ - AppDto create(App resources); + void create(App resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java index 49a26eeb..e8a3acb7 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DatabaseService.java @@ -56,9 +56,8 @@ public interface DatabaseService { /** * 创建 * @param resources / - * @return / */ - DatabaseDto create(Database resources); + void create(Database resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java index bd43aed3..5eb1b3de 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployHistoryService.java @@ -55,9 +55,8 @@ public interface DeployHistoryService { /** * 创建 * @param resources / - * @return / */ - DeployHistoryDto create(DeployHistory resources); + void create(DeployHistory resources); /** * 删除 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java index 317e117f..583474d7 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/DeployService.java @@ -57,9 +57,8 @@ public interface DeployService { /** * 创建 * @param resources / - * @return / */ - DeployDto create(Deploy resources); + void create(Deploy resources); /** diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java index c5bba0ab..be8bb573 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/ServerDeployService.java @@ -56,9 +56,8 @@ public interface ServerDeployService { /** * 创建 * @param resources / - * @return / */ - ServerDeployDto create(ServerDeploy resources); + void create(ServerDeploy resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java index cdd58dff..0e3b6ad9 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/AppServiceImpl.java @@ -68,9 +68,9 @@ public class AppServiceImpl implements AppService { @Override @Transactional(rollbackFor = Exception.class) - public AppDto create(App resources) { + public void create(App resources) { verification(resources); - return appMapper.toDto(appRepository.save(resources)); + appRepository.save(resources); } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java index 3d8e8f46..28235a16 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DatabaseServiceImpl.java @@ -71,9 +71,9 @@ public class DatabaseServiceImpl implements DatabaseService { @Override @Transactional(rollbackFor = Exception.class) - public DatabaseDto create(Database resources) { + public void create(Database resources) { resources.setId(IdUtil.simpleUUID()); - return databaseMapper.toDto(databaseRepository.save(resources)); + databaseRepository.save(resources); } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployHistoryServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployHistoryServiceImpl.java index 78b5901d..d716caa6 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployHistoryServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployHistoryServiceImpl.java @@ -68,9 +68,9 @@ public class DeployHistoryServiceImpl implements DeployHistoryService { @Override @Transactional(rollbackFor = Exception.class) - public DeployHistoryDto create(DeployHistory resources) { + public void create(DeployHistory resources) { resources.setId(IdUtil.simpleUUID()); - return deployhistoryMapper.toDto(deployhistoryRepository.save(resources)); + deployhistoryRepository.save(resources); } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployServiceImpl.java index 40f6ecb9..a44100f0 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/DeployServiceImpl.java @@ -90,8 +90,8 @@ public class DeployServiceImpl implements DeployService { @Override @Transactional(rollbackFor = Exception.class) - public DeployDto create(Deploy resources) { - return deployMapper.toDto(deployRepository.save(resources)); + public void create(Deploy resources) { + deployRepository.save(resources); } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java index cf02bc52..0034b247 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/mnt/service/impl/ServerDeployServiceImpl.java @@ -89,9 +89,8 @@ public class ServerDeployServiceImpl implements ServerDeployService { @Override @Transactional(rollbackFor = Exception.class) - public ServerDeployDto create(ServerDeploy resources) { - - return serverDeployMapper.toDto(serverDeployRepository.save(resources)); + public void create(ServerDeploy resources) { + serverDeployRepository.save(resources); } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java index b82d0110..021a4349 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/rest/QuartzJobController.java @@ -87,7 +87,8 @@ public class QuartzJobController { if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - return new ResponseEntity<>(quartzJobService.create(resources),HttpStatus.CREATED); + quartzJobService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改定时任务") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java index fc57d0c9..bd385799 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/QuartzJobService.java @@ -64,9 +64,8 @@ public interface QuartzJobService { /** * 创建 * @param resources / - * @return / */ - QuartzJob create(QuartzJob resources); + void create(QuartzJob resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java index eb8b16d0..0f703cf1 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/QuartzJobServiceImpl.java @@ -79,13 +79,12 @@ public class QuartzJobServiceImpl implements QuartzJobService { @Override @Transactional(rollbackFor = Exception.class) - public QuartzJob create(QuartzJob resources) { + public void create(QuartzJob resources) { if (!CronExpression.isValidExpression(resources.getCronExpression())){ throw new BadRequestException("cron表达式格式错误"); } resources = quartzJobRepository.save(resources); quartzManage.addJob(resources); - return resources; } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java index 4a469122..1ca7f178 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dept.java @@ -63,6 +63,9 @@ public class Dept extends BaseEntity implements Serializable { @ApiModelProperty(value = "上级部门") private Long pid; + @ApiModelProperty(value = "子节点数目", hidden = true) + private Integer subCount = 0; + @Override public boolean equals(Object o) { if (this == o) { diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java index 8112cdd5..3e7b3939 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Menu.java @@ -87,6 +87,9 @@ public class Menu extends BaseEntity implements Serializable { @ApiModelProperty(value = "上级菜单") private Long pid; + @ApiModelProperty(value = "子节点数目", hidden = true) + private Integer subCount = 0; + @ApiModelProperty(value = "外链菜单") private Boolean iFrame; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java index 5d1ce641..537f2b1c 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DeptRepository.java @@ -18,6 +18,7 @@ package me.zhengjie.modules.system.repository; import me.zhengjie.modules.system.domain.Dept; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import java.util.List; import java.util.Set; @@ -26,7 +27,6 @@ import java.util.Set; * @author Zheng Jie * @date 2019-03-25 */ -@SuppressWarnings("all") public interface DeptRepository extends JpaRepository, JpaSpecificationExecutor { /** @@ -38,7 +38,7 @@ public interface DeptRepository extends JpaRepository, JpaSpecificat /** * 获取顶级部门 - * @return + * @return / */ List findByPidIsNull(); @@ -60,7 +60,16 @@ public interface DeptRepository extends JpaRepository, JpaSpecificat /** * 判断是否存在子节点 * @param pid / - * @return + * @return / */ int countByPid(Long pid); + + /** + * 根据ID更新sub_count + * @param count / + * @param id / + */ + @Modifying + @Query(value = " update sys_dept set sub_count = ?1 where dept_id = ?2 ",nativeQuery = true) + void updateSubCntById(Integer count, Long id); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictRepository.java index 5f19c7dd..50962055 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictRepository.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictRepository.java @@ -18,10 +18,17 @@ package me.zhengjie.modules.system.repository; import me.zhengjie.modules.system.domain.Dict; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import java.util.Set; /** * @author Zheng Jie * @date 2019-04-10 */ public interface DictRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 删除 + * @param ids / + */ + void deleteByIdIn(Set ids); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java index e43da101..44af09c5 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/MenuRepository.java @@ -18,6 +18,8 @@ package me.zhengjie.modules.system.repository; import me.zhengjie.modules.system.domain.Menu; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -26,7 +28,6 @@ import java.util.Set; * @author Zheng Jie * @date 2018-12-17 */ -@SuppressWarnings("all") public interface MenuRepository extends JpaRepository, JpaSpecificationExecutor { /** @@ -67,7 +68,16 @@ public interface MenuRepository extends JpaRepository, JpaSpecificat /** * 获取节点数量 * @param id / - * @return + * @return / */ int countByPid(Long id); + + /** + * 更新节点数目 + * @param count / + * @param menuId / + */ + @Modifying + @Query(value = " update sys_menu set sub_count = ?1 where menu_id = ?2 ",nativeQuery = true) + void updateSubCntById(int count, Long menuId); } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java index 291cf334..467f9ed0 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/RoleRepository.java @@ -26,7 +26,6 @@ import java.util.Set; * @author Zheng Jie * @date 2018-12-03 */ -@SuppressWarnings("all") public interface RoleRepository extends JpaRepository, JpaSpecificationExecutor { /** @@ -39,7 +38,7 @@ public interface RoleRepository extends JpaRepository, JpaSpecificat /** * 根据用户ID查询 * @param id 用户ID - * @return + * @return / */ Set findByUsers_Id(Long id); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java index c00360b5..ff42771d 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DeptController.java @@ -87,7 +87,8 @@ public class DeptController { if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - return new ResponseEntity<>(deptService.create(resources),HttpStatus.CREATED); + deptService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改部门") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java index 14f4e555..aaf985e9 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java @@ -78,7 +78,8 @@ public class DictController { if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - return new ResponseEntity<>(dictService.create(resources),HttpStatus.CREATED); + dictService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改字典") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java index e2710374..428fe2f4 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java @@ -77,7 +77,8 @@ public class DictDetailController { if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - return new ResponseEntity<>(dictDetailService.create(resources),HttpStatus.CREATED); + dictDetailService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改字典详情") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java index c1b011b3..b479519e 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/JobController.java @@ -71,7 +71,8 @@ public class JobController { if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - return new ResponseEntity<>(jobService.create(resources),HttpStatus.CREATED); + jobService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改岗位") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java index 47baa9dc..3be846ec 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/MenuController.java @@ -103,7 +103,8 @@ public class MenuController { if (resources.getId() != null) { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } - return new ResponseEntity<>(menuService.create(resources),HttpStatus.CREATED); + menuService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改菜单") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java index b03ce75d..ac99ee9c 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/RoleController.java @@ -75,8 +75,8 @@ public class RoleController { @ApiOperation("返回全部的角色") @GetMapping(value = "/all") @PreAuthorize("@el.check('roles:list','user:add','user:edit')") - public ResponseEntity query(@PageableDefault(value = 2000, sort = {"level"}, direction = Sort.Direction.ASC) Pageable pageable){ - return new ResponseEntity<>(roleService.queryAll(pageable),HttpStatus.OK); + public ResponseEntity query(){ + return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK); } @Log("查询角色") @@ -102,7 +102,8 @@ public class RoleController { throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID"); } getLevels(resources.getLevel()); - return new ResponseEntity<>(roleService.create(resources),HttpStatus.CREATED); + roleService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改角色") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java index 66682991..40962d92 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java @@ -88,7 +88,7 @@ public class UserController { criteria.getDeptIds().addAll(dataService.getDeptChildren(deptService.findByPid(criteria.getDeptId()))); } // 数据权限 - List dataScopes = dataService.getDeptIds(userService.findById(SecurityUtils.getCurrentUserId())); + List dataScopes = dataService.getDeptIds(userService.findByName(SecurityUtils.getCurrentUsername())); // criteria.getDeptIds() 不为空并且数据权限不为空则取交集 if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)){ // 取交集 @@ -112,7 +112,8 @@ public class UserController { checkLevel(resources); // 默认密码 123456 resources.setPassword(passwordEncoder.encode("123456")); - return new ResponseEntity<>(userService.create(resources),HttpStatus.CREATED); + userService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } @Log("修改用户") diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java index f94d00ce..854409c5 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DeptService.java @@ -48,9 +48,8 @@ public interface DeptService { /** * 创建 * @param resources / - * @return / */ - DeptDto create(Dept resources); + void create(Dept resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java index 95bd94a3..0e3dc044 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java @@ -37,9 +37,8 @@ public interface DictDetailService { /** * 创建 * @param resources / - * @return / */ - DictDetailDto create(DictDetail resources); + void create(DictDetail resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java index 0ade0728..679d078b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java @@ -59,7 +59,7 @@ public interface DictService { * @param resources / * @return / */ - DictDto create(Dict resources); + void create(Dict resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java index ad1b2dbb..e501d9d3 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/JobService.java @@ -44,7 +44,7 @@ public interface JobService { * @param resources / * @return / */ - JobDto create(Job resources); + void create(Job resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java index 231c3e8d..9cb6a9d9 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/MenuService.java @@ -49,9 +49,8 @@ public interface MenuService { /** * 创建 * @param resources / - * @return / */ - MenuDto create(Menu resources); + void create(Menu resources); /** * 编辑 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java index e6fde42a..5fb58f3b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/RoleService.java @@ -33,6 +33,12 @@ import java.util.Set; */ public interface RoleService { + /** + * 查询全部数据 + * @return / + */ + List queryAll(); + /** * 根据ID查询 * @param id / @@ -43,9 +49,8 @@ public interface RoleService { /** * 创建 * @param resources / - * @return / */ - RoleDto create(Role resources); + void create(Role resources); /** * 编辑 @@ -86,13 +91,6 @@ public interface RoleService { */ void untiedMenu(Long id); - /** - * 不带条件分页查询 - * @param pageable 分页参数 - * @return / - */ - Object queryAll(Pageable pageable); - /** * 待条件分页查询 * @param criteria 条件 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java index 37cf013d..2a2863f4 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/UserService.java @@ -41,9 +41,8 @@ public interface UserService { /** * 新增用户 * @param resources / - * @return / */ - UserDto create(User resources); + void create(User resources); /** * 编辑用户 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java index c8a3e53e..4c3b12aa 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DeptDto.java @@ -44,9 +44,15 @@ public class DeptDto extends BaseDTO implements Serializable { private Long pid; - private Boolean hasChildren = false; + private Integer subCount; - private Boolean leaf = true; + public Boolean getHasChildren() { + return subCount > 0; + } + + public Boolean getLeaf() { + return subCount <= 0; + } public String getLabel() { return name; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java index 88147ac8..d60dd290 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/MenuDto.java @@ -48,6 +48,8 @@ public class MenuDto extends BaseDTO implements Serializable { private Long pid; + private Integer subCount; + private Boolean iFrame; private Boolean cache; @@ -58,9 +60,13 @@ public class MenuDto extends BaseDTO implements Serializable { private String icon; - private Boolean leaf = true; + public Boolean getHasChildren() { + return subCount > 0; + } - private Boolean hasChildren = false; + public Boolean getLeaf() { + return subCount <= 0; + } public String getLabel() { return title; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java index ad9abe66..0ad2bff2 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DataServiceImpl.java @@ -23,8 +23,6 @@ import me.zhengjie.modules.system.service.RoleService; import me.zhengjie.modules.system.service.dto.RoleSmallDto; import me.zhengjie.modules.system.service.dto.UserDto; import me.zhengjie.utils.enums.DataScopeEnum; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.*; @@ -36,14 +34,12 @@ import java.util.*; **/ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "role") public class DataServiceImpl implements DataService { private final RoleService roleService; private final DeptService deptService; @Override - @Cacheable public List getDeptIds(UserDto user) { // 用于存储部门id Set deptIds = new HashSet<>(); @@ -90,7 +86,6 @@ public class DataServiceImpl implements DataService { * @return 数据权限 */ @Override - @Cacheable public List getDeptChildren(List deptList) { List list = new ArrayList<>(); deptList.forEach(dept -> { diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java index 010b6642..bfdb435c 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DeptServiceImpl.java @@ -28,9 +28,6 @@ import me.zhengjie.utils.ValidationUtil; import me.zhengjie.modules.system.repository.DeptRepository; import me.zhengjie.modules.system.service.DeptService; import me.zhengjie.modules.system.service.mapstruct.DeptMapper; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -47,7 +44,6 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "dept") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class DeptServiceImpl implements DeptService { @@ -55,7 +51,6 @@ public class DeptServiceImpl implements DeptService { private final DeptMapper deptMapper; @Override - @Cacheable public List queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception { Sort sort = new Sort(Sort.Direction.ASC, "deptSort"); if (isQuery) { @@ -79,7 +74,6 @@ public class DeptServiceImpl implements DeptService { } @Override - @Cacheable(key = "#p0") public DeptDto findById(Long id) { Dept dept = deptRepository.findById(id).orElseGet(Dept::new); ValidationUtil.isNull(dept.getId(),"Dept","id",id); @@ -87,7 +81,6 @@ public class DeptServiceImpl implements DeptService { } @Override - @Cacheable public List findByPid(long pid) { return deptRepository.findByPid(pid); } @@ -98,16 +91,21 @@ public class DeptServiceImpl implements DeptService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) - public DeptDto create(Dept resources) { - return deptMapper.toDto(deptRepository.save(resources)); + public void create(Dept resources) { + deptRepository.save(resources); + // 计算子节点数目 + resources.setSubCount(0); + if(resources.getPid() != null){ + updateSubCnt(resources.getPid()); + } } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void update(Dept resources) { + // 旧的菜单 + DeptDto old = findById(resources.getId()); if(resources.getPid() != null && resources.getId().equals(resources.getPid())) { throw new BadRequestException("上级不能为自己"); } @@ -115,14 +113,21 @@ public class DeptServiceImpl implements DeptService { ValidationUtil.isNull( dept.getId(),"Dept","id",resources.getId()); resources.setId(dept.getId()); deptRepository.save(resources); + if(resources.getPid() == null){ + updateSubCnt(old.getPid()); + } else { + updateSubCnt(resources.getPid()); + } } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Set deptDtos) { for (DeptDto deptDto : deptDtos) { deptRepository.deleteById(deptDto.getId()); + if(deptDto.getPid() != null){ + updateSubCnt(deptDto.getPid()); + } } } @@ -199,4 +204,9 @@ public class DeptServiceImpl implements DeptService { map.put("content",CollectionUtil.isEmpty(trees)? deptDtos :trees); return map; } + + private void updateSubCnt(Long deptId){ + int count = deptRepository.countByPid(deptId); + deptRepository.updateSubCntById(count, deptId); + } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java index 3893337d..f2b76e74 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java @@ -25,9 +25,6 @@ import me.zhengjie.modules.system.repository.DictDetailRepository; import me.zhengjie.modules.system.service.DictDetailService; import me.zhengjie.modules.system.service.dto.DictDetailDto; import me.zhengjie.modules.system.service.mapstruct.DictDetailMapper; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -41,7 +38,6 @@ import java.util.Map; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "dictDetail") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class DictDetailServiceImpl implements DictDetailService { @@ -49,14 +45,12 @@ public class DictDetailServiceImpl implements DictDetailService { private final DictDetailMapper dictDetailMapper; @Override - @Cacheable public Map queryAll(DictDetailQueryCriteria criteria, Pageable pageable) { Page page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); return PageUtil.toPage(page.map(dictDetailMapper::toDto)); } @Override - @Cacheable(key = "#p0") public DictDetailDto findById(Long id) { DictDetail dictDetail = dictDetailRepository.findById(id).orElseGet(DictDetail::new); ValidationUtil.isNull(dictDetail.getId(),"DictDetail","id",id); @@ -64,14 +58,12 @@ public class DictDetailServiceImpl implements DictDetailService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) - public DictDetailDto create(DictDetail resources) { - return dictDetailMapper.toDto(dictDetailRepository.save(resources)); + public void create(DictDetail resources) { + dictDetailRepository.save(resources); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void update(DictDetail resources) { DictDetail dictDetail = dictDetailRepository.findById(resources.getId()).orElseGet(DictDetail::new); @@ -81,7 +73,6 @@ public class DictDetailServiceImpl implements DictDetailService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Long id) { dictDetailRepository.deleteById(id); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java index b351d003..0e571ca8 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java @@ -20,17 +20,11 @@ import lombok.RequiredArgsConstructor; import me.zhengjie.modules.system.domain.Dict; import me.zhengjie.modules.system.service.dto.DictDetailDto; import me.zhengjie.modules.system.service.dto.DictQueryCriteria; -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 me.zhengjie.modules.system.repository.DictRepository; import me.zhengjie.modules.system.service.DictService; import me.zhengjie.modules.system.service.dto.DictDto; import me.zhengjie.modules.system.service.mapstruct.DictMapper; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -46,15 +40,14 @@ import java.util.*; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "dict") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class DictServiceImpl implements DictService { private final DictRepository dictRepository; private final DictMapper dictMapper; + private final RedisUtils redisUtils; @Override - @Cacheable public Map queryAll(DictQueryCriteria dict, Pageable pageable){ Page page = dictRepository.findAll((root, query, cb) -> QueryHelp.getPredicate(root, dict, cb), pageable); return PageUtil.toPage(page.map(dictMapper::toDto)); @@ -67,7 +60,6 @@ public class DictServiceImpl implements DictService { } @Override - @Cacheable(key = "#p0") public DictDto findById(Long id) { Dict dict = dictRepository.findById(id).orElseGet(Dict::new); ValidationUtil.isNull(dict.getId(),"Dict","id",id); @@ -75,14 +67,12 @@ public class DictServiceImpl implements DictService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) - public DictDto create(Dict resources) { - return dictMapper.toDto(dictRepository.save(resources)); + public void create(Dict resources) { + dictRepository.save(resources); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void update(Dict resources) { Dict dict = dictRepository.findById(resources.getId()).orElseGet(Dict::new); @@ -92,12 +82,10 @@ public class DictServiceImpl implements DictService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Set ids) { - for (Long id : ids) { - dictRepository.deleteById(id); - } + dictRepository.deleteByIdIn(ids); + redisUtils.delByKeys("dict::", ids); } @Override diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java index 01c14fa2..d48208ad 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/JobServiceImpl.java @@ -19,17 +19,11 @@ import lombok.RequiredArgsConstructor; import me.zhengjie.exception.EntityExistException; import me.zhengjie.modules.system.domain.Job; import me.zhengjie.modules.system.service.dto.JobQueryCriteria; -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 me.zhengjie.modules.system.repository.JobRepository; import me.zhengjie.modules.system.service.JobService; import me.zhengjie.modules.system.service.dto.JobDto; import me.zhengjie.modules.system.service.mapstruct.JobMapper; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -45,29 +39,26 @@ import java.util.*; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "job") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class JobServiceImpl implements JobService { private final JobRepository jobRepository; private final JobMapper jobMapper; + private final RedisUtils redisUtils; @Override - @Cacheable public Map queryAll(JobQueryCriteria criteria, Pageable pageable) { Page page = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); return PageUtil.toPage(page.map(jobMapper::toDto).getContent(),page.getTotalElements()); } @Override - @Cacheable public List queryAll(JobQueryCriteria criteria) { List list = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); return jobMapper.toDto(list); } @Override - @Cacheable(key = "#p0") public JobDto findById(Long id) { Job job = jobRepository.findById(id).orElseGet(Job::new); ValidationUtil.isNull(job.getId(),"Job","id",id); @@ -75,18 +66,16 @@ public class JobServiceImpl implements JobService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) - public JobDto create(Job resources) { + public void create(Job resources) { Job job = jobRepository.findByName(resources.getName()); if(job != null){ throw new EntityExistException(Job.class,"name",resources.getName()); } - return jobMapper.toDto(jobRepository.save(resources)); + jobRepository.save(resources); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void update(Job resources) { Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new); @@ -100,11 +89,12 @@ public class JobServiceImpl implements JobService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Set ids) { for (Long id : ids) { jobRepository.deleteById(id); + // 删除缓存 + redisUtils.del("job::"+id); } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java index ee1386f1..393f26c9 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/MenuServiceImpl.java @@ -34,9 +34,6 @@ import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.QueryHelp; import me.zhengjie.utils.StringUtils; import me.zhengjie.utils.ValidationUtil; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -52,7 +49,6 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "menu") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class MenuServiceImpl implements MenuService { @@ -61,7 +57,6 @@ public class MenuServiceImpl implements MenuService { private final RoleService roleService; @Override - @Cacheable public List queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception { Sort sort = new Sort(Sort.Direction.ASC, "menuSort"); if(isQuery){ @@ -84,7 +79,6 @@ public class MenuServiceImpl implements MenuService { } @Override - @Cacheable(key = "#p0") public MenuDto findById(long id) { Menu menu = menuRepository.findById(id).orElseGet(Menu::new); ValidationUtil.isNull(menu.getId(),"Menu","id",id); @@ -92,7 +86,6 @@ public class MenuServiceImpl implements MenuService { } @Override - @Cacheable public List findByRoles(List roles) { Set roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet()); LinkedHashSet menus = menuRepository.findByRoles_IdInAndTypeNotOrderByMenuSortAsc(roleIds, 2); @@ -100,8 +93,8 @@ public class MenuServiceImpl implements MenuService { } @Override - @CacheEvict(allEntries = true) - public MenuDto create(Menu resources) { + @Transactional(rollbackFor = Exception.class) + public void create(Menu resources) { if(menuRepository.findByTitle(resources.getTitle()) != null){ throw new EntityExistException(Menu.class,"title",resources.getTitle()); } @@ -119,16 +112,23 @@ public class MenuServiceImpl implements MenuService { throw new BadRequestException("外链必须以http://或者https://开头"); } } - return menuMapper.toDto(menuRepository.save(resources)); + menuRepository.save(resources); + // 计算子节点数目 + resources.setSubCount(0); + if(resources.getPid() != null){ + updateSubCnt(resources.getPid()); + } } @Override - @CacheEvict(allEntries = true) + @Transactional(rollbackFor = Exception.class) public void update(Menu resources) { if(resources.getId().equals(resources.getPid())) { throw new BadRequestException("上级不能为自己"); } Menu menu = menuRepository.findById(resources.getId()).orElseGet(Menu::new); + // 记录旧的父节点ID + Long oldPid = menu.getPid(); ValidationUtil.isNull(menu.getId(),"Permission","id",resources.getId()); if(resources.getIFrame()){ @@ -165,6 +165,12 @@ public class MenuServiceImpl implements MenuService { menu.setPermission(resources.getPermission()); menu.setType(resources.getType()); menuRepository.save(menu); + // 计算子节点数目 + if(resources.getPid() == null){ + updateSubCnt(oldPid); + } else { + updateSubCnt(resources.getPid()); + } } @Override @@ -181,17 +187,18 @@ public class MenuServiceImpl implements MenuService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Set menuSet) { for (Menu menu : menuSet) { roleService.untiedMenu(menu.getId()); menuRepository.deleteById(menu.getId()); + if(menu.getPid() != null){ + updateSubCnt(menu.getPid()); + } } } @Override - @Cacheable public Object getMenus(Long pid) { List menus; if(pid != null && !pid.equals(0L)){ @@ -203,7 +210,6 @@ public class MenuServiceImpl implements MenuService { } @Override - @Cacheable public List getSuperior(MenuDto menuDto, List menus) { if(menuDto.getPid() == null){ menus.addAll(menuRepository.findByPidIsNull()); @@ -214,7 +220,6 @@ public class MenuServiceImpl implements MenuService { } @Override - @Cacheable(key = "'pid:'+#p0") public List findByPid(long pid) { return menuRepository.findByPid(pid); } @@ -294,7 +299,6 @@ public class MenuServiceImpl implements MenuService { } @Override - @Cacheable public Menu findOne(Long id) { Menu menu = menuRepository.findById(id).orElseGet(Menu::new); ValidationUtil.isNull(menu.getId(),"Menu","id",id); @@ -317,4 +321,9 @@ public class MenuServiceImpl implements MenuService { } FileUtil.downloadExcel(list, response); } + + private void updateSubCnt(Long menuId){ + int count = menuRepository.countByPid(menuId); + menuRepository.updateSubCntById(count, menuId); + } } diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/RoleServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/RoleServiceImpl.java index 02b1ef2c..74652726 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/RoleServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/RoleServiceImpl.java @@ -32,11 +32,9 @@ import me.zhengjie.modules.system.service.mapstruct.RoleMapper; import me.zhengjie.modules.system.service.mapstruct.RoleSmallMapper; import me.zhengjie.utils.*; import me.zhengjie.utils.enums.DataScopeEnum; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.stereotype.Service; @@ -53,7 +51,6 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "role") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class RoleServiceImpl implements RoleService { @@ -61,28 +58,26 @@ public class RoleServiceImpl implements RoleService { private final RoleMapper roleMapper; private final RoleSmallMapper roleSmallMapper; private final DeptRepository deptRepository; + private final RedisUtils redisUtils; @Override - @Cacheable - public Object queryAll(Pageable pageable) { - return roleMapper.toDto(roleRepository.findAll(pageable).getContent()); + public List queryAll() { + Sort sort = new Sort(Sort.Direction.ASC, "level"); + return roleMapper.toDto(roleRepository.findAll(sort)); } @Override - @Cacheable public List queryAll(RoleQueryCriteria criteria) { return roleMapper.toDto(roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); } @Override - @Cacheable public Object queryAll(RoleQueryCriteria criteria, Pageable pageable) { Page page = roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); return PageUtil.toPage(page.map(roleMapper::toDto)); } @Override - @Cacheable(key = "#p0") public RoleDto findById(long id) { Role role = roleRepository.findById(id).orElseGet(Role::new); ValidationUtil.isNull(role.getId(),"Role","id",id); @@ -90,18 +85,16 @@ public class RoleServiceImpl implements RoleService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) - public RoleDto create(Role resources) { + public void create(Role resources) { if(roleRepository.findByName(resources.getName()) != null){ throw new EntityExistException(Role.class,"username",resources.getName()); } checkDataScope(resources); - return roleMapper.toDto(roleRepository.save(resources)); + roleRepository.save(resources); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void update(Role resources) { Role role = roleRepository.findById(resources.getId()).orElseGet(Role::new); @@ -135,7 +128,6 @@ public class RoleServiceImpl implements RoleService { } @Override - @CacheEvict(allEntries = true) public void updateMenu(Role resources, RoleDto roleDTO) { Role role = roleMapper.toEntity(roleDTO); role.setMenus(resources.getMenus()); @@ -143,29 +135,27 @@ public class RoleServiceImpl implements RoleService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void untiedMenu(Long id) { roleRepository.untiedMenu(id); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Set ids) { for (Long id : ids) { roleRepository.deleteById(id); + // 删除缓存 + redisUtils.del("role::"+id); } } @Override - @Cacheable(key = "'findByUsers_Id:' + #p0") public List findByUsersId(Long id) { return roleSmallMapper.toDto(new ArrayList<>(roleRepository.findByUsers_Id(id))); } @Override - @Cacheable public Integer findByRoles(Set roles) { Set roleDtos = new HashSet<>(); for (Role role : roles) { @@ -175,7 +165,6 @@ public class RoleServiceImpl implements RoleService { } @Override - @Cacheable(key = "'loadPermissionByUser:' + #p0.username") public List mapToGrantedAuthorities(UserDto user) { Set permissions = new HashSet<>(); // 如果是管理员直接返回 diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java index 24655117..7cbedd35 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java @@ -28,9 +28,6 @@ import me.zhengjie.modules.system.service.dto.UserDto; import me.zhengjie.modules.system.service.dto.UserQueryCriteria; import me.zhengjie.modules.system.service.mapstruct.UserMapper; import me.zhengjie.utils.*; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -49,7 +46,6 @@ import java.util.stream.Collectors; */ @Service @RequiredArgsConstructor -@CacheConfig(cacheNames = "user") @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class UserServiceImpl implements UserService { @@ -59,21 +55,18 @@ public class UserServiceImpl implements UserService { private final FileProperties properties; @Override - @Cacheable public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { Page page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); return PageUtil.toPage(page.map(userMapper::toDto)); } @Override - @Cacheable public List queryAll(UserQueryCriteria criteria) { List users = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); return userMapper.toDto(users); } @Override - @Cacheable(key = "#p0") public UserDto findById(long id) { User user = userRepository.findById(id).orElseGet(User::new); ValidationUtil.isNull(user.getId(),"User","id",id); @@ -81,20 +74,18 @@ public class UserServiceImpl implements UserService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) - public UserDto create(User resources) { + public void create(User resources) { if(userRepository.findByUsername(resources.getUsername())!=null){ throw new EntityExistException(User.class,"username",resources.getUsername()); } if(userRepository.findByEmail(resources.getEmail())!=null){ throw new EntityExistException(User.class,"email",resources.getEmail()); } - return userMapper.toDto(userRepository.save(resources)); + userRepository.save(resources); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void update(User resources) { User user = userRepository.findById(resources.getId()).orElseGet(User::new); @@ -112,9 +103,9 @@ public class UserServiceImpl implements UserService { // 如果用户的角色改变了,需要手动清理下缓存 if (!resources.getRoles().equals(user.getRoles())) { - String key = "role::loadPermissionByUser:" + user.getUsername(); + String key = "role::permission:" + user.getUsername(); redisUtils.del(key); - key = "role::findByUsers_Id:" + user.getId(); + key = "role::user:" + user.getId(); redisUtils.del(key); } @@ -131,7 +122,6 @@ public class UserServiceImpl implements UserService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void updateCenter(User resources) { User user = userRepository.findById(resources.getId()).orElseGet(User::new); @@ -142,7 +132,6 @@ public class UserServiceImpl implements UserService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void delete(Set ids) { for (Long id : ids) { @@ -151,7 +140,6 @@ public class UserServiceImpl implements UserService { } @Override - @Cacheable(key = "'loadUserByUsername:'+#p0") public UserDto findByName(String userName) { User user; if(ValidationUtil.isEmail(userName)){ @@ -167,14 +155,12 @@ public class UserServiceImpl implements UserService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void updatePass(String username, String pass) { userRepository.updatePass(username,pass,new Date()); } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void updateAvatar(MultipartFile multipartFile) { User user = userRepository.findByUsername(SecurityUtils.getCurrentUsername()); @@ -189,7 +175,6 @@ public class UserServiceImpl implements UserService { } @Override - @CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class) public void updateEmail(String username, String email) { userRepository.updateEmail(username,email); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DeptMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DeptMapper.java index 4c1fe3f2..b0fb9049 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DeptMapper.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DeptMapper.java @@ -17,12 +17,8 @@ package me.zhengjie.modules.system.service.mapstruct; import me.zhengjie.base.BaseMapper; import me.zhengjie.modules.system.domain.Dept; -import me.zhengjie.modules.system.repository.DeptRepository; import me.zhengjie.modules.system.service.dto.DeptDto; -import me.zhengjie.utils.SpringContextHolder; -import org.mapstruct.AfterMapping; import org.mapstruct.Mapper; -import org.mapstruct.MappingTarget; import org.mapstruct.ReportingPolicy; /** @@ -31,20 +27,4 @@ import org.mapstruct.ReportingPolicy; */ @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) public interface DeptMapper extends BaseMapper { - - /** - * 转换后的特殊处理 - * @param deptDto / - * @return / - */ - @AfterMapping - default DeptDto dealDto(@MappingTarget DeptDto deptDto) { - DeptRepository deptRepository = SpringContextHolder.getBean(DeptRepository.class); - if(deptRepository.countByPid(deptDto.getId()) > 0){ - deptDto.setHasChildren(true); - deptDto.setLeaf(false); - } - return deptDto; - } - } \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/MenuMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/MenuMapper.java index 9cdbb7a8..6d8bffab 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/MenuMapper.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/MenuMapper.java @@ -17,12 +17,8 @@ package me.zhengjie.modules.system.service.mapstruct; import me.zhengjie.base.BaseMapper; import me.zhengjie.modules.system.domain.Menu; -import me.zhengjie.modules.system.repository.MenuRepository; import me.zhengjie.modules.system.service.dto.MenuDto; -import me.zhengjie.utils.SpringContextHolder; -import org.mapstruct.AfterMapping; import org.mapstruct.Mapper; -import org.mapstruct.MappingTarget; import org.mapstruct.ReportingPolicy; /** @@ -31,19 +27,4 @@ import org.mapstruct.ReportingPolicy; */ @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) public interface MenuMapper extends BaseMapper { - - /** - * 转换 - * @param menuDto / - * @return / - */ - @AfterMapping - default MenuDto dealDto(@MappingTarget MenuDto menuDto) { - MenuRepository menuRepository = SpringContextHolder.getBean(MenuRepository.class); - if(menuRepository.countByPid(menuDto.getId()) > 0){ - menuDto.setLeaf(false); - menuDto.setHasChildren(true); - } - return menuDto; - } } diff --git a/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java b/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java index 3bab1836..bed88d66 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java +++ b/eladmin-tools/src/main/java/me/zhengjie/rest/LocalStorageController.java @@ -63,7 +63,8 @@ public class LocalStorageController { @PostMapping @PreAuthorize("@el.check('storage:add')") public ResponseEntity create(@RequestParam String name, @RequestParam("file") MultipartFile file){ - return new ResponseEntity<>(localStorageService.create(name, file),HttpStatus.CREATED); + localStorageService.create(name, file); + return new ResponseEntity<>(HttpStatus.CREATED); } @ApiOperation("修改文件") diff --git a/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java b/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java index 9ac8f2e2..1ab4afd4 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java +++ b/eladmin-tools/src/main/java/me/zhengjie/service/LocalStorageService.java @@ -56,9 +56,8 @@ public interface LocalStorageService { * 上传 * @param name 文件名称 * @param file 文件 - * @return / */ - LocalStorageDto create(String name, MultipartFile file); + void create(String name, MultipartFile file); /** * 编辑 diff --git a/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java b/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java index 03c491f9..b7c23b7e 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java +++ b/eladmin-tools/src/main/java/me/zhengjie/service/impl/LocalStorageServiceImpl.java @@ -73,7 +73,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { @Override @Transactional(rollbackFor = Exception.class) - public LocalStorageDto create(String name, MultipartFile multipartFile) { + public void create(String name, MultipartFile multipartFile) { FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); String type = FileUtil.getFileType(suffix); @@ -91,7 +91,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { type, FileUtil.getSize(multipartFile.getSize()) ); - return localStorageMapper.toDto(localStorageRepository.save(localStorage)); + localStorageRepository.save(localStorage); }catch (Exception e){ FileUtil.del(file); throw e; diff --git a/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java b/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java index 4158973b..ba7661b7 100644 --- a/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java +++ b/eladmin-tools/src/main/java/me/zhengjie/service/impl/QiNiuServiceImpl.java @@ -67,7 +67,6 @@ public class QiNiuServiceImpl implements QiNiuService { private Long maxSize; @Override - @Cacheable public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){ return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); } diff --git a/sql/eladmin.sql b/sql/eladmin.sql index 33853524..01dee727 100644 --- a/sql/eladmin.sql +++ b/sql/eladmin.sql @@ -11,7 +11,7 @@ Target Server Version : 50710 File Encoding : 65001 - Date: 10/05/2020 20:31:38 + Date: 14/05/2020 13:28:14 */ SET NAMES utf8mb4; @@ -57,7 +57,7 @@ CREATE TABLE `code_gen_config` ( `api_alias` varchar(255) DEFAULT NULL COMMENT '接口名称', PRIMARY KEY (`config_id`) USING BTREE, KEY `idx_table_name` (`table_name`(100)) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成器配置'; +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='代码生成器配置'; -- ---------------------------- -- Table structure for mnt_app @@ -185,6 +185,13 @@ CREATE TABLE `mnt_server` ( KEY `idx_ip` (`ip`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='服务器管理'; +-- ---------------------------- +-- Records of mnt_server +-- ---------------------------- +BEGIN; +INSERT INTO `mnt_server` VALUES (1, 'root', '132.232.129.20', '腾讯云', 'Dqjdda1996.', 8013, NULL, NULL, '2019-11-24 20:35:02', NULL); +COMMIT; + -- ---------------------------- -- Table structure for sys_dept -- ---------------------------- @@ -192,6 +199,7 @@ DROP TABLE IF EXISTS `sys_dept`; CREATE TABLE `sys_dept` ( `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', `pid` bigint(20) DEFAULT NULL COMMENT '上级部门', + `sub_count` int(5) DEFAULT '0' COMMENT '子部门数目', `name` varchar(255) NOT NULL COMMENT '名称', `dept_sort` int(5) DEFAULT '999' COMMENT '排序', `enabled` bit(1) NOT NULL COMMENT '状态', @@ -202,18 +210,18 @@ CREATE TABLE `sys_dept` ( PRIMARY KEY (`dept_id`) USING BTREE, KEY `inx_pid` (`pid`), KEY `inx_enabled` (`enabled`) -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门'; +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门'; -- ---------------------------- -- Records of sys_dept -- ---------------------------- BEGIN; -INSERT INTO `sys_dept` VALUES (2, 7, '研发部', 3, b'1', NULL, 'admin', '2019-03-25 09:15:32', '2020-05-10 17:37:58'); -INSERT INTO `sys_dept` VALUES (5, 7, '运维部', 4, b'1', NULL, NULL, '2019-03-25 09:20:44', NULL); -INSERT INTO `sys_dept` VALUES (6, 8, '测试部', 6, b'1', NULL, NULL, '2019-03-25 09:52:18', NULL); -INSERT INTO `sys_dept` VALUES (7, NULL, '华南分部', 0, b'1', NULL, 'admin', '2019-03-25 11:04:50', '2020-05-10 19:59:12'); -INSERT INTO `sys_dept` VALUES (8, NULL, '华北分部', 1, b'1', NULL, 'admin', '2019-03-25 11:04:53', '2020-05-10 19:59:20'); -INSERT INTO `sys_dept` VALUES (11, 8, '人事部', 5, b'1', NULL, 'admin', '2019-03-25 11:07:58', '2020-05-10 17:40:06'); +INSERT INTO `sys_dept` VALUES (2, 7, 0, '研发部', 3, b'1', NULL, 'admin', '2019-03-25 09:15:32', '2020-05-10 17:37:58'); +INSERT INTO `sys_dept` VALUES (5, 7, 0, '运维部', 4, b'1', NULL, NULL, '2019-03-25 09:20:44', NULL); +INSERT INTO `sys_dept` VALUES (6, 8, 0, '测试部', 6, b'1', NULL, NULL, '2019-03-25 09:52:18', NULL); +INSERT INTO `sys_dept` VALUES (7, NULL, 2, '华南分部', 0, b'1', NULL, 'admin', '2019-03-25 11:04:50', '2020-05-10 19:59:12'); +INSERT INTO `sys_dept` VALUES (8, NULL, 2, '华北分部', 1, b'1', NULL, 'admin', '2019-03-25 11:04:53', '2020-05-14 12:54:00'); +INSERT INTO `sys_dept` VALUES (15, 8, 0, 'UI部门', 7, b'1', 'admin', 'admin', '2020-05-13 22:56:53', '2020-05-14 12:54:13'); COMMIT; -- ---------------------------- @@ -318,7 +326,13 @@ CREATE TABLE `sys_log` ( PRIMARY KEY (`log_id`) USING BTREE, KEY `log_create_time_index` (`create_time`), KEY `inx_log_type` (`log_type`) -) ENGINE=InnoDB AUTO_INCREMENT=2094 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志'; +) ENGINE=InnoDB AUTO_INCREMENT=2573 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统日志'; + +-- ---------------------------- +-- Records of sys_log +-- ---------------------------- +BEGIN; +COMMIT; -- ---------------------------- -- Table structure for sys_menu @@ -327,6 +341,7 @@ DROP TABLE IF EXISTS `sys_menu`; CREATE TABLE `sys_menu` ( `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', `pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID', + `sub_count` int(5) DEFAULT '0' COMMENT '子菜单数目', `type` int(11) DEFAULT NULL COMMENT '菜单类型', `title` varchar(255) DEFAULT NULL COMMENT '菜单标题', `name` varchar(255) DEFAULT NULL COMMENT '组件名称', @@ -346,91 +361,91 @@ CREATE TABLE `sys_menu` ( UNIQUE KEY `uniq_title` (`title`), UNIQUE KEY `uniq_name` (`name`), KEY `inx_pid` (`pid`) -) ENGINE=InnoDB AUTO_INCREMENT=117 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单'; +) ENGINE=InnoDB AUTO_INCREMENT=120 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单'; -- ---------------------------- -- Records of sys_menu -- ---------------------------- BEGIN; -INSERT INTO `sys_menu` VALUES (1, NULL, 0, '系统管理', NULL, NULL, 1, 'system', 'system', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:11:29', NULL); -INSERT INTO `sys_menu` VALUES (2, 1, 1, '用户管理', 'User', 'system/user/index', 2, 'peoples', 'user', b'0', b'0', b'0', 'user:list', NULL, NULL, '2018-12-18 15:14:44', NULL); -INSERT INTO `sys_menu` VALUES (3, 1, 1, '角色管理', 'Role', 'system/role/index', 3, 'role', 'role', b'0', b'0', b'0', 'roles:list', NULL, NULL, '2018-12-18 15:16:07', NULL); -INSERT INTO `sys_menu` VALUES (5, 1, 1, '菜单管理', 'Menu', 'system/menu/index', 5, 'menu', 'menu', b'0', b'0', b'0', 'menu:list', NULL, NULL, '2018-12-18 15:17:28', NULL); -INSERT INTO `sys_menu` VALUES (6, NULL, 0, '系统监控', NULL, NULL, 10, 'monitor', 'monitor', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:17:48', NULL); -INSERT INTO `sys_menu` VALUES (7, 6, 1, '操作日志', 'Log', 'monitor/log/index', 11, 'log', 'logs', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:18:26', NULL); -INSERT INTO `sys_menu` VALUES (9, 6, 1, 'SQL监控', 'Sql', 'monitor/sql/index', 18, 'sqlMonitor', 'druid', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:19:34', NULL); -INSERT INTO `sys_menu` VALUES (10, NULL, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:16', NULL); -INSERT INTO `sys_menu` VALUES (11, 10, 1, '图标库', 'Icons', 'components/icons/index', 51, 'icon', 'icon', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:49', NULL); -INSERT INTO `sys_menu` VALUES (14, 36, 1, '邮件工具', 'Email', 'tools/email/index', 35, 'email', 'email', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 10:13:09', NULL); -INSERT INTO `sys_menu` VALUES (15, 10, 1, '富文本', 'Editor', 'components/Editor', 52, 'fwb', 'tinymce', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 11:58:25', NULL); -INSERT INTO `sys_menu` VALUES (16, 36, 1, '图床管理', 'Pictures', 'tools/picture/index', 33, 'image', 'pictures', b'0', b'0', b'0', 'pictures:list', NULL, NULL, '2018-12-28 09:36:53', NULL); -INSERT INTO `sys_menu` VALUES (18, 36, 1, '存储管理', 'Storage', 'tools/storage/index', 34, 'qiniu', 'storage', b'0', b'0', b'0', 'storage:list', NULL, NULL, '2018-12-31 11:12:15', NULL); -INSERT INTO `sys_menu` VALUES (19, 36, 1, '支付宝工具', 'AliPay', 'tools/aliPay/index', 37, 'alipay', 'aliPay', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-31 14:52:38', NULL); -INSERT INTO `sys_menu` VALUES (21, NULL, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'1', NULL, NULL, NULL, '2019-01-04 16:22:03', NULL); -INSERT INTO `sys_menu` VALUES (22, 21, 1, '二级菜单1', NULL, 'nested/menu1/index', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:29', NULL); -INSERT INTO `sys_menu` VALUES (23, 21, 1, '二级菜单2', NULL, 'nested/menu2/index', 999, 'menu', 'menu2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:57', NULL); -INSERT INTO `sys_menu` VALUES (24, 22, 1, '三级菜单1', NULL, 'nested/menu1/menu1-1', 999, 'menu', 'menu1-1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:24:48', NULL); -INSERT INTO `sys_menu` VALUES (27, 22, 1, '三级菜单2', NULL, 'nested/menu1/menu1-2', 999, 'menu', 'menu1-2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-07 17:27:32', NULL); -INSERT INTO `sys_menu` VALUES (28, 1, 1, '任务调度', 'Timing', 'system/timing/index', 999, 'timing', 'timing', b'0', b'0', b'0', 'timing:list', NULL, NULL, '2019-01-07 20:34:40', NULL); -INSERT INTO `sys_menu` VALUES (30, 36, 1, '代码生成', 'GeneratorIndex', 'generator/index', 32, 'dev', 'generator', b'0', b'1', b'0', NULL, NULL, NULL, '2019-01-11 15:45:55', NULL); -INSERT INTO `sys_menu` VALUES (32, 6, 1, '异常日志', 'ErrorLog', 'monitor/log/errorLog', 12, 'error', 'errorLog', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-13 13:49:03', NULL); -INSERT INTO `sys_menu` VALUES (33, 10, 1, 'Markdown', 'Markdown', 'components/MarkDown', 53, 'markdown', 'markdown', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 13:46:44', NULL); -INSERT INTO `sys_menu` VALUES (34, 10, 1, 'Yaml编辑器', 'YamlEdit', 'components/YamlEdit', 54, 'dev', 'yaml', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 15:49:40', NULL); -INSERT INTO `sys_menu` VALUES (35, 1, 1, '部门管理', 'Dept', 'system/dept/index', 6, 'dept', 'dept', b'0', b'0', b'0', 'dept:list', NULL, NULL, '2019-03-25 09:46:00', NULL); -INSERT INTO `sys_menu` VALUES (36, NULL, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 10:57:35', NULL); -INSERT INTO `sys_menu` VALUES (37, 1, 1, '岗位管理', 'Job', 'system/job/index', 7, 'Steve-Jobs', 'job', b'0', b'0', b'0', 'job:list', NULL, NULL, '2019-03-29 13:51:18', NULL); -INSERT INTO `sys_menu` VALUES (38, 36, 1, '接口文档', 'Swagger', 'tools/swagger/index', 36, 'swagger', 'swagger2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 19:57:53', NULL); -INSERT INTO `sys_menu` VALUES (39, 1, 1, '字典管理', 'Dict', 'system/dict/index', 8, 'dictionary', 'dict', b'0', b'0', b'0', 'dict:list', NULL, NULL, '2019-04-10 11:49:04', NULL); -INSERT INTO `sys_menu` VALUES (41, 6, 1, '在线用户', 'OnlineUser', 'monitor/online/index', 10, 'Steve-Jobs', 'online', b'0', b'0', b'0', NULL, NULL, NULL, '2019-10-26 22:08:43', NULL); -INSERT INTO `sys_menu` VALUES (44, 2, 2, '用户新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'user:add', NULL, NULL, '2019-10-29 10:59:46', NULL); -INSERT INTO `sys_menu` VALUES (45, 2, 2, '用户编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'user:edit', NULL, NULL, '2019-10-29 11:00:08', NULL); -INSERT INTO `sys_menu` VALUES (46, 2, 2, '用户删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'user:del', NULL, NULL, '2019-10-29 11:00:23', NULL); -INSERT INTO `sys_menu` VALUES (48, 3, 2, '角色创建', NULL, '', 2, '', '', b'0', b'0', b'0', 'roles:add', NULL, NULL, '2019-10-29 12:45:34', NULL); -INSERT INTO `sys_menu` VALUES (49, 3, 2, '角色修改', NULL, '', 3, '', '', b'0', b'0', b'0', 'roles:edit', NULL, NULL, '2019-10-29 12:46:16', NULL); -INSERT INTO `sys_menu` VALUES (50, 3, 2, '角色删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'roles:del', NULL, NULL, '2019-10-29 12:46:51', NULL); -INSERT INTO `sys_menu` VALUES (52, 5, 2, '菜单新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'menu:add', NULL, NULL, '2019-10-29 12:55:07', NULL); -INSERT INTO `sys_menu` VALUES (53, 5, 2, '菜单编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'menu:edit', NULL, NULL, '2019-10-29 12:55:40', NULL); -INSERT INTO `sys_menu` VALUES (54, 5, 2, '菜单删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'menu:del', NULL, NULL, '2019-10-29 12:56:00', NULL); -INSERT INTO `sys_menu` VALUES (56, 35, 2, '部门新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dept:add', NULL, NULL, '2019-10-29 12:57:09', NULL); -INSERT INTO `sys_menu` VALUES (57, 35, 2, '部门编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dept:edit', NULL, NULL, '2019-10-29 12:57:27', NULL); -INSERT INTO `sys_menu` VALUES (58, 35, 2, '部门删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dept:del', NULL, NULL, '2019-10-29 12:57:41', NULL); -INSERT INTO `sys_menu` VALUES (60, 37, 2, '岗位新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'job:add', NULL, NULL, '2019-10-29 12:58:27', NULL); -INSERT INTO `sys_menu` VALUES (61, 37, 2, '岗位编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'job:edit', NULL, NULL, '2019-10-29 12:58:45', NULL); -INSERT INTO `sys_menu` VALUES (62, 37, 2, '岗位删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'job:del', NULL, NULL, '2019-10-29 12:59:04', NULL); -INSERT INTO `sys_menu` VALUES (64, 39, 2, '字典新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dict:add', NULL, NULL, '2019-10-29 13:00:17', NULL); -INSERT INTO `sys_menu` VALUES (65, 39, 2, '字典编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dict:edit', NULL, NULL, '2019-10-29 13:00:42', NULL); -INSERT INTO `sys_menu` VALUES (66, 39, 2, '字典删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dict:del', NULL, NULL, '2019-10-29 13:00:59', NULL); -INSERT INTO `sys_menu` VALUES (70, 16, 2, '图片上传', NULL, '', 2, '', '', b'0', b'0', b'0', 'pictures:add', NULL, NULL, '2019-10-29 13:05:34', NULL); -INSERT INTO `sys_menu` VALUES (71, 16, 2, '图片删除', NULL, '', 3, '', '', b'0', b'0', b'0', 'pictures:del', NULL, NULL, '2019-10-29 13:05:52', NULL); -INSERT INTO `sys_menu` VALUES (73, 28, 2, '任务新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'timing:add', NULL, NULL, '2019-10-29 13:07:28', NULL); -INSERT INTO `sys_menu` VALUES (74, 28, 2, '任务编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'timing:edit', NULL, NULL, '2019-10-29 13:07:41', NULL); -INSERT INTO `sys_menu` VALUES (75, 28, 2, '任务删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'timing:del', NULL, NULL, '2019-10-29 13:07:54', NULL); -INSERT INTO `sys_menu` VALUES (77, 18, 2, '上传文件', NULL, '', 2, '', '', b'0', b'0', b'0', 'storage:add', NULL, NULL, '2019-10-29 13:09:09', NULL); -INSERT INTO `sys_menu` VALUES (78, 18, 2, '文件编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'storage:edit', NULL, NULL, '2019-10-29 13:09:22', NULL); -INSERT INTO `sys_menu` VALUES (79, 18, 2, '文件删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'storage:del', NULL, NULL, '2019-10-29 13:09:34', NULL); -INSERT INTO `sys_menu` VALUES (80, 6, 1, '服务监控', 'ServerMonitor', 'monitor/server/index', 14, 'codeConsole', 'server', b'0', b'0', b'0', 'monitor:list', NULL, 'admin', '2019-11-07 13:06:39', '2020-05-04 18:20:50'); -INSERT INTO `sys_menu` VALUES (82, 36, 1, '生成配置', 'GeneratorConfig', 'generator/config', 33, 'dev', 'generator/config/:tableName', b'0', b'1', b'1', '', NULL, NULL, '2019-11-17 20:08:56', NULL); -INSERT INTO `sys_menu` VALUES (83, 10, 1, '图表库', 'Echarts', 'components/Echarts', 50, 'chart', 'echarts', b'0', b'1', b'0', '', NULL, NULL, '2019-11-21 09:04:32', NULL); -INSERT INTO `sys_menu` VALUES (90, NULL, 1, '运维管理', 'Mnt', '', 20, 'mnt', 'mnt', b'0', b'0', b'0', NULL, NULL, NULL, '2019-11-09 10:31:08', NULL); -INSERT INTO `sys_menu` VALUES (92, 90, 1, '服务器', 'ServerDeploy', 'mnt/server/index', 22, 'server', 'mnt/serverDeploy', b'0', b'0', b'0', 'serverDeploy:list', NULL, NULL, '2019-11-10 10:29:25', NULL); -INSERT INTO `sys_menu` VALUES (93, 90, 1, '应用管理', 'App', 'mnt/app/index', 23, 'app', 'mnt/app', b'0', b'0', b'0', 'app:list', NULL, NULL, '2019-11-10 11:05:16', NULL); -INSERT INTO `sys_menu` VALUES (94, 90, 1, '部署管理', 'Deploy', 'mnt/deploy/index', 24, 'deploy', 'mnt/deploy', b'0', b'0', b'0', 'deploy:list', NULL, NULL, '2019-11-10 15:56:55', NULL); -INSERT INTO `sys_menu` VALUES (97, 90, 1, '部署备份', 'DeployHistory', 'mnt/deployHistory/index', 25, 'backup', 'mnt/deployHistory', b'0', b'0', b'0', 'deployHistory:list', NULL, NULL, '2019-11-10 16:49:44', NULL); -INSERT INTO `sys_menu` VALUES (98, 90, 1, '数据库管理', 'Database', 'mnt/database/index', 26, 'database', 'mnt/database', b'0', b'0', b'0', 'database:list', NULL, NULL, '2019-11-10 20:40:04', NULL); -INSERT INTO `sys_menu` VALUES (102, 97, 2, '删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'deployHistory:del', NULL, NULL, '2019-11-17 09:32:48', NULL); -INSERT INTO `sys_menu` VALUES (103, 92, 2, '服务器新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:add', NULL, NULL, '2019-11-17 11:08:33', NULL); -INSERT INTO `sys_menu` VALUES (104, 92, 2, '服务器编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:edit', NULL, NULL, '2019-11-17 11:08:57', NULL); -INSERT INTO `sys_menu` VALUES (105, 92, 2, '服务器删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:del', NULL, NULL, '2019-11-17 11:09:15', NULL); -INSERT INTO `sys_menu` VALUES (106, 93, 2, '应用新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:add', NULL, NULL, '2019-11-17 11:10:03', NULL); -INSERT INTO `sys_menu` VALUES (107, 93, 2, '应用编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:edit', NULL, NULL, '2019-11-17 11:10:28', NULL); -INSERT INTO `sys_menu` VALUES (108, 93, 2, '应用删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:del', NULL, NULL, '2019-11-17 11:10:55', NULL); -INSERT INTO `sys_menu` VALUES (109, 94, 2, '部署新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:add', NULL, NULL, '2019-11-17 11:11:22', NULL); -INSERT INTO `sys_menu` VALUES (110, 94, 2, '部署编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:edit', NULL, NULL, '2019-11-17 11:11:41', NULL); -INSERT INTO `sys_menu` VALUES (111, 94, 2, '部署删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:del', NULL, NULL, '2019-11-17 11:12:01', NULL); -INSERT INTO `sys_menu` VALUES (112, 98, 2, '数据库新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:add', NULL, NULL, '2019-11-17 11:12:43', NULL); -INSERT INTO `sys_menu` VALUES (113, 98, 2, '数据库编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:edit', NULL, NULL, '2019-11-17 11:12:58', NULL); -INSERT INTO `sys_menu` VALUES (114, 98, 2, '数据库删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:del', NULL, NULL, '2019-11-17 11:13:14', NULL); -INSERT INTO `sys_menu` VALUES (116, 36, 1, '生成预览', 'Preview', 'generator/preview', 999, 'java', 'generator/preview/:tableName', b'0', b'1', b'1', NULL, NULL, NULL, '2019-11-26 14:54:36', NULL); +INSERT INTO `sys_menu` VALUES (1, NULL, 7, 0, '系统管理', NULL, NULL, 1, 'system', 'system', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:11:29', NULL); +INSERT INTO `sys_menu` VALUES (2, 1, 3, 1, '用户管理', 'User', 'system/user/index', 2, 'peoples', 'user', b'0', b'0', b'0', 'user:list', NULL, NULL, '2018-12-18 15:14:44', NULL); +INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '角色管理', 'Role', 'system/role/index', 3, 'role', 'role', b'0', b'0', b'0', 'roles:list', NULL, NULL, '2018-12-18 15:16:07', NULL); +INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '菜单管理', 'Menu', 'system/menu/index', 5, 'menu', 'menu', b'0', b'0', b'0', 'menu:list', NULL, NULL, '2018-12-18 15:17:28', NULL); +INSERT INTO `sys_menu` VALUES (6, NULL, 5, 0, '系统监控', NULL, NULL, 10, 'monitor', 'monitor', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:17:48', NULL); +INSERT INTO `sys_menu` VALUES (7, 6, 0, 1, '操作日志', 'Log', 'monitor/log/index', 11, 'log', 'logs', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:18:26', NULL); +INSERT INTO `sys_menu` VALUES (9, 6, 0, 1, 'SQL监控', 'Sql', 'monitor/sql/index', 18, 'sqlMonitor', 'druid', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-18 15:19:34', NULL); +INSERT INTO `sys_menu` VALUES (10, NULL, 5, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:16', NULL); +INSERT INTO `sys_menu` VALUES (11, 10, 0, 1, '图标库', 'Icons', 'components/icons/index', 51, 'icon', 'icon', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-19 13:38:49', NULL); +INSERT INTO `sys_menu` VALUES (14, 36, 0, 1, '邮件工具', 'Email', 'tools/email/index', 35, 'email', 'email', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 10:13:09', NULL); +INSERT INTO `sys_menu` VALUES (15, 10, 0, 1, '富文本', 'Editor', 'components/Editor', 52, 'fwb', 'tinymce', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-27 11:58:25', NULL); +INSERT INTO `sys_menu` VALUES (16, 36, 2, 1, '图床管理', 'Pictures', 'tools/picture/index', 33, 'image', 'pictures', b'0', b'0', b'0', 'pictures:list', NULL, NULL, '2018-12-28 09:36:53', NULL); +INSERT INTO `sys_menu` VALUES (18, 36, 3, 1, '存储管理', 'Storage', 'tools/storage/index', 34, 'qiniu', 'storage', b'0', b'0', b'0', 'storage:list', NULL, NULL, '2018-12-31 11:12:15', NULL); +INSERT INTO `sys_menu` VALUES (19, 36, 0, 1, '支付宝工具', 'AliPay', 'tools/aliPay/index', 37, 'alipay', 'aliPay', b'0', b'0', b'0', NULL, NULL, NULL, '2018-12-31 14:52:38', NULL); +INSERT INTO `sys_menu` VALUES (21, NULL, 2, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'1', NULL, NULL, NULL, '2019-01-04 16:22:03', NULL); +INSERT INTO `sys_menu` VALUES (22, 21, 2, 1, '二级菜单1', NULL, 'nested/menu1/index', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:29', NULL); +INSERT INTO `sys_menu` VALUES (23, 21, 0, 1, '二级菜单2', NULL, 'nested/menu2/index', 999, 'menu', 'menu2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:23:57', NULL); +INSERT INTO `sys_menu` VALUES (24, 22, 0, 1, '三级菜单1', NULL, 'nested/menu1/menu1-1', 999, 'menu', 'menu1-1', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-04 16:24:48', NULL); +INSERT INTO `sys_menu` VALUES (27, 22, 0, 1, '三级菜单2', NULL, 'nested/menu1/menu1-2', 999, 'menu', 'menu1-2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-07 17:27:32', NULL); +INSERT INTO `sys_menu` VALUES (28, 1, 3, 1, '任务调度', 'Timing', 'system/timing/index', 999, 'timing', 'timing', b'0', b'0', b'0', 'timing:list', NULL, NULL, '2019-01-07 20:34:40', NULL); +INSERT INTO `sys_menu` VALUES (30, 36, 0, 1, '代码生成', 'GeneratorIndex', 'generator/index', 32, 'dev', 'generator', b'0', b'1', b'0', NULL, NULL, NULL, '2019-01-11 15:45:55', NULL); +INSERT INTO `sys_menu` VALUES (32, 6, 0, 1, '异常日志', 'ErrorLog', 'monitor/log/errorLog', 12, 'error', 'errorLog', b'0', b'0', b'0', NULL, NULL, NULL, '2019-01-13 13:49:03', NULL); +INSERT INTO `sys_menu` VALUES (33, 10, 0, 1, 'Markdown', 'Markdown', 'components/MarkDown', 53, 'markdown', 'markdown', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 13:46:44', NULL); +INSERT INTO `sys_menu` VALUES (34, 10, 0, 1, 'Yaml编辑器', 'YamlEdit', 'components/YamlEdit', 54, 'dev', 'yaml', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-08 15:49:40', NULL); +INSERT INTO `sys_menu` VALUES (35, 1, 3, 1, '部门管理', 'Dept', 'system/dept/index', 6, 'dept', 'dept', b'0', b'0', b'0', 'dept:list', NULL, NULL, '2019-03-25 09:46:00', NULL); +INSERT INTO `sys_menu` VALUES (36, NULL, 8, 0, '系统工具', NULL, '', 30, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 10:57:35', NULL); +INSERT INTO `sys_menu` VALUES (37, 1, 3, 1, '岗位管理', 'Job', 'system/job/index', 7, 'Steve-Jobs', 'job', b'0', b'0', b'0', 'job:list', NULL, NULL, '2019-03-29 13:51:18', NULL); +INSERT INTO `sys_menu` VALUES (38, 36, 0, 1, '接口文档', 'Swagger', 'tools/swagger/index', 36, 'swagger', 'swagger2', b'0', b'0', b'0', NULL, NULL, NULL, '2019-03-29 19:57:53', NULL); +INSERT INTO `sys_menu` VALUES (39, 1, 3, 1, '字典管理', 'Dict', 'system/dict/index', 8, 'dictionary', 'dict', b'0', b'0', b'0', 'dict:list', NULL, NULL, '2019-04-10 11:49:04', NULL); +INSERT INTO `sys_menu` VALUES (41, 6, 0, 1, '在线用户', 'OnlineUser', 'monitor/online/index', 10, 'Steve-Jobs', 'online', b'0', b'0', b'0', NULL, NULL, NULL, '2019-10-26 22:08:43', NULL); +INSERT INTO `sys_menu` VALUES (44, 2, 0, 2, '用户新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'user:add', NULL, NULL, '2019-10-29 10:59:46', NULL); +INSERT INTO `sys_menu` VALUES (45, 2, 0, 2, '用户编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'user:edit', NULL, NULL, '2019-10-29 11:00:08', NULL); +INSERT INTO `sys_menu` VALUES (46, 2, 0, 2, '用户删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'user:del', NULL, NULL, '2019-10-29 11:00:23', NULL); +INSERT INTO `sys_menu` VALUES (48, 3, 0, 2, '角色创建', NULL, '', 2, '', '', b'0', b'0', b'0', 'roles:add', NULL, NULL, '2019-10-29 12:45:34', NULL); +INSERT INTO `sys_menu` VALUES (49, 3, 0, 2, '角色修改', NULL, '', 3, '', '', b'0', b'0', b'0', 'roles:edit', NULL, NULL, '2019-10-29 12:46:16', NULL); +INSERT INTO `sys_menu` VALUES (50, 3, 0, 2, '角色删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'roles:del', NULL, NULL, '2019-10-29 12:46:51', NULL); +INSERT INTO `sys_menu` VALUES (52, 5, 0, 2, '菜单新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'menu:add', NULL, NULL, '2019-10-29 12:55:07', NULL); +INSERT INTO `sys_menu` VALUES (53, 5, 0, 2, '菜单编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'menu:edit', NULL, NULL, '2019-10-29 12:55:40', NULL); +INSERT INTO `sys_menu` VALUES (54, 5, 0, 2, '菜单删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'menu:del', NULL, NULL, '2019-10-29 12:56:00', NULL); +INSERT INTO `sys_menu` VALUES (56, 35, 0, 2, '部门新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dept:add', NULL, NULL, '2019-10-29 12:57:09', NULL); +INSERT INTO `sys_menu` VALUES (57, 35, 0, 2, '部门编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dept:edit', NULL, NULL, '2019-10-29 12:57:27', NULL); +INSERT INTO `sys_menu` VALUES (58, 35, 0, 2, '部门删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dept:del', NULL, NULL, '2019-10-29 12:57:41', NULL); +INSERT INTO `sys_menu` VALUES (60, 37, 0, 2, '岗位新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'job:add', NULL, NULL, '2019-10-29 12:58:27', NULL); +INSERT INTO `sys_menu` VALUES (61, 37, 0, 2, '岗位编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'job:edit', NULL, NULL, '2019-10-29 12:58:45', NULL); +INSERT INTO `sys_menu` VALUES (62, 37, 0, 2, '岗位删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'job:del', NULL, NULL, '2019-10-29 12:59:04', NULL); +INSERT INTO `sys_menu` VALUES (64, 39, 0, 2, '字典新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dict:add', NULL, NULL, '2019-10-29 13:00:17', NULL); +INSERT INTO `sys_menu` VALUES (65, 39, 0, 2, '字典编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dict:edit', NULL, NULL, '2019-10-29 13:00:42', NULL); +INSERT INTO `sys_menu` VALUES (66, 39, 0, 2, '字典删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dict:del', NULL, NULL, '2019-10-29 13:00:59', NULL); +INSERT INTO `sys_menu` VALUES (70, 16, 0, 2, '图片上传', NULL, '', 2, '', '', b'0', b'0', b'0', 'pictures:add', NULL, NULL, '2019-10-29 13:05:34', NULL); +INSERT INTO `sys_menu` VALUES (71, 16, 0, 2, '图片删除', NULL, '', 3, '', '', b'0', b'0', b'0', 'pictures:del', NULL, NULL, '2019-10-29 13:05:52', NULL); +INSERT INTO `sys_menu` VALUES (73, 28, 0, 2, '任务新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'timing:add', NULL, NULL, '2019-10-29 13:07:28', NULL); +INSERT INTO `sys_menu` VALUES (74, 28, 0, 2, '任务编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'timing:edit', NULL, NULL, '2019-10-29 13:07:41', NULL); +INSERT INTO `sys_menu` VALUES (75, 28, 0, 2, '任务删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'timing:del', NULL, NULL, '2019-10-29 13:07:54', NULL); +INSERT INTO `sys_menu` VALUES (77, 18, 0, 2, '上传文件', NULL, '', 2, '', '', b'0', b'0', b'0', 'storage:add', NULL, NULL, '2019-10-29 13:09:09', NULL); +INSERT INTO `sys_menu` VALUES (78, 18, 0, 2, '文件编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'storage:edit', NULL, NULL, '2019-10-29 13:09:22', NULL); +INSERT INTO `sys_menu` VALUES (79, 18, 0, 2, '文件删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'storage:del', NULL, NULL, '2019-10-29 13:09:34', NULL); +INSERT INTO `sys_menu` VALUES (80, 6, 0, 1, '服务监控', 'ServerMonitor', 'monitor/server/index', 14, 'codeConsole', 'server', b'0', b'0', b'0', 'monitor:list', NULL, 'admin', '2019-11-07 13:06:39', '2020-05-04 18:20:50'); +INSERT INTO `sys_menu` VALUES (82, 36, 0, 1, '生成配置', 'GeneratorConfig', 'generator/config', 33, 'dev', 'generator/config/:tableName', b'0', b'1', b'1', '', NULL, NULL, '2019-11-17 20:08:56', NULL); +INSERT INTO `sys_menu` VALUES (83, 10, 0, 1, '图表库', 'Echarts', 'components/Echarts', 50, 'chart', 'echarts', b'0', b'1', b'0', '', NULL, NULL, '2019-11-21 09:04:32', NULL); +INSERT INTO `sys_menu` VALUES (90, NULL, 5, 1, '运维管理', 'Mnt', '', 20, 'mnt', 'mnt', b'0', b'0', b'0', NULL, NULL, NULL, '2019-11-09 10:31:08', NULL); +INSERT INTO `sys_menu` VALUES (92, 90, 3, 1, '服务器', 'ServerDeploy', 'mnt/server/index', 22, 'server', 'mnt/serverDeploy', b'0', b'0', b'0', 'serverDeploy:list', NULL, NULL, '2019-11-10 10:29:25', NULL); +INSERT INTO `sys_menu` VALUES (93, 90, 3, 1, '应用管理', 'App', 'mnt/app/index', 23, 'app', 'mnt/app', b'0', b'0', b'0', 'app:list', NULL, NULL, '2019-11-10 11:05:16', NULL); +INSERT INTO `sys_menu` VALUES (94, 90, 3, 1, '部署管理', 'Deploy', 'mnt/deploy/index', 24, 'deploy', 'mnt/deploy', b'0', b'0', b'0', 'deploy:list', NULL, NULL, '2019-11-10 15:56:55', NULL); +INSERT INTO `sys_menu` VALUES (97, 90, 1, 1, '部署备份', 'DeployHistory', 'mnt/deployHistory/index', 25, 'backup', 'mnt/deployHistory', b'0', b'0', b'0', 'deployHistory:list', NULL, NULL, '2019-11-10 16:49:44', NULL); +INSERT INTO `sys_menu` VALUES (98, 90, 3, 1, '数据库管理', 'Database', 'mnt/database/index', 26, 'database', 'mnt/database', b'0', b'0', b'0', 'database:list', NULL, NULL, '2019-11-10 20:40:04', NULL); +INSERT INTO `sys_menu` VALUES (102, 97, 0, 2, '删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'deployHistory:del', NULL, NULL, '2019-11-17 09:32:48', NULL); +INSERT INTO `sys_menu` VALUES (103, 92, 0, 2, '服务器新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:add', NULL, NULL, '2019-11-17 11:08:33', NULL); +INSERT INTO `sys_menu` VALUES (104, 92, 0, 2, '服务器编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:edit', NULL, NULL, '2019-11-17 11:08:57', NULL); +INSERT INTO `sys_menu` VALUES (105, 92, 0, 2, '服务器删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:del', NULL, NULL, '2019-11-17 11:09:15', NULL); +INSERT INTO `sys_menu` VALUES (106, 93, 0, 2, '应用新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:add', NULL, NULL, '2019-11-17 11:10:03', NULL); +INSERT INTO `sys_menu` VALUES (107, 93, 0, 2, '应用编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:edit', NULL, NULL, '2019-11-17 11:10:28', NULL); +INSERT INTO `sys_menu` VALUES (108, 93, 0, 2, '应用删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:del', NULL, NULL, '2019-11-17 11:10:55', NULL); +INSERT INTO `sys_menu` VALUES (109, 94, 0, 2, '部署新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:add', NULL, NULL, '2019-11-17 11:11:22', NULL); +INSERT INTO `sys_menu` VALUES (110, 94, 0, 2, '部署编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:edit', NULL, NULL, '2019-11-17 11:11:41', NULL); +INSERT INTO `sys_menu` VALUES (111, 94, 0, 2, '部署删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:del', NULL, NULL, '2019-11-17 11:12:01', NULL); +INSERT INTO `sys_menu` VALUES (112, 98, 0, 2, '数据库新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:add', NULL, NULL, '2019-11-17 11:12:43', NULL); +INSERT INTO `sys_menu` VALUES (113, 98, 0, 2, '数据库编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:edit', NULL, NULL, '2019-11-17 11:12:58', NULL); +INSERT INTO `sys_menu` VALUES (114, 98, 0, 2, '数据库删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:del', NULL, NULL, '2019-11-17 11:13:14', NULL); +INSERT INTO `sys_menu` VALUES (116, 36, 0, 1, '生成预览', 'Preview', 'generator/preview', 999, 'java', 'generator/preview/:tableName', b'0', b'1', b'1', NULL, NULL, NULL, '2019-11-26 14:54:36', NULL); COMMIT; -- ---------------------------- @@ -515,8 +530,8 @@ CREATE TABLE `sys_role` ( -- Records of sys_role -- ---------------------------- BEGIN; -INSERT INTO `sys_role` VALUES (1, '超级管理员', 1, '-', '全部', NULL, 'admin', '2018-11-23 11:04:37', '2020-05-05 11:24:24'); -INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', NULL, 'admin', '2018-11-23 13:09:06', '2020-05-10 12:32:52'); +INSERT INTO `sys_role` VALUES (1, '超级管理员', 1, '-', '全部', NULL, 'admin', '2018-11-23 11:04:37', '2020-05-11 18:34:06'); +INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', NULL, 'admin', '2018-11-23 13:09:06', '2020-05-11 18:28:45'); COMMIT; -- ---------------------------- @@ -569,8 +584,6 @@ INSERT INTO `sys_roles_menus` VALUES (19, 1); INSERT INTO `sys_roles_menus` VALUES (21, 1); INSERT INTO `sys_roles_menus` VALUES (22, 1); INSERT INTO `sys_roles_menus` VALUES (23, 1); -INSERT INTO `sys_roles_menus` VALUES (24, 1); -INSERT INTO `sys_roles_menus` VALUES (27, 1); INSERT INTO `sys_roles_menus` VALUES (28, 1); INSERT INTO `sys_roles_menus` VALUES (30, 1); INSERT INTO `sys_roles_menus` VALUES (32, 1); @@ -582,30 +595,6 @@ INSERT INTO `sys_roles_menus` VALUES (37, 1); INSERT INTO `sys_roles_menus` VALUES (38, 1); INSERT INTO `sys_roles_menus` VALUES (39, 1); INSERT INTO `sys_roles_menus` VALUES (41, 1); -INSERT INTO `sys_roles_menus` VALUES (44, 1); -INSERT INTO `sys_roles_menus` VALUES (45, 1); -INSERT INTO `sys_roles_menus` VALUES (46, 1); -INSERT INTO `sys_roles_menus` VALUES (48, 1); -INSERT INTO `sys_roles_menus` VALUES (49, 1); -INSERT INTO `sys_roles_menus` VALUES (50, 1); -INSERT INTO `sys_roles_menus` VALUES (52, 1); -INSERT INTO `sys_roles_menus` VALUES (53, 1); -INSERT INTO `sys_roles_menus` VALUES (54, 1); -INSERT INTO `sys_roles_menus` VALUES (56, 1); -INSERT INTO `sys_roles_menus` VALUES (57, 1); -INSERT INTO `sys_roles_menus` VALUES (58, 1); -INSERT INTO `sys_roles_menus` VALUES (60, 1); -INSERT INTO `sys_roles_menus` VALUES (61, 1); -INSERT INTO `sys_roles_menus` VALUES (62, 1); -INSERT INTO `sys_roles_menus` VALUES (64, 1); -INSERT INTO `sys_roles_menus` VALUES (65, 1); -INSERT INTO `sys_roles_menus` VALUES (66, 1); -INSERT INTO `sys_roles_menus` VALUES (73, 1); -INSERT INTO `sys_roles_menus` VALUES (74, 1); -INSERT INTO `sys_roles_menus` VALUES (75, 1); -INSERT INTO `sys_roles_menus` VALUES (77, 1); -INSERT INTO `sys_roles_menus` VALUES (78, 1); -INSERT INTO `sys_roles_menus` VALUES (79, 1); INSERT INTO `sys_roles_menus` VALUES (80, 1); INSERT INTO `sys_roles_menus` VALUES (82, 1); INSERT INTO `sys_roles_menus` VALUES (83, 1); @@ -620,21 +609,9 @@ INSERT INTO `sys_roles_menus` VALUES (1, 2); INSERT INTO `sys_roles_menus` VALUES (2, 2); INSERT INTO `sys_roles_menus` VALUES (3, 2); INSERT INTO `sys_roles_menus` VALUES (5, 2); -INSERT INTO `sys_roles_menus` VALUES (6, 2); INSERT INTO `sys_roles_menus` VALUES (10, 2); -INSERT INTO `sys_roles_menus` VALUES (14, 2); -INSERT INTO `sys_roles_menus` VALUES (18, 2); -INSERT INTO `sys_roles_menus` VALUES (19, 2); INSERT INTO `sys_roles_menus` VALUES (21, 2); -INSERT INTO `sys_roles_menus` VALUES (23, 2); -INSERT INTO `sys_roles_menus` VALUES (28, 2); -INSERT INTO `sys_roles_menus` VALUES (30, 2); -INSERT INTO `sys_roles_menus` VALUES (35, 2); INSERT INTO `sys_roles_menus` VALUES (36, 2); -INSERT INTO `sys_roles_menus` VALUES (37, 2); -INSERT INTO `sys_roles_menus` VALUES (38, 2); -INSERT INTO `sys_roles_menus` VALUES (39, 2); -INSERT INTO `sys_roles_menus` VALUES (44, 2); COMMIT; -- ---------------------------- @@ -772,7 +749,7 @@ CREATE TABLE `tool_local_storage` ( `create_time` datetime DEFAULT NULL COMMENT '创建日期', `update_time` datetime DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`storage_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='本地存储'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='本地存储'; -- ---------------------------- -- Records of tool_local_storage diff --git a/sql/sys_ 相关表字段调整.sql b/sql/sys_ 相关表字段调整.sql index 682538c8..be8bfccf 100644 --- a/sql/sys_ 相关表字段调整.sql +++ b/sql/sys_ 相关表字段调整.sql @@ -43,11 +43,13 @@ alter table sys_menu CHANGE component_name name VARCHAR(255) COMMENT '组件名 alter table sys_menu CHANGE sort menu_sort INT(5) COMMENT '排序'; /* pid 允许为空 */ alter table sys_menu modify pid BIGINT(20) null; +/* 加入子节点数量字段 */ +alter table sys_menu add sub_count INT(5) DEFAULT 0 COMMENT '子菜单数目'; /* 加入通用字段 */ alter table sys_menu add update_by VARCHAR(255) COMMENT '更新者'; alter table sys_menu add create_by VARCHAR(255) COMMENT '创建者'; alter table sys_menu add update_time datetime COMMENT '更新时间'; --- sys_menu end -- +-- sys_menu end -- -- sys_job 表改动 start -- /* id 改为 menu_id */ @@ -62,13 +64,15 @@ alter table sys_job add update_by VARCHAR(255) COMMENT '更新者'; alter table sys_job add update_time datetime COMMENT '更新时间'; -- sys_job end -- --- sys_dept 表改动 start-- +-- sys_dept 表改动 start-- /* id 改为 menu_id */ alter table sys_dept CHANGE id dept_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID'; /* pid 允许为空 */ alter table sys_dept modify pid BIGINT(20) null; /* 加入排序字段 */ alter table sys_dept add dept_sort int(5) DEFAULT 999 COMMENT '排序'; +/* 加入子节点数量字段 */ +alter table sys_dept add sub_count INT(5) DEFAULT 0 COMMENT '子部门数目'; /* 加入通用字段 */ alter table sys_dept add create_by VARCHAR(255) COMMENT '创建者'; alter table sys_dept add update_by VARCHAR(255) COMMENT '更新者'; diff --git a/sql/相关数据更新.sql b/sql/相关数据更新.sql index 9ec31c2b..292e7321 100644 --- a/sql/相关数据更新.sql +++ b/sql/相关数据更新.sql @@ -1,4 +1,17 @@ /** 将admin改为管理员 */ update sys_user set is_admin = 1 WHERE user_id = 1 UPDATE sys_dept SET pid = NULL WHERE pid = 0; -UPDATE sys_menu SET pid = NULL WHERE pid = 0; \ No newline at end of file +UPDATE sys_menu SET pid = NULL WHERE pid = 0; +-- 创建零时表并复制数据 -- +create table sys_menu_tmp select * from sys_menu; +create table sys_dept_tmp select * from sys_dept; +-- 更新 sub_count -- +UPDATE sys_menu s set s.sub_count = ( + SELECT COUNT(1) FROM sys_menu_tmp tmp WHERE tmp.pid = s.menu_id +); +UPDATE sys_dept d set d.sub_count = ( + SELECT COUNT(1) FROM sys_dept_tmp tmp WHERE tmp.pid = d.dept_id +); +-- 删除零时表 -- +DROP TABLE sys_menu_tmp; +DROP TABLE sys_dept_tmp; \ No newline at end of file