Java Code Examples for org.jeecg.common.constant.CacheConstant#SYS_DATA_PERMISSIONS_CACHE

The following examples show how to use org.jeecg.common.constant.CacheConstant#SYS_DATA_PERMISSIONS_CACHE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysPermissionServiceImpl.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
  * 逻辑删除
 */
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
//@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true,condition="#sysPermission.menuType==2")
public void deletePermissionLogical(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
	if(count==1) {
		//若父节点无其他子节点,则该父节点是叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 1);
	}
	sysPermission.setDelFlag(1);
	this.updateById(sysPermission);
}
 
Example 2
Source File: SysPermissionServiceImpl.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void addPermission(SysPermission sysPermission) throws JeecgBootException {
	//----------------------------------------------------------------------
	//判断是否是一级菜单,是的话清空父菜单
	if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
		sysPermission.setParentId(null);
	}
	//----------------------------------------------------------------------
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		//设置父节点不为叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 0);
	}
	sysPermission.setCreateTime(new Date());
	sysPermission.setDelFlag(0);
	sysPermission.setLeaf(true);
	this.save(sysPermission);
}
 
Example 3
Source File: SysPermissionServiceImpl.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
  * 逻辑删除
 */
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
//@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true,condition="#sysPermission.menuType==2")
public void deletePermissionLogical(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
	if(count==1) {
		//若父节点无其他子节点,则该父节点是叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 1);
	}
	sysPermission.setDelFlag(1);
	this.updateById(sysPermission);
}
 
Example 4
Source File: SysPermissionServiceImpl.java    From teaching with Apache License 2.0 6 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void addPermission(SysPermission sysPermission) throws JeecgBootException {
	//----------------------------------------------------------------------
	//判断是否是一级菜单,是的话清空父菜单
	if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
		sysPermission.setParentId(null);
	}
	//----------------------------------------------------------------------
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		//设置父节点不为叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 0);
	}
	sysPermission.setCreateTime(new Date());
	sysPermission.setDelFlag(0);
	sysPermission.setLeaf(true);
	this.save(sysPermission);
}
 
Example 5
Source File: SysPermissionServiceImpl.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
  * 逻辑删除
 */
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
//@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true,condition="#sysPermission.menuType==2")
public void deletePermissionLogical(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
	if(count==1) {
		//若父节点无其他子节点,则该父节点是叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 1);
	}
	sysPermission.setDelFlag(1);
	this.updateById(sysPermission);
}
 
Example 6
Source File: SysPermissionServiceImpl.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
  * 真实删除
 */
@Override
@Transactional
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void deletePermission(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
		if(count==1) {
			//若父节点无其他子节点,则该父节点是叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 1);
		}
	}
	sysPermissionMapper.deleteById(id);
	// 该节点可能是子节点但也可能是其它节点的父节点,所以需要级联删除
	this.removeChildrenBy(sysPermission.getId());
}
 
Example 7
Source File: SysPermissionServiceImpl.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void addPermission(SysPermission sysPermission) throws JeecgBootException {
	//----------------------------------------------------------------------
	//判断是否是一级菜单,是的话清空父菜单
	if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
		sysPermission.setParentId(null);
	}
	//----------------------------------------------------------------------
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		//设置父节点不为叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 0);
	}
	sysPermission.setCreateTime(new Date());
	sysPermission.setDelFlag(0);
	sysPermission.setLeaf(true);
	this.save(sysPermission);
}
 
Example 8
Source File: SysPermissionServiceImpl.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
  * 逻辑删除
 */
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
//@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true,condition="#sysPermission.menuType==2")
public void deletePermissionLogical(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
	if(count==1) {
		//若父节点无其他子节点,则该父节点是叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 1);
	}
	sysPermission.setDelFlag(1);
	this.updateById(sysPermission);
}
 
Example 9
Source File: SysPermissionServiceImpl.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
  * 真实删除
 */
@Override
@Transactional
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void deletePermission(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
		if(count==1) {
			//若父节点无其他子节点,则该父节点是叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 1);
		}
	}
	sysPermissionMapper.deleteById(id);
	// 该节点可能是子节点但也可能是其它节点的父节点,所以需要级联删除
	this.removeChildrenBy(sysPermission.getId());
}
 
Example 10
Source File: SysPermissionServiceImpl.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void addPermission(SysPermission sysPermission) throws JeecgBootException {
	//----------------------------------------------------------------------
	//判断是否是一级菜单,是的话清空父菜单
	if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
		sysPermission.setParentId(null);
	}
	//----------------------------------------------------------------------
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		//设置父节点不为叶子节点
		this.sysPermissionMapper.setMenuLeaf(pid, 0);
	}
	sysPermission.setCreateTime(new Date());
	sysPermission.setDelFlag(0);
	sysPermission.setLeaf(true);
	this.save(sysPermission);
}
 
