Java Code Examples for org.jeecg.modules.system.entity.SysPermission#setDelFlag()

The following examples show how to use org.jeecg.modules.system.entity.SysPermission#setDelFlag() . 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-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 3
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 4
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 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
@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 7
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 8
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);
}