Merge branch 'master' of https://github.com/YunaiV/ruoyi-vue-pro into feature/tenant_op

 Conflicts:
	yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
This commit is contained in:
YunaiV 2022-02-27 02:13:06 +08:00
commit fc509837a1
13 changed files with 16 additions and 15 deletions

View File

@ -47,12 +47,12 @@ public interface BaseMapperX<T> extends BaseMapper<T> {
return selectCount(new QueryWrapper<T>());
}
default Integer selectCount(String field, Object value) {
return selectCount(new QueryWrapper<T>().eq(field, value)).intValue();
default Long selectCount(String field, Object value) {
return selectCount(new QueryWrapper<T>().eq(field, value));
}
default Integer selectCount(SFunction<T, ?> field, Object value) {
return selectCount(new LambdaQueryWrapper<T>().eq(field, value)).intValue();
default Long selectCount(SFunction<T, ?> field, Object value) {
return selectCount(new LambdaQueryWrapper<T>().eq(field, value));
}
default List<T> selectList() {

View File

@ -23,7 +23,7 @@ public interface FileMapper extends BaseMapperX<FileDO> {
.orderByDesc("create_time"));
}
default Integer selectCountById(String id) {
default Long selectCountById(String id) {
return selectCount(FileDO::getId, id);
}

View File

@ -24,7 +24,7 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
.eq(DeptDO::getName, name));
}
default Integer selectCountByParentId(Long parentId) {
default Long selectCountByParentId(Long parentId) {
return selectCount(DeptDO::getParentId, parentId);
}

View File

@ -28,7 +28,7 @@ public interface DictDataMapper extends BaseMapperX<DictDataDO> {
.in(DictDataDO::getValue, values));
}
default int selectCountByDictType(String dictType) {
default long selectCountByDictType(String dictType) {
return selectCount(DictDataDO::getDictType, dictType);
}

View File

@ -19,7 +19,7 @@ public interface MenuMapper extends BaseMapperX<MenuDO> {
.eq(MenuDO::getName, name));
}
default Integer selectCountByParentId(Long parentId) {
default Long selectCountByParentId(Long parentId) {
return selectCount(MenuDO::getParentId, parentId);
}

View File

@ -46,7 +46,7 @@ public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> {
.orderByDesc(SmsTemplateDO::getId));
}
default Integer selectCountByChannelId(Long channelId) {
default Long selectCountByChannelId(Long channelId) {
return selectCount(SmsTemplateDO::getChannelId, channelId);
}

View File

@ -82,7 +82,7 @@ public interface DictDataService extends DictDataFrameworkService {
* @param dictType 字典类型
* @return 数据数量
*/
int countByDictType(String dictType);
long countByDictType(String dictType);
/**
* 校验字典数据们是否有效如下情况视为无效

View File

@ -208,7 +208,7 @@ public class DictDataServiceImpl implements DictDataService {
}
@Override
public int countByDictType(String dictType) {
public long countByDictType(String dictType) {
return dictDataMapper.selectCountByDictType(dictType);
}

View File

@ -167,6 +167,7 @@ public class MenuServiceImpl implements MenuService {
* @param menuId 菜单编号
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteMenu(Long menuId) {
// 校验是否还有子菜单
if (menuMapper.selectCountByParentId(menuId) > 0) {

View File

@ -110,6 +110,6 @@ public interface SmsTemplateService {
* @param channelId 短信渠道编号
* @return 数量
*/
Integer countByChannelId(Long channelId);
Long countByChannelId(Long channelId);
}

View File

@ -216,7 +216,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
}
@Override
public Integer countByChannelId(Long channelId) {
public Long countByChannelId(Long channelId) {
return smsTemplateMapper.selectCountByChannelId(channelId);
}

View File

@ -177,7 +177,7 @@ public class DictTypeServiceTest extends BaseDbUnitTest {
// 准备参数
Long id = dbDictType.getId();
// mock 方法
when(dictDataService.countByDictType(eq(dbDictType.getType()))).thenReturn(1);
when(dictDataService.countByDictType(eq(dbDictType.getType()))).thenReturn(1L);
// 调用, 并断言异常
assertServiceException(() -> dictTypeService.deleteDictType(id), DICT_TYPE_HAS_CHILDREN);

View File

@ -147,7 +147,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest {
// 准备参数
Long id = dbSmsChannel.getId();
// mock 方法
when(smsTemplateService.countByChannelId(eq(id))).thenReturn(10);
when(smsTemplateService.countByChannelId(eq(id))).thenReturn(10L);
// 调用, 并断言异常
assertServiceException(() -> smsChannelService.deleteSmsChannel(id), SMS_CHANNEL_HAS_CHILDREN);