Example 11
Source File: SysPermissionServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void editPermission(SysPermission sysPermission) throws JeecgBootException {
	SysPermission p = this.getById(sysPermission.getId());
	//TODO 该节点判断是否还有子节点
	if(p==null) {
		throw new JeecgBootException("未找到菜单信息");
	}else {
		sysPermission.setUpdateTime(new Date());
		//----------------------------------------------------------------------
		//Step1.判断是否是一级菜单,是的话清空父菜单ID
		if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
			sysPermission.setParentId("");
		}
		//Step2.判断菜单下级是否有菜单,无则设置为叶子节点
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId()));
		if(count==0) {
			sysPermission.setLeaf(true);
		}
		//----------------------------------------------------------------------
		this.updateById(sysPermission);
		
		//如果当前菜单的父菜单变了,则需要修改新父菜单和老父菜单的,叶子节点状态
		String pid = sysPermission.getParentId();
		if((oConvertUtils.isNotEmpty(pid) && !pid.equals(p.getParentId())) || oConvertUtils.isEmpty(pid)&&oConvertUtils.isNotEmpty(p.getParentId())) {
			//a.设置新的父菜单不为叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 0);
			//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
			int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
			if(cc==0) {
				if(oConvertUtils.isNotEmpty(p.getParentId())) {
					this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
				}
			}
			
		}
	}
	
}
 
Example 12
Source File: SysPermissionServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void editPermission(SysPermission sysPermission) throws JeecgBootException {
	SysPermission p = this.getById(sysPermission.getId());
	//TODO 该节点判断是否还有子节点
	if(p==null) {
		throw new JeecgBootException("未找到菜单信息");
	}else {
		sysPermission.setUpdateTime(new Date());
		//----------------------------------------------------------------------
		//Step1.判断是否是一级菜单,是的话清空父菜单ID
		if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
			sysPermission.setParentId("");
		}
		//Step2.判断菜单下级是否有菜单,无则设置为叶子节点
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId()));
		if(count==0) {
			sysPermission.setLeaf(true);
		}
		//----------------------------------------------------------------------
		this.updateById(sysPermission);
		
		//如果当前菜单的父菜单变了,则需要修改新父菜单和老父菜单的,叶子节点状态
		String pid = sysPermission.getParentId();
		if((oConvertUtils.isNotEmpty(pid) && !pid.equals(p.getParentId())) || oConvertUtils.isEmpty(pid)&&oConvertUtils.isNotEmpty(p.getParentId())) {
			//a.设置新的父菜单不为叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 0);
			//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
			int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
			if(cc==0) {
				if(oConvertUtils.isNotEmpty(p.getParentId())) {
					this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
				}
			}
			
		}
	}
	
}
 
Example 13
Source File: SysPermissionServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void editPermission(SysPermission sysPermission) throws JeecgBootException {
	SysPermission p = this.getById(sysPermission.getId());
	//TODO 该节点判断是否还有子节点
	if(p==null) {
		throw new JeecgBootException("未找到菜单信息");
	}else {
		sysPermission.setUpdateTime(new Date());
		//----------------------------------------------------------------------
		//Step1.判断是否是一级菜单,是的话清空父菜单ID
		if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
			sysPermission.setParentId("");
		}
		//Step2.判断菜单下级是否有菜单,无则设置为叶子节点
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId()));
		if(count==0) {
			sysPermission.setLeaf(true);
		}
		//----------------------------------------------------------------------
		this.updateById(sysPermission);
		
		//如果当前菜单的父菜单变了,则需要修改新父菜单和老父菜单的,叶子节点状态
		String pid = sysPermission.getParentId();
		if((oConvertUtils.isNotEmpty(pid) && !pid.equals(p.getParentId())) || oConvertUtils.isEmpty(pid)&&oConvertUtils.isNotEmpty(p.getParentId())) {
			//a.设置新的父菜单不为叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 0);
			//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
			int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
			if(cc==0) {
				if(oConvertUtils.isNotEmpty(p.getParentId())) {
					this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
				}
			}
			
		}
	}
	
}
 
Example 14
Source File: SysPermissionServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
/**
  * 真实删除
 */
@Override
@Transactional
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void deletePermission(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
		if(count==1) {
			//若父节点无其他子节点,则该父节点是叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 1);
		}
	}
	sysPermissionMapper.deleteById(id);
	// 该节点可能是子节点但也可能是其它节点的父节点,所以需要级联删除
	this.removeChildrenBy(sysPermission.getId());
	//关联删除
	Map map = new HashMap<>();
	map.put("permission_id",id);
	//删除数据规则
	this.deletePermRuleByPermId(id);
	//删除角色授权表
	sysRolePermissionMapper.deleteByMap(map);
	//删除部门权限表
	sysDepartPermissionMapper.deleteByMap(map);
	//删除部门角色授权
	sysDepartRolePermissionMapper.deleteByMap(map);
}
 
Example 15
Source File: SysPermissionServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
/**
  * 真实删除
 */
@Override
@Transactional
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void deletePermission(String id) throws JeecgBootException {
	SysPermission sysPermission = this.getById(id);
	if(sysPermission==null) {
		throw new JeecgBootException("未找到菜单信息");
	}
	String pid = sysPermission.getParentId();
	if(oConvertUtils.isNotEmpty(pid)) {
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
		if(count==1) {
			//若父节点无其他子节点,则该父节点是叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 1);
		}
	}
	sysPermissionMapper.deleteById(id);
	// 该节点可能是子节点但也可能是其它节点的父节点,所以需要级联删除
	this.removeChildrenBy(sysPermission.getId());
	//关联删除
	Map map = new HashMap<>();
	map.put("permission_id",id);
	//删除数据规则
	this.deletePermRuleByPermId(id);
	//删除角色授权表
	sysRolePermissionMapper.deleteByMap(map);
	//删除部门权限表
	sysDepartPermissionMapper.deleteByMap(map);
	//删除部门角色授权
	sysDepartRolePermissionMapper.deleteByMap(map);
}
 
Example 16
Source File: SysPermissionServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
@CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
public void editPermission(SysPermission sysPermission) throws JeecgBootException {
	SysPermission p = this.getById(sysPermission.getId());
	//TODO 该节点判断是否还有子节点
	if(p==null) {
		throw new JeecgBootException("未找到菜单信息");
	}else {
		sysPermission.setUpdateTime(new Date());
		//----------------------------------------------------------------------
		//Step1.判断是否是一级菜单,是的话清空父菜单ID
		if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
			sysPermission.setParentId("");
		}
		//Step2.判断菜单下级是否有菜单,无则设置为叶子节点
		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId()));
		if(count==0) {
			sysPermission.setLeaf(true);
		}
		//----------------------------------------------------------------------
		this.updateById(sysPermission);
		
		//如果当前菜单的父菜单变了,则需要修改新父菜单和老父菜单的,叶子节点状态
		String pid = sysPermission.getParentId();
		if((oConvertUtils.isNotEmpty(pid) && !pid.equals(p.getParentId())) || oConvertUtils.isEmpty(pid)&&oConvertUtils.isNotEmpty(p.getParentId())) {
			//a.设置新的父菜单不为叶子节点
			this.sysPermissionMapper.setMenuLeaf(pid, 0);
			//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
			int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
			if(cc==0) {
				if(oConvertUtils.isNotEmpty(p.getParentId())) {
					this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
				}
			}
			
		}
	}
	
}
 
Example 17
Source File: SysPermissionServiceImpl.java    From jeecg-boot-with-activiti with MIT License 4 votes vote down vote up
/**
  *   获取模糊匹配规则的数据权限URL
 */
@Override
@Cacheable(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE)
public List<String> queryPermissionUrlWithStar() {
	return this.baseMapper.queryPermissionUrlWithStar();
}
 
Example 18
Source File: SysPermissionServiceImpl.java    From jeecg-cloud with Apache License 2.0 4 votes vote down vote up
/**
  *   获取模糊匹配规则的数据权限URL
 */
@Override
@Cacheable(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE)
public List<String> queryPermissionUrlWithStar() {
	return this.baseMapper.queryPermissionUrlWithStar();
}
 
Example 19
Source File: SysPermissionServiceImpl.java    From teaching with Apache License 2.0 4 votes vote down vote up
/**
  *   获取模糊匹配规则的数据权限URL
 */
@Override
@Cacheable(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE)
public List<String> queryPermissionUrlWithStar() {
	return this.baseMapper.queryPermissionUrlWithStar();
}
 
Example 20
Source File: SysPermissionServiceImpl.java    From jeecg-boot with Apache License 2.0 4 votes vote down vote up
/**
  *   获取模糊匹配规则的数据权限URL
 */
@Override
@Cacheable(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE)
public List<String> queryPermissionUrlWithStar() {
	return this.baseMapper.queryPermissionUrlWithStar();
}