Commit 90a4a80a authored by ZhengJie's avatar ZhengJie
Browse files

[代码完善](v2.5): v2.5 beta 菜单部门优化,其他杂项优化

菜单和部门表加入 sub_count 字段,记录子节点数目,树形表格懒加载使用。
脚本同步更新

2.5 Beta 详情:https://www.ydyno.com/archives/1225.html
parent 48570fcb
...@@ -23,8 +23,6 @@ import me.zhengjie.modules.system.service.RoleService; ...@@ -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.RoleSmallDto;
import me.zhengjie.modules.system.service.dto.UserDto; import me.zhengjie.modules.system.service.dto.UserDto;
import me.zhengjie.utils.enums.DataScopeEnum; import me.zhengjie.utils.enums.DataScopeEnum;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
...@@ -36,14 +34,12 @@ import java.util.*; ...@@ -36,14 +34,12 @@ import java.util.*;
**/ **/
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "role")
public class DataServiceImpl implements DataService { public class DataServiceImpl implements DataService {
private final RoleService roleService; private final RoleService roleService;
private final DeptService deptService; private final DeptService deptService;
@Override @Override
@Cacheable
public List<Long> getDeptIds(UserDto user) { public List<Long> getDeptIds(UserDto user) {
// 用于存储部门id // 用于存储部门id
Set<Long> deptIds = new HashSet<>(); Set<Long> deptIds = new HashSet<>();
...@@ -90,7 +86,6 @@ public class DataServiceImpl implements DataService { ...@@ -90,7 +86,6 @@ public class DataServiceImpl implements DataService {
* @return 数据权限 * @return 数据权限
*/ */
@Override @Override
@Cacheable
public List<Long> getDeptChildren(List<Dept> deptList) { public List<Long> getDeptChildren(List<Dept> deptList) {
List<Long> list = new ArrayList<>(); List<Long> list = new ArrayList<>();
deptList.forEach(dept -> { deptList.forEach(dept -> {
......
...@@ -28,9 +28,6 @@ import me.zhengjie.utils.ValidationUtil; ...@@ -28,9 +28,6 @@ import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.modules.system.repository.DeptRepository; import me.zhengjie.modules.system.repository.DeptRepository;
import me.zhengjie.modules.system.service.DeptService; import me.zhengjie.modules.system.service.DeptService;
import me.zhengjie.modules.system.service.mapstruct.DeptMapper; 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.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -47,7 +44,6 @@ import java.util.stream.Collectors; ...@@ -47,7 +44,6 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "dept")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DeptServiceImpl implements DeptService { public class DeptServiceImpl implements DeptService {
...@@ -55,7 +51,6 @@ public class DeptServiceImpl implements DeptService { ...@@ -55,7 +51,6 @@ public class DeptServiceImpl implements DeptService {
private final DeptMapper deptMapper; private final DeptMapper deptMapper;
@Override @Override
@Cacheable
public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception { public List<DeptDto> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
Sort sort = new Sort(Sort.Direction.ASC, "deptSort"); Sort sort = new Sort(Sort.Direction.ASC, "deptSort");
if (isQuery) { if (isQuery) {
...@@ -79,7 +74,6 @@ public class DeptServiceImpl implements DeptService { ...@@ -79,7 +74,6 @@ public class DeptServiceImpl implements DeptService {
} }
@Override @Override
@Cacheable(key = "#p0")
public DeptDto findById(Long id) { public DeptDto findById(Long id) {
Dept dept = deptRepository.findById(id).orElseGet(Dept::new); Dept dept = deptRepository.findById(id).orElseGet(Dept::new);
ValidationUtil.isNull(dept.getId(),"Dept","id",id); ValidationUtil.isNull(dept.getId(),"Dept","id",id);
...@@ -87,7 +81,6 @@ public class DeptServiceImpl implements DeptService { ...@@ -87,7 +81,6 @@ public class DeptServiceImpl implements DeptService {
} }
@Override @Override
@Cacheable
public List<Dept> findByPid(long pid) { public List<Dept> findByPid(long pid) {
return deptRepository.findByPid(pid); return deptRepository.findByPid(pid);
} }
...@@ -98,16 +91,21 @@ public class DeptServiceImpl implements DeptService { ...@@ -98,16 +91,21 @@ public class DeptServiceImpl implements DeptService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DeptDto create(Dept resources) { public void create(Dept resources) {
return deptMapper.toDto(deptRepository.save(resources)); deptRepository.save(resources);
// 计算子节点数目
resources.setSubCount(0);
if(resources.getPid() != null){
updateSubCnt(resources.getPid());
}
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(Dept resources) { public void update(Dept resources) {
// 旧的菜单
DeptDto old = findById(resources.getId());
if(resources.getPid() != null && resources.getId().equals(resources.getPid())) { if(resources.getPid() != null && resources.getId().equals(resources.getPid())) {
throw new BadRequestException("上级不能为自己"); throw new BadRequestException("上级不能为自己");
} }
...@@ -115,14 +113,21 @@ public class DeptServiceImpl implements DeptService { ...@@ -115,14 +113,21 @@ public class DeptServiceImpl implements DeptService {
ValidationUtil.isNull( dept.getId(),"Dept","id",resources.getId()); ValidationUtil.isNull( dept.getId(),"Dept","id",resources.getId());
resources.setId(dept.getId()); resources.setId(dept.getId());
deptRepository.save(resources); deptRepository.save(resources);
if(resources.getPid() == null){
updateSubCnt(old.getPid());
} else {
updateSubCnt(resources.getPid());
}
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<DeptDto> deptDtos) { public void delete(Set<DeptDto> deptDtos) {
for (DeptDto deptDto : deptDtos) { for (DeptDto deptDto : deptDtos) {
deptRepository.deleteById(deptDto.getId()); deptRepository.deleteById(deptDto.getId());
if(deptDto.getPid() != null){
updateSubCnt(deptDto.getPid());
}
} }
} }
...@@ -199,4 +204,9 @@ public class DeptServiceImpl implements DeptService { ...@@ -199,4 +204,9 @@ public class DeptServiceImpl implements DeptService {
map.put("content",CollectionUtil.isEmpty(trees)? deptDtos :trees); map.put("content",CollectionUtil.isEmpty(trees)? deptDtos :trees);
return map; return map;
} }
private void updateSubCnt(Long deptId){
int count = deptRepository.countByPid(deptId);
deptRepository.updateSubCntById(count, deptId);
}
} }
\ No newline at end of file
...@@ -25,9 +25,6 @@ import me.zhengjie.modules.system.repository.DictDetailRepository; ...@@ -25,9 +25,6 @@ import me.zhengjie.modules.system.repository.DictDetailRepository;
import me.zhengjie.modules.system.service.DictDetailService; import me.zhengjie.modules.system.service.DictDetailService;
import me.zhengjie.modules.system.service.dto.DictDetailDto; import me.zhengjie.modules.system.service.dto.DictDetailDto;
import me.zhengjie.modules.system.service.mapstruct.DictDetailMapper; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -41,7 +38,6 @@ import java.util.Map; ...@@ -41,7 +38,6 @@ import java.util.Map;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "dictDetail")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DictDetailServiceImpl implements DictDetailService { public class DictDetailServiceImpl implements DictDetailService {
...@@ -49,14 +45,12 @@ public class DictDetailServiceImpl implements DictDetailService { ...@@ -49,14 +45,12 @@ public class DictDetailServiceImpl implements DictDetailService {
private final DictDetailMapper dictDetailMapper; private final DictDetailMapper dictDetailMapper;
@Override @Override
@Cacheable
public Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) { public Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
Page<DictDetail> page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page<DictDetail> page = dictDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(dictDetailMapper::toDto)); return PageUtil.toPage(page.map(dictDetailMapper::toDto));
} }
@Override @Override
@Cacheable(key = "#p0")
public DictDetailDto findById(Long id) { public DictDetailDto findById(Long id) {
DictDetail dictDetail = dictDetailRepository.findById(id).orElseGet(DictDetail::new); DictDetail dictDetail = dictDetailRepository.findById(id).orElseGet(DictDetail::new);
ValidationUtil.isNull(dictDetail.getId(),"DictDetail","id",id); ValidationUtil.isNull(dictDetail.getId(),"DictDetail","id",id);
...@@ -64,14 +58,12 @@ public class DictDetailServiceImpl implements DictDetailService { ...@@ -64,14 +58,12 @@ public class DictDetailServiceImpl implements DictDetailService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DictDetailDto create(DictDetail resources) { public void create(DictDetail resources) {
return dictDetailMapper.toDto(dictDetailRepository.save(resources)); dictDetailRepository.save(resources);
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(DictDetail resources) { public void update(DictDetail resources) {
DictDetail dictDetail = dictDetailRepository.findById(resources.getId()).orElseGet(DictDetail::new); DictDetail dictDetail = dictDetailRepository.findById(resources.getId()).orElseGet(DictDetail::new);
...@@ -81,7 +73,6 @@ public class DictDetailServiceImpl implements DictDetailService { ...@@ -81,7 +73,6 @@ public class DictDetailServiceImpl implements DictDetailService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Long id) { public void delete(Long id) {
dictDetailRepository.deleteById(id); dictDetailRepository.deleteById(id);
......
...@@ -20,17 +20,11 @@ import lombok.RequiredArgsConstructor; ...@@ -20,17 +20,11 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.modules.system.domain.Dict; import me.zhengjie.modules.system.domain.Dict;
import me.zhengjie.modules.system.service.dto.DictDetailDto; import me.zhengjie.modules.system.service.dto.DictDetailDto;
import me.zhengjie.modules.system.service.dto.DictQueryCriteria; import me.zhengjie.modules.system.service.dto.DictQueryCriteria;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.*;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.modules.system.repository.DictRepository; import me.zhengjie.modules.system.repository.DictRepository;
import me.zhengjie.modules.system.service.DictService; import me.zhengjie.modules.system.service.DictService;
import me.zhengjie.modules.system.service.dto.DictDto; import me.zhengjie.modules.system.service.dto.DictDto;
import me.zhengjie.modules.system.service.mapstruct.DictMapper; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,15 +40,14 @@ import java.util.*; ...@@ -46,15 +40,14 @@ import java.util.*;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "dict")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class DictServiceImpl implements DictService { public class DictServiceImpl implements DictService {
private final DictRepository dictRepository; private final DictRepository dictRepository;
private final DictMapper dictMapper; private final DictMapper dictMapper;
private final RedisUtils redisUtils;
@Override @Override
@Cacheable
public Map<String, Object> queryAll(DictQueryCriteria dict, Pageable pageable){ public Map<String, Object> queryAll(DictQueryCriteria dict, Pageable pageable){
Page<Dict> page = dictRepository.findAll((root, query, cb) -> QueryHelp.getPredicate(root, dict, cb), pageable); Page<Dict> page = dictRepository.findAll((root, query, cb) -> QueryHelp.getPredicate(root, dict, cb), pageable);
return PageUtil.toPage(page.map(dictMapper::toDto)); return PageUtil.toPage(page.map(dictMapper::toDto));
...@@ -67,7 +60,6 @@ public class DictServiceImpl implements DictService { ...@@ -67,7 +60,6 @@ public class DictServiceImpl implements DictService {
} }
@Override @Override
@Cacheable(key = "#p0")
public DictDto findById(Long id) { public DictDto findById(Long id) {
Dict dict = dictRepository.findById(id).orElseGet(Dict::new); Dict dict = dictRepository.findById(id).orElseGet(Dict::new);
ValidationUtil.isNull(dict.getId(),"Dict","id",id); ValidationUtil.isNull(dict.getId(),"Dict","id",id);
...@@ -75,14 +67,12 @@ public class DictServiceImpl implements DictService { ...@@ -75,14 +67,12 @@ public class DictServiceImpl implements DictService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public DictDto create(Dict resources) { public void create(Dict resources) {
return dictMapper.toDto(dictRepository.save(resources)); dictRepository.save(resources);
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(Dict resources) { public void update(Dict resources) {
Dict dict = dictRepository.findById(resources.getId()).orElseGet(Dict::new); Dict dict = dictRepository.findById(resources.getId()).orElseGet(Dict::new);
...@@ -92,12 +82,10 @@ public class DictServiceImpl implements DictService { ...@@ -92,12 +82,10 @@ public class DictServiceImpl implements DictService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<Long> ids) { public void delete(Set<Long> ids) {
for (Long id : ids) { dictRepository.deleteByIdIn(ids);
dictRepository.deleteById(id); redisUtils.delByKeys("dict::", ids);
}
} }
@Override @Override
......
...@@ -19,17 +19,11 @@ import lombok.RequiredArgsConstructor; ...@@ -19,17 +19,11 @@ import lombok.RequiredArgsConstructor;
import me.zhengjie.exception.EntityExistException; import me.zhengjie.exception.EntityExistException;
import me.zhengjie.modules.system.domain.Job; import me.zhengjie.modules.system.domain.Job;
import me.zhengjie.modules.system.service.dto.JobQueryCriteria; import me.zhengjie.modules.system.service.dto.JobQueryCriteria;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.*;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.modules.system.repository.JobRepository; import me.zhengjie.modules.system.repository.JobRepository;
import me.zhengjie.modules.system.service.JobService; import me.zhengjie.modules.system.service.JobService;
import me.zhengjie.modules.system.service.dto.JobDto; import me.zhengjie.modules.system.service.dto.JobDto;
import me.zhengjie.modules.system.service.mapstruct.JobMapper; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,29 +39,26 @@ import java.util.*; ...@@ -45,29 +39,26 @@ import java.util.*;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "job")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class JobServiceImpl implements JobService { public class JobServiceImpl implements JobService {
private final JobRepository jobRepository; private final JobRepository jobRepository;
private final JobMapper jobMapper; private final JobMapper jobMapper;
private final RedisUtils redisUtils;
@Override @Override
@Cacheable
public Map<String,Object> queryAll(JobQueryCriteria criteria, Pageable pageable) { public Map<String,Object> queryAll(JobQueryCriteria criteria, Pageable pageable) {
Page<Job> page = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page<Job> page = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(jobMapper::toDto).getContent(),page.getTotalElements()); return PageUtil.toPage(page.map(jobMapper::toDto).getContent(),page.getTotalElements());
} }
@Override @Override
@Cacheable
public List<JobDto> queryAll(JobQueryCriteria criteria) { public List<JobDto> queryAll(JobQueryCriteria criteria) {
List<Job> list = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); List<Job> list = jobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
return jobMapper.toDto(list); return jobMapper.toDto(list);
} }
@Override @Override
@Cacheable(key = "#p0")
public JobDto findById(Long id) { public JobDto findById(Long id) {
Job job = jobRepository.findById(id).orElseGet(Job::new); Job job = jobRepository.findById(id).orElseGet(Job::new);
ValidationUtil.isNull(job.getId(),"Job","id",id); ValidationUtil.isNull(job.getId(),"Job","id",id);
...@@ -75,18 +66,16 @@ public class JobServiceImpl implements JobService { ...@@ -75,18 +66,16 @@ public class JobServiceImpl implements JobService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public JobDto create(Job resources) { public void create(Job resources) {
Job job = jobRepository.findByName(resources.getName()); Job job = jobRepository.findByName(resources.getName());
if(job != null){ if(job != null){
throw new EntityExistException(Job.class,"name",resources.getName()); throw new EntityExistException(Job.class,"name",resources.getName());
} }
return jobMapper.toDto(jobRepository.save(resources)); jobRepository.save(resources);
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(Job resources) { public void update(Job resources) {
Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new); Job job = jobRepository.findById(resources.getId()).orElseGet(Job::new);
...@@ -100,11 +89,12 @@ public class JobServiceImpl implements JobService { ...@@ -100,11 +89,12 @@ public class JobServiceImpl implements JobService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<Long> ids) { public void delete(Set<Long> ids) {
for (Long id : ids) { for (Long id : ids) {
jobRepository.deleteById(id); jobRepository.deleteById(id);
// 删除缓存
redisUtils.del("job::"+id);
} }
} }
......
...@@ -34,9 +34,6 @@ import me.zhengjie.utils.FileUtil; ...@@ -34,9 +34,6 @@ import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.QueryHelp; import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.StringUtils; import me.zhengjie.utils.StringUtils;
import me.zhengjie.utils.ValidationUtil; 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.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -52,7 +49,6 @@ import java.util.stream.Collectors; ...@@ -52,7 +49,6 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "menu")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class MenuServiceImpl implements MenuService { public class MenuServiceImpl implements MenuService {
...@@ -61,7 +57,6 @@ public class MenuServiceImpl implements MenuService { ...@@ -61,7 +57,6 @@ public class MenuServiceImpl implements MenuService {
private final RoleService roleService; private final RoleService roleService;
@Override @Override
@Cacheable
public List<MenuDto> queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception { public List<MenuDto> queryAll(MenuQueryCriteria criteria, Boolean isQuery) throws Exception {
Sort sort = new Sort(Sort.Direction.ASC, "menuSort"); Sort sort = new Sort(Sort.Direction.ASC, "menuSort");
if(isQuery){ if(isQuery){
...@@ -84,7 +79,6 @@ public class MenuServiceImpl implements MenuService { ...@@ -84,7 +79,6 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@Cacheable(key = "#p0")
public MenuDto findById(long id) { public MenuDto findById(long id) {
Menu menu = menuRepository.findById(id).orElseGet(Menu::new); Menu menu = menuRepository.findById(id).orElseGet(Menu::new);
ValidationUtil.isNull(menu.getId(),"Menu","id",id); ValidationUtil.isNull(menu.getId(),"Menu","id",id);
...@@ -92,7 +86,6 @@ public class MenuServiceImpl implements MenuService { ...@@ -92,7 +86,6 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@Cacheable
public List<MenuDto> findByRoles(List<RoleSmallDto> roles) { public List<MenuDto> findByRoles(List<RoleSmallDto> roles) {
Set<Long> roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet()); Set<Long> roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet());
LinkedHashSet<Menu> menus = menuRepository.findByRoles_IdInAndTypeNotOrderByMenuSortAsc(roleIds, 2); LinkedHashSet<Menu> menus = menuRepository.findByRoles_IdInAndTypeNotOrderByMenuSortAsc(roleIds, 2);
...@@ -100,8 +93,8 @@ public class MenuServiceImpl implements MenuService { ...@@ -100,8 +93,8 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class)
public MenuDto create(Menu resources) { public void create(Menu resources) {
if(menuRepository.findByTitle(resources.getTitle()) != null){ if(menuRepository.findByTitle(resources.getTitle()) != null){
throw new EntityExistException(Menu.class,"title",resources.getTitle()); throw new EntityExistException(Menu.class,"title",resources.getTitle());
} }
...@@ -119,16 +112,23 @@ public class MenuServiceImpl implements MenuService { ...@@ -119,16 +112,23 @@ public class MenuServiceImpl implements MenuService {
throw new BadRequestException("外链必须以http://或者https://开头"); 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 @Override
@CacheEvict(allEntries = true) @Transactional(rollbackFor = Exception.class)
public void update(Menu resources) { public void update(Menu resources) {
if(resources.getId().equals(resources.getPid())) { if(resources.getId().equals(resources.getPid())) {
throw new BadRequestException("上级不能为自己"); throw new BadRequestException("上级不能为自己");
} }
Menu menu = menuRepository.findById(resources.getId()).orElseGet(Menu::new); Menu menu = menuRepository.findById(resources.getId()).orElseGet(Menu::new);
// 记录旧的父节点ID
Long oldPid = menu.getPid();
ValidationUtil.isNull(menu.getId(),"Permission","id",resources.getId()); ValidationUtil.isNull(menu.getId(),"Permission","id",resources.getId());
if(resources.getIFrame()){ if(resources.getIFrame()){
...@@ -165,6 +165,12 @@ public class MenuServiceImpl implements MenuService { ...@@ -165,6 +165,12 @@ public class MenuServiceImpl implements MenuService {
menu.setPermission(resources.getPermission()); menu.setPermission(resources.getPermission());
menu.setType(resources.getType()); menu.setType(resources.getType());
menuRepository.save(menu); menuRepository.save(menu);
// 计算子节点数目
if(resources.getPid() == null){
updateSubCnt(oldPid);
} else {
updateSubCnt(resources.getPid());
}
} }
@Override @Override
...@@ -181,17 +187,18 @@ public class MenuServiceImpl implements MenuService { ...@@ -181,17 +187,18 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<Menu> menuSet) { public void delete(Set<Menu> menuSet) {
for (Menu menu : menuSet) { for (Menu menu : menuSet) {
roleService.untiedMenu(menu.getId()); roleService.untiedMenu(menu.getId());
menuRepository.deleteById(menu.getId()); menuRepository.deleteById(menu.getId());
if(menu.getPid() != null){
updateSubCnt(menu.getPid());
}
} }
} }
@Override @Override
@Cacheable
public Object getMenus(Long pid) { public Object getMenus(Long pid) {
List<Menu> menus; List<Menu> menus;
if(pid != null && !pid.equals(0L)){ if(pid != null && !pid.equals(0L)){
...@@ -203,7 +210,6 @@ public class MenuServiceImpl implements MenuService { ...@@ -203,7 +210,6 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@Cacheable
public List<MenuDto> getSuperior(MenuDto menuDto, List<Menu> menus) { public List<MenuDto> getSuperior(MenuDto menuDto, List<Menu> menus) {
if(menuDto.getPid() == null){ if(menuDto.getPid() == null){
menus.addAll(menuRepository.findByPidIsNull()); menus.addAll(menuRepository.findByPidIsNull());
...@@ -214,7 +220,6 @@ public class MenuServiceImpl implements MenuService { ...@@ -214,7 +220,6 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@Cacheable(key = "'pid:'+#p0")
public List<Menu> findByPid(long pid) { public List<Menu> findByPid(long pid) {
return menuRepository.findByPid(pid); return menuRepository.findByPid(pid);
} }
...@@ -294,7 +299,6 @@ public class MenuServiceImpl implements MenuService { ...@@ -294,7 +299,6 @@ public class MenuServiceImpl implements MenuService {
} }
@Override @Override
@Cacheable
public Menu findOne(Long id) { public Menu findOne(Long id) {
Menu menu = menuRepository.findById(id).orElseGet(Menu::new); Menu menu = menuRepository.findById(id).orElseGet(Menu::new);
ValidationUtil.isNull(menu.getId(),"Menu","id",id); ValidationUtil.isNull(menu.getId(),"Menu","id",id);
...@@ -317,4 +321,9 @@ public class MenuServiceImpl implements MenuService { ...@@ -317,4 +321,9 @@ public class MenuServiceImpl implements MenuService {
} }
FileUtil.downloadExcel(list, response); FileUtil.downloadExcel(list, response);
} }
private void updateSubCnt(Long menuId){
int count = menuRepository.countByPid(menuId);
menuRepository.updateSubCntById(count, menuId);
}
} }
...@@ -32,11 +32,9 @@ import me.zhengjie.modules.system.service.mapstruct.RoleMapper; ...@@ -32,11 +32,9 @@ import me.zhengjie.modules.system.service.mapstruct.RoleMapper;
import me.zhengjie.modules.system.service.mapstruct.RoleSmallMapper; import me.zhengjie.modules.system.service.mapstruct.RoleSmallMapper;
import me.zhengjie.utils.*; import me.zhengjie.utils.*;
import me.zhengjie.utils.enums.DataScopeEnum; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -53,7 +51,6 @@ import java.util.stream.Collectors; ...@@ -53,7 +51,6 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "role")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class RoleServiceImpl implements RoleService { public class RoleServiceImpl implements RoleService {
...@@ -61,28 +58,26 @@ public class RoleServiceImpl implements RoleService { ...@@ -61,28 +58,26 @@ public class RoleServiceImpl implements RoleService {
private final RoleMapper roleMapper; private final RoleMapper roleMapper;
private final RoleSmallMapper roleSmallMapper; private final RoleSmallMapper roleSmallMapper;
private final DeptRepository deptRepository; private final DeptRepository deptRepository;
private final RedisUtils redisUtils;
@Override @Override
@Cacheable public List<RoleDto> queryAll() {
public Object queryAll(Pageable pageable) { Sort sort = new Sort(Sort.Direction.ASC, "level");
return roleMapper.toDto(roleRepository.findAll(pageable).getContent()); return roleMapper.toDto(roleRepository.findAll(sort));
} }
@Override @Override
@Cacheable
public List<RoleDto> queryAll(RoleQueryCriteria criteria) { public List<RoleDto> queryAll(RoleQueryCriteria criteria) {
return roleMapper.toDto(roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); return roleMapper.toDto(roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
} }
@Override @Override
@Cacheable
public Object queryAll(RoleQueryCriteria criteria, Pageable pageable) { public Object queryAll(RoleQueryCriteria criteria, Pageable pageable) {
Page<Role> page = roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page<Role> page = roleRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(roleMapper::toDto)); return PageUtil.toPage(page.map(roleMapper::toDto));
} }
@Override @Override
@Cacheable(key = "#p0")
public RoleDto findById(long id) { public RoleDto findById(long id) {
Role role = roleRepository.findById(id).orElseGet(Role::new); Role role = roleRepository.findById(id).orElseGet(Role::new);
ValidationUtil.isNull(role.getId(),"Role","id",id); ValidationUtil.isNull(role.getId(),"Role","id",id);
...@@ -90,18 +85,16 @@ public class RoleServiceImpl implements RoleService { ...@@ -90,18 +85,16 @@ public class RoleServiceImpl implements RoleService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public RoleDto create(Role resources) { public void create(Role resources) {
if(roleRepository.findByName(resources.getName()) != null){ if(roleRepository.findByName(resources.getName()) != null){
throw new EntityExistException(Role.class,"username",resources.getName()); throw new EntityExistException(Role.class,"username",resources.getName());
} }
checkDataScope(resources); checkDataScope(resources);
return roleMapper.toDto(roleRepository.save(resources)); roleRepository.save(resources);
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(Role resources) { public void update(Role resources) {
Role role = roleRepository.findById(resources.getId()).orElseGet(Role::new); Role role = roleRepository.findById(resources.getId()).orElseGet(Role::new);
...@@ -135,7 +128,6 @@ public class RoleServiceImpl implements RoleService { ...@@ -135,7 +128,6 @@ public class RoleServiceImpl implements RoleService {
} }
@Override @Override
@CacheEvict(allEntries = true)
public void updateMenu(Role resources, RoleDto roleDTO) { public void updateMenu(Role resources, RoleDto roleDTO) {
Role role = roleMapper.toEntity(roleDTO); Role role = roleMapper.toEntity(roleDTO);
role.setMenus(resources.getMenus()); role.setMenus(resources.getMenus());
...@@ -143,29 +135,27 @@ public class RoleServiceImpl implements RoleService { ...@@ -143,29 +135,27 @@ public class RoleServiceImpl implements RoleService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void untiedMenu(Long id) { public void untiedMenu(Long id) {
roleRepository.untiedMenu(id); roleRepository.untiedMenu(id);
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<Long> ids) { public void delete(Set<Long> ids) {
for (Long id : ids) { for (Long id : ids) {
roleRepository.deleteById(id); roleRepository.deleteById(id);
// 删除缓存
redisUtils.del("role::"+id);
} }
} }
@Override @Override
@Cacheable(key = "'findByUsers_Id:' + #p0")
public List<RoleSmallDto> findByUsersId(Long id) { public List<RoleSmallDto> findByUsersId(Long id) {
return roleSmallMapper.toDto(new ArrayList<>(roleRepository.findByUsers_Id(id))); return roleSmallMapper.toDto(new ArrayList<>(roleRepository.findByUsers_Id(id)));
} }
@Override @Override
@Cacheable
public Integer findByRoles(Set<Role> roles) { public Integer findByRoles(Set<Role> roles) {
Set<RoleDto> roleDtos = new HashSet<>(); Set<RoleDto> roleDtos = new HashSet<>();
for (Role role : roles) { for (Role role : roles) {
...@@ -175,7 +165,6 @@ public class RoleServiceImpl implements RoleService { ...@@ -175,7 +165,6 @@ public class RoleServiceImpl implements RoleService {
} }
@Override @Override
@Cacheable(key = "'loadPermissionByUser:' + #p0.username")
public List<GrantedAuthority> mapToGrantedAuthorities(UserDto user) { public List<GrantedAuthority> mapToGrantedAuthorities(UserDto user) {
Set<String> permissions = new HashSet<>(); Set<String> permissions = new HashSet<>();
// 如果是管理员直接返回 // 如果是管理员直接返回
......
...@@ -28,9 +28,6 @@ import me.zhengjie.modules.system.service.dto.UserDto; ...@@ -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.dto.UserQueryCriteria;
import me.zhengjie.modules.system.service.mapstruct.UserMapper; import me.zhengjie.modules.system.service.mapstruct.UserMapper;
import me.zhengjie.utils.*; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -49,7 +46,6 @@ import java.util.stream.Collectors; ...@@ -49,7 +46,6 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@CacheConfig(cacheNames = "user")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {
...@@ -59,21 +55,18 @@ public class UserServiceImpl implements UserService { ...@@ -59,21 +55,18 @@ public class UserServiceImpl implements UserService {
private final FileProperties properties; private final FileProperties properties;
@Override @Override
@Cacheable
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) { public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
Page<User> page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page<User> page = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(userMapper::toDto)); return PageUtil.toPage(page.map(userMapper::toDto));
} }
@Override @Override
@Cacheable
public List<UserDto> queryAll(UserQueryCriteria criteria) { public List<UserDto> queryAll(UserQueryCriteria criteria) {
List<User> users = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); List<User> users = userRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder));
return userMapper.toDto(users); return userMapper.toDto(users);
} }
@Override @Override
@Cacheable(key = "#p0")
public UserDto findById(long id) { public UserDto findById(long id) {
User user = userRepository.findById(id).orElseGet(User::new); User user = userRepository.findById(id).orElseGet(User::new);
ValidationUtil.isNull(user.getId(),"User","id",id); ValidationUtil.isNull(user.getId(),"User","id",id);
...@@ -81,20 +74,18 @@ public class UserServiceImpl implements UserService { ...@@ -81,20 +74,18 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public UserDto create(User resources) { public void create(User resources) {
if(userRepository.findByUsername(resources.getUsername())!=null){ if(userRepository.findByUsername(resources.getUsername())!=null){
throw new EntityExistException(User.class,"username",resources.getUsername()); throw new EntityExistException(User.class,"username",resources.getUsername());
} }
if(userRepository.findByEmail(resources.getEmail())!=null){ if(userRepository.findByEmail(resources.getEmail())!=null){
throw new EntityExistException(User.class,"email",resources.getEmail()); throw new EntityExistException(User.class,"email",resources.getEmail());
} }
return userMapper.toDto(userRepository.save(resources)); userRepository.save(resources);
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(User resources) { public void update(User resources) {
User user = userRepository.findById(resources.getId()).orElseGet(User::new); User user = userRepository.findById(resources.getId()).orElseGet(User::new);
...@@ -112,9 +103,9 @@ public class UserServiceImpl implements UserService { ...@@ -112,9 +103,9 @@ public class UserServiceImpl implements UserService {
// 如果用户的角色改变了,需要手动清理下缓存 // 如果用户的角色改变了,需要手动清理下缓存
if (!resources.getRoles().equals(user.getRoles())) { if (!resources.getRoles().equals(user.getRoles())) {
String key = "role::loadPermissionByUser:" + user.getUsername(); String key = "role::permission:" + user.getUsername();
redisUtils.del(key); redisUtils.del(key);
key = "role::findByUsers_Id:" + user.getId(); key = "role::user:" + user.getId();
redisUtils.del(key); redisUtils.del(key);
} }
...@@ -131,7 +122,6 @@ public class UserServiceImpl implements UserService { ...@@ -131,7 +122,6 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateCenter(User resources) { public void updateCenter(User resources) {
User user = userRepository.findById(resources.getId()).orElseGet(User::new); User user = userRepository.findById(resources.getId()).orElseGet(User::new);
...@@ -142,7 +132,6 @@ public class UserServiceImpl implements UserService { ...@@ -142,7 +132,6 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Set<Long> ids) { public void delete(Set<Long> ids) {
for (Long id : ids) { for (Long id : ids) {
...@@ -151,7 +140,6 @@ public class UserServiceImpl implements UserService { ...@@ -151,7 +140,6 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@Cacheable(key = "'loadUserByUsername:'+#p0")
public UserDto findByName(String userName) { public UserDto findByName(String userName) {
User user; User user;
if(ValidationUtil.isEmail(userName)){ if(ValidationUtil.isEmail(userName)){
...@@ -167,14 +155,12 @@ public class UserServiceImpl implements UserService { ...@@ -167,14 +155,12 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updatePass(String username, String pass) { public void updatePass(String username, String pass) {
userRepository.updatePass(username,pass,new Date()); userRepository.updatePass(username,pass,new Date());
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateAvatar(MultipartFile multipartFile) { public void updateAvatar(MultipartFile multipartFile) {
User user = userRepository.findByUsername(SecurityUtils.getCurrentUsername()); User user = userRepository.findByUsername(SecurityUtils.getCurrentUsername());
...@@ -189,7 +175,6 @@ public class UserServiceImpl implements UserService { ...@@ -189,7 +175,6 @@ public class UserServiceImpl implements UserService {
} }
@Override @Override
@CacheEvict(allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateEmail(String username, String email) { public void updateEmail(String username, String email) {
userRepository.updateEmail(username,email); userRepository.updateEmail(username,email);
......
...@@ -17,12 +17,8 @@ package me.zhengjie.modules.system.service.mapstruct; ...@@ -17,12 +17,8 @@ package me.zhengjie.modules.system.service.mapstruct;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.system.domain.Dept; 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.modules.system.service.dto.DeptDto;
import me.zhengjie.utils.SpringContextHolder;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;
/** /**
...@@ -31,20 +27,4 @@ import org.mapstruct.ReportingPolicy; ...@@ -31,20 +27,4 @@ import org.mapstruct.ReportingPolicy;
*/ */
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface DeptMapper extends BaseMapper<DeptDto, Dept> { public interface DeptMapper extends BaseMapper<DeptDto, Dept> {
/**
* 转换后的特殊处理
* @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
...@@ -17,12 +17,8 @@ package me.zhengjie.modules.system.service.mapstruct; ...@@ -17,12 +17,8 @@ package me.zhengjie.modules.system.service.mapstruct;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
import me.zhengjie.modules.system.domain.Menu; 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.modules.system.service.dto.MenuDto;
import me.zhengjie.utils.SpringContextHolder;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy; import org.mapstruct.ReportingPolicy;
/** /**
...@@ -31,19 +27,4 @@ import org.mapstruct.ReportingPolicy; ...@@ -31,19 +27,4 @@ import org.mapstruct.ReportingPolicy;
*/ */
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) @Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface MenuMapper extends BaseMapper<MenuDto, Menu> { public interface MenuMapper extends BaseMapper<MenuDto, Menu> {
/**
* 转换
* @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;
}
} }
...@@ -63,7 +63,8 @@ public class LocalStorageController { ...@@ -63,7 +63,8 @@ public class LocalStorageController {
@PostMapping @PostMapping
@PreAuthorize("@el.check('storage:add')") @PreAuthorize("@el.check('storage:add')")
public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file){ public ResponseEntity<Object> 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("修改文件") @ApiOperation("修改文件")
......
...@@ -56,9 +56,8 @@ public interface LocalStorageService { ...@@ -56,9 +56,8 @@ public interface LocalStorageService {
* 上传 * 上传
* @param name 文件名称 * @param name 文件名称
* @param file 文件 * @param file 文件
* @return /
*/ */
LocalStorageDto create(String name, MultipartFile file); void create(String name, MultipartFile file);
/** /**
* 编辑 * 编辑
......
...@@ -73,7 +73,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { ...@@ -73,7 +73,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public LocalStorageDto create(String name, MultipartFile multipartFile) { public void create(String name, MultipartFile multipartFile) {
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize()); FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename()); String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
String type = FileUtil.getFileType(suffix); String type = FileUtil.getFileType(suffix);
...@@ -91,7 +91,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { ...@@ -91,7 +91,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
type, type,
FileUtil.getSize(multipartFile.getSize()) FileUtil.getSize(multipartFile.getSize())
); );
return localStorageMapper.toDto(localStorageRepository.save(localStorage)); localStorageRepository.save(localStorage);
}catch (Exception e){ }catch (Exception e){
FileUtil.del(file); FileUtil.del(file);
throw e; throw e;
......
...@@ -67,7 +67,6 @@ public class QiNiuServiceImpl implements QiNiuService { ...@@ -67,7 +67,6 @@ public class QiNiuServiceImpl implements QiNiuService {
private Long maxSize; private Long maxSize;
@Override @Override
@Cacheable
public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){ public Object queryAll(QiniuQueryCriteria criteria, Pageable pageable){
return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); return PageUtil.toPage(qiniuContentRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
} }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
Target Server Version : 50710 Target Server Version : 50710
File Encoding : 65001 File Encoding : 65001
Date: 10/05/2020 20:31:38 Date: 14/05/2020 13:28:14
*/ */
SET NAMES utf8mb4; SET NAMES utf8mb4;
...@@ -57,7 +57,7 @@ CREATE TABLE `code_gen_config` ( ...@@ -57,7 +57,7 @@ CREATE TABLE `code_gen_config` (
`api_alias` varchar(255) DEFAULT NULL COMMENT '接口名称', `api_alias` varchar(255) DEFAULT NULL COMMENT '接口名称',
PRIMARY KEY (`config_id`) USING BTREE, PRIMARY KEY (`config_id`) USING BTREE,
KEY `idx_table_name` (`table_name`(100)) 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 -- Table structure for mnt_app
...@@ -185,6 +185,13 @@ CREATE TABLE `mnt_server` ( ...@@ -185,6 +185,13 @@ CREATE TABLE `mnt_server` (
KEY `idx_ip` (`ip`) KEY `idx_ip` (`ip`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='服务器管理'; ) 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 -- Table structure for sys_dept
-- ---------------------------- -- ----------------------------
...@@ -192,6 +199,7 @@ DROP TABLE IF EXISTS `sys_dept`; ...@@ -192,6 +199,7 @@ DROP TABLE IF EXISTS `sys_dept`;
CREATE TABLE `sys_dept` ( CREATE TABLE `sys_dept` (
`dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', `dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`pid` bigint(20) DEFAULT NULL COMMENT '上级部门', `pid` bigint(20) DEFAULT NULL COMMENT '上级部门',
`sub_count` int(5) DEFAULT '0' COMMENT '子部门数目',
`name` varchar(255) NOT NULL COMMENT '名称', `name` varchar(255) NOT NULL COMMENT '名称',
`dept_sort` int(5) DEFAULT '999' COMMENT '排序', `dept_sort` int(5) DEFAULT '999' COMMENT '排序',
`enabled` bit(1) NOT NULL COMMENT '状态', `enabled` bit(1) NOT NULL COMMENT '状态',
...@@ -202,18 +210,18 @@ CREATE TABLE `sys_dept` ( ...@@ -202,18 +210,18 @@ CREATE TABLE `sys_dept` (
PRIMARY KEY (`dept_id`) USING BTREE, PRIMARY KEY (`dept_id`) USING BTREE,
KEY `inx_pid` (`pid`), KEY `inx_pid` (`pid`),
KEY `inx_enabled` (`enabled`) 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 -- Records of sys_dept
-- ---------------------------- -- ----------------------------
BEGIN; 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 (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, '运维部', 4, b'1', NULL, NULL, '2019-03-25 09:20:44', NULL); 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, '测试部', 6, b'1', NULL, NULL, '2019-03-25 09:52:18', 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, '华南分部', 0, b'1', NULL, 'admin', '2019-03-25 11:04:50', '2020-05-10 19:59:12'); 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, '华北分部', 1, b'1', NULL, 'admin', '2019-03-25 11:04:53', '2020-05-10 19:59:20'); 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 (11, 8, '人事部', 5, b'1', NULL, 'admin', '2019-03-25 11:07:58', '2020-05-10 17:40:06'); 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; COMMIT;
-- ---------------------------- -- ----------------------------
...@@ -318,7 +326,13 @@ CREATE TABLE `sys_log` ( ...@@ -318,7 +326,13 @@ CREATE TABLE `sys_log` (
PRIMARY KEY (`log_id`) USING BTREE, PRIMARY KEY (`log_id`) USING BTREE,
KEY `log_create_time_index` (`create_time`), KEY `log_create_time_index` (`create_time`),
KEY `inx_log_type` (`log_type`) 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 -- Table structure for sys_menu
...@@ -327,6 +341,7 @@ DROP TABLE IF EXISTS `sys_menu`; ...@@ -327,6 +341,7 @@ DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` ( CREATE TABLE `sys_menu` (
`menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID', `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID', `pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID',
`sub_count` int(5) DEFAULT '0' COMMENT '子菜单数目',
`type` int(11) DEFAULT NULL COMMENT '菜单类型', `type` int(11) DEFAULT NULL COMMENT '菜单类型',
`title` varchar(255) DEFAULT NULL COMMENT '菜单标题', `title` varchar(255) DEFAULT NULL COMMENT '菜单标题',
`name` varchar(255) DEFAULT NULL COMMENT '组件名称', `name` varchar(255) DEFAULT NULL COMMENT '组件名称',
...@@ -346,91 +361,91 @@ CREATE TABLE `sys_menu` ( ...@@ -346,91 +361,91 @@ CREATE TABLE `sys_menu` (
UNIQUE KEY `uniq_title` (`title`), UNIQUE KEY `uniq_title` (`title`),
UNIQUE KEY `uniq_name` (`name`), UNIQUE KEY `uniq_name` (`name`),
KEY `inx_pid` (`pid`) 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 -- Records of sys_menu
-- ---------------------------- -- ----------------------------
BEGIN; 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, '部署备份', '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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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, 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 (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; COMMIT;
-- ---------------------------- -- ----------------------------
...@@ -515,8 +530,8 @@ CREATE TABLE `sys_role` ( ...@@ -515,8 +530,8 @@ CREATE TABLE `sys_role` (
-- Records of sys_role -- Records of sys_role
-- ---------------------------- -- ----------------------------
BEGIN; 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 (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-10 12:32:52'); INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', NULL, 'admin', '2018-11-23 13:09:06', '2020-05-11 18:28:45');
COMMIT; COMMIT;
-- ---------------------------- -- ----------------------------
...@@ -569,8 +584,6 @@ INSERT INTO `sys_roles_menus` VALUES (19, 1); ...@@ -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 (21, 1);
INSERT INTO `sys_roles_menus` VALUES (22, 1); INSERT INTO `sys_roles_menus` VALUES (22, 1);
INSERT INTO `sys_roles_menus` VALUES (23, 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 (28, 1);
INSERT INTO `sys_roles_menus` VALUES (30, 1); INSERT INTO `sys_roles_menus` VALUES (30, 1);
INSERT INTO `sys_roles_menus` VALUES (32, 1); INSERT INTO `sys_roles_menus` VALUES (32, 1);
...@@ -582,30 +595,6 @@ INSERT INTO `sys_roles_menus` VALUES (37, 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 (38, 1);
INSERT INTO `sys_roles_menus` VALUES (39, 1); INSERT INTO `sys_roles_menus` VALUES (39, 1);
INSERT INTO `sys_roles_menus` VALUES (41, 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 (80, 1);
INSERT INTO `sys_roles_menus` VALUES (82, 1); INSERT INTO `sys_roles_menus` VALUES (82, 1);
INSERT INTO `sys_roles_menus` VALUES (83, 1); INSERT INTO `sys_roles_menus` VALUES (83, 1);
...@@ -620,21 +609,9 @@ INSERT INTO `sys_roles_menus` VALUES (1, 2); ...@@ -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 (2, 2);
INSERT INTO `sys_roles_menus` VALUES (3, 2); INSERT INTO `sys_roles_menus` VALUES (3, 2);
INSERT INTO `sys_roles_menus` VALUES (5, 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 (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 (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 (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; COMMIT;
-- ---------------------------- -- ----------------------------
...@@ -772,7 +749,7 @@ CREATE TABLE `tool_local_storage` ( ...@@ -772,7 +749,7 @@ CREATE TABLE `tool_local_storage` (
`create_time` datetime DEFAULT NULL COMMENT '创建日期', `create_time` datetime DEFAULT NULL COMMENT '创建日期',
`update_time` datetime DEFAULT NULL COMMENT '更新时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`storage_id`) USING BTREE 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 -- Records of tool_local_storage
......
...@@ -43,11 +43,13 @@ alter table sys_menu CHANGE component_name name VARCHAR(255) COMMENT '组件名 ...@@ -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 '排序'; alter table sys_menu CHANGE sort menu_sort INT(5) COMMENT '排序';
/* pid 允许为空 */ /* pid 允许为空 */
alter table sys_menu modify pid BIGINT(20) null; 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 update_by VARCHAR(255) COMMENT '更新者';
alter table sys_menu add create_by VARCHAR(255) COMMENT '创建者'; alter table sys_menu add create_by VARCHAR(255) COMMENT '创建者';
alter table sys_menu add update_time datetime COMMENT '更新时间'; alter table sys_menu add update_time datetime COMMENT '更新时间';
-- sys_menu end -- -- sys_menu end --
-- sys_job 表改动 start -- -- sys_job 表改动 start --
/* id 改为 menu_id */ /* id 改为 menu_id */
...@@ -62,13 +64,15 @@ alter table sys_job add update_by VARCHAR(255) COMMENT '更新者'; ...@@ -62,13 +64,15 @@ alter table sys_job add update_by VARCHAR(255) COMMENT '更新者';
alter table sys_job add update_time datetime COMMENT '更新时间'; alter table sys_job add update_time datetime COMMENT '更新时间';
-- sys_job end -- -- sys_job end --
-- sys_dept 表改动 start-- -- sys_dept 表改动 start--
/* id 改为 menu_id */ /* id 改为 menu_id */
alter table sys_dept CHANGE id dept_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID'; alter table sys_dept CHANGE id dept_id BIGINT(20) AUTO_INCREMENT COMMENT 'ID';
/* pid 允许为空 */ /* pid 允许为空 */
alter table sys_dept modify pid BIGINT(20) null; 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 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 create_by VARCHAR(255) COMMENT '创建者';
alter table sys_dept add update_by VARCHAR(255) COMMENT '更新者'; alter table sys_dept add update_by VARCHAR(255) COMMENT '更新者';
......
/** 将admin改为管理员 */ /** 将admin改为管理员 */
update sys_user set is_admin = 1 WHERE user_id = 1 update sys_user set is_admin = 1 WHERE user_id = 1
UPDATE sys_dept SET pid = NULL WHERE pid = 0; UPDATE sys_dept SET pid = NULL WHERE pid = 0;
UPDATE sys_menu SET pid = NULL WHERE pid = 0; UPDATE sys_menu SET pid = NULL WHERE pid = 0;
\ No newline at end of file -- 创建零时表并复制数据 --
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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment