refactor:重构

V0.5.x
荭琪枫 2023-05-31 18:32:08 +08:00
parent f152e95010
commit b9e5fff02d
4 changed files with 21 additions and 3 deletions

View File

@ -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);
}

View File

@ -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>

View File

@ -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);
}

View File

@ -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;
/**
* @Authortfd
* @Date2023/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));
}
}