Java Code Examples for com.baomidou.mybatisplus.core.toolkit.CollectionUtils#isNotEmpty()

The following examples show how to use com.baomidou.mybatisplus.core.toolkit.CollectionUtils#isNotEmpty() . 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: MenuServiceImpl.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 6 votes vote down vote up
private void delete(List<String> menuIds) {
    List<String> list = new ArrayList<>(menuIds);
    removeByIds(menuIds);

    LambdaQueryWrapper<Menu> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.in(Menu::getParentId, menuIds);
    List<Menu> menus = baseMapper.selectList(queryWrapper);
    if (CollectionUtils.isNotEmpty(menus)) {
        List<String> menuIdList = new ArrayList<>();
        menus.forEach(m -> menuIdList.add(String.valueOf(m.getMenuId())));
        list.addAll(menuIdList);
        this.roleMenuService.deleteRoleMenusByMenuId(list);
        this.delete(menuIdList);
    } else {
        this.roleMenuService.deleteRoleMenusByMenuId(list);
    }
}
 
Example 2
Source File: DeptServiceImpl.java    From FEBS-Cloud with Apache License 2.0 5 votes vote down vote up
private void delete(List<String> deptIds) {
    removeByIds(deptIds);
    userDataPermissionService.deleteByDeptIds(deptIds);

    LambdaQueryWrapper<Dept> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.in(Dept::getParentId, deptIds);
    List<Dept> depts = baseMapper.selectList(queryWrapper);
    if (CollectionUtils.isNotEmpty(depts)) {
        List<String> deptIdList = new ArrayList<>();
        depts.forEach(d -> deptIdList.add(String.valueOf(d.getDeptId())));
        this.delete(deptIdList);
    }
}
 
Example 3
Source File: MenuServiceImpl.java    From FEBS-Cloud with Apache License 2.0 5 votes vote down vote up
private void delete(List<String> menuIds) {
    removeByIds(menuIds);

    LambdaQueryWrapper<Menu> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.in(Menu::getParentId, menuIds);
    List<Menu> menus = baseMapper.selectList(queryWrapper);
    if (CollectionUtils.isNotEmpty(menus)) {
        List<String> menuIdList = new ArrayList<>();
        menus.forEach(m -> menuIdList.add(String.valueOf(m.getMenuId())));
        this.delete(menuIdList);
    }
}
 
Example 4
Source File: UserServiceImpl.java    From FEBS-Cloud with Apache License 2.0 5 votes vote down vote up
@Override
public SystemUser findUserDetail(String username) {
    SystemUser param = new SystemUser();
    param.setUsername(username);
    List<SystemUser> users = this.baseMapper.findUserDetail(param);
    return CollectionUtils.isNotEmpty(users) ? users.get(0) : null;
}
 
Example 5
Source File: DeptServiceImpl.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
private void delete(List<String> deptIds) {
    removeByIds(deptIds);

    LambdaQueryWrapper<Dept> queryWrapper = new LambdaQueryWrapper<>();
    queryWrapper.in(Dept::getParentId, deptIds);
    List<Dept> depts = baseMapper.selectList(queryWrapper);
    if (CollectionUtils.isNotEmpty(depts)) {
        List<String> deptIdList = new ArrayList<>();
        depts.forEach(d -> deptIdList.add(String.valueOf(d.getDeptId())));
        this.delete(deptIdList);
    }
}
 
Example 6
Source File: UserServiceImpl.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
@Override
public User findUserDetailList(String username) {
    User param = new User();
    param.setUsername(username);
    List<User> users = this.baseMapper.findUserDetail(param);
    return CollectionUtils.isNotEmpty(users) ? users.get(0) : null;
}
 
Example 7
Source File: CollUtil.java    From albedo with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 从list中取第一条数据返回对应List中泛型的单个结果
 *
 * @param list ignore
 * @param <E>  ignore
 * @return ignore
 */
public static <E> E getObject(List<E> list) {
	if (CollectionUtils.isNotEmpty(list)) {
		int size = list.size();
		if (size > 1) {
			log.warn(String.format("Warn: execute Method There are  %s results.", size));
		}
		return list.get(0);
	}
	return null;
}
 
Example 8
Source File: MyPage.java    From pybbs with GNU Affero General Public License v3.0 5 votes vote down vote up
public Page<T> setAscs(List<String> ascs) {
    if (CollectionUtils.isNotEmpty(ascs)) {
        this.ascs = (String[]) ascs.toArray(new String[0]);
    }

    return this;
}
 
Example 9
Source File: MyPage.java    From pybbs with GNU Affero General Public License v3.0 5 votes vote down vote up
public Page<T> setDescs(List<String> descs) {
    if (CollectionUtils.isNotEmpty(descs)) {
        this.descs = (String[]) descs.toArray(new String[0]);
    }

    return this;
}
 
Example 10
Source File: Assert.java    From supplierShop with MIT License 4 votes vote down vote up
public static void notEmpty(Collection<?> collection, IErrorCode errorCode) {
    if (CollectionUtils.isNotEmpty(collection)) {
        Assert.fail(errorCode);
    }
}
 
Example 11
Source File: GeneratorConfigServiceImpl.java    From FEBS-Cloud with Apache License 2.0 4 votes vote down vote up
@Override
public GeneratorConfig findGeneratorConfig() {
    List<GeneratorConfig> generatorConfigs = this.baseMapper.selectList(null);
    return CollectionUtils.isNotEmpty(generatorConfigs) ? generatorConfigs.get(0) : null;
}