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