refactor:重构
parent
f152e95010
commit
b9e5fff02d
|
@ -16,4 +16,12 @@ public interface ISysUserRoleData extends ICommonData<SysUserRole, Long> {
|
|||
* @return 数量
|
||||
*/
|
||||
int deleteByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
long countUserRoleByRoleId(Long roleId);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@
|
|||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.biyanwen</groupId>
|
||||
<artifactId>jpa-comment-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cc.iotkit</groupId>
|
||||
<artifactId>iot-common-core</artifactId>
|
||||
|
|
|
@ -197,9 +197,8 @@ public class SysMenuDataImpl implements ISysMenuData {
|
|||
|
||||
@Override
|
||||
public boolean hasChildByMenuId(Long menuId) {
|
||||
TbSysMenu tbSysMenu = jpaQueryFactory.select(QTbSysMenu.tbSysMenu).from(QTbSysMenu.tbSysMenu).where(PredicateBuilder.instance()
|
||||
.and(QTbSysMenu.tbSysMenu.parentId.eq(menuId))
|
||||
.build()).fetchOne();
|
||||
TbSysMenu tbSysMenu = jpaQueryFactory.select(QTbSysMenu.tbSysMenu).from(QTbSysMenu.tbSysMenu)
|
||||
.where(QTbSysMenu.tbSysMenu.parentId.eq(menuId)).fetchOne();
|
||||
return Objects.nonNull(tbSysMenu);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import cc.iotkit.data.dao.SysUserRoleRepository;
|
|||
import cc.iotkit.data.system.ISysUserRoleData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import static cc.iotkit.data.model.QTbSysUserRole.tbSysUserRole;
|
||||
|
||||
/**
|
||||
* @Author:tfd
|
||||
* @Date:2023/5/30 16:36
|
||||
|
@ -16,4 +18,9 @@ public class SysUserRoleDataImpl implements ISysUserRoleData {
|
|||
public int deleteByUserId(Long userId) {
|
||||
return sysUserRoleRepository.deleteAllByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countUserRoleByRoleId(Long roleId) {
|
||||
return sysUserRoleRepository.count(tbSysUserRole.roleId.eq(roleId));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue