Java Code Examples for com.baomidou.mybatisplus.extension.toolkit.SqlHelper

The following examples show how to use com.baomidou.mybatisplus.extension.toolkit.SqlHelper. These examples are extracted from open source projects. 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 Project: zuihou-admin-boot   Source File: ParameterServiceImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
public boolean removeByIds(Collection<? extends Serializable> idList) {
    if (CollectionUtils.isEmpty(idList)) {
        return true;
    }
    List<Parameter> parameterList = super.listByIds(idList);
    if (parameterList.isEmpty()) {
        return true;
    }
    boolean bool = SqlHelper.retBool(getBaseMapper().deleteBatchIds(idList));
    if (bool) {
        String[] cacheKeys = parameterList.stream().map((item) -> buildTenantKey(item.getKey())).toArray(String[]::new);
        channel.evict(getRegion(), cacheKeys);

        parameterList.forEach((model -> {
            SpringUtils.publishEvent(new ParameterUpdateEvent(
                    new ParameterUpdate(model.getKey(), model.getValue(), null, BaseContextHandler.getTenant())
            ));
        }));
    }
    return bool;
}
 
Example 2
Source Project: zuihou-admin-cloud   Source File: ParameterServiceImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
public boolean removeByIds(Collection<? extends Serializable> idList) {
    if (CollectionUtils.isEmpty(idList)) {
        return true;
    }
    List<Parameter> parameterList = super.listByIds(idList);
    if (parameterList.isEmpty()) {
        return true;
    }
    boolean bool = SqlHelper.retBool(getBaseMapper().deleteBatchIds(idList));
    if (bool) {
        String[] cacheKeys = parameterList.stream().map((item) -> buildTenantKey(item.getKey())).toArray(String[]::new);
        channel.evict(getRegion(), cacheKeys);

        parameterList.forEach((model -> {
            SpringUtils.publishEvent(new ParameterUpdateEvent(
                    new ParameterUpdate(model.getKey(), model.getValue(), null, BaseContextHandler.getTenant())
            ));
        }));
    }
    return bool;
}
 
Example 3
Source Project: My-Blog-layui   Source File: BlogInfoServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Transactional(rollbackFor = Exception.class)
@Override
public boolean clearBlogInfo(Long blogId) {
    if (SqlHelper.retBool(blogInfoMapper.deleteById(blogId))){
        QueryWrapper<BlogTagRelation> tagRelationWrapper = new QueryWrapper<>();
        tagRelationWrapper.lambda().eq(BlogTagRelation::getBlogId,blogId);
        blogTagRelationMapper.delete(tagRelationWrapper);
        QueryWrapper<BlogComment> commentWrapper = new QueryWrapper<>();
        commentWrapper.lambda().eq(BlogComment::getBlogId,blogId);
        blogCommentMapper.delete(commentWrapper);
        return true;
    }
    return false;
}
 
Example 4
Source Project: zuihou-admin-boot   Source File: ParameterServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(Parameter model) {
    boolean bool = SqlHelper.retBool(baseMapper.insert(model));
    if (bool) {
        String cacheKey = buildTenantKey(model.getKey());
        channel.set(getRegion(), cacheKey, model.getValue());
    }
    return bool;
}
 
Example 5
Source Project: zuihou-admin-boot   Source File: ParameterServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateById(Parameter model) {
    boolean bool = SqlHelper.retBool(getBaseMapper().updateById(model));
    if (bool) {
        String cacheKey = buildTenantKey(model.getKey());
        channel.set(getRegion(), cacheKey, model.getValue());

        SpringUtils.publishEvent(new ParameterUpdateEvent(
                new ParameterUpdate(model.getKey(), model.getValue(), null, BaseContextHandler.getTenant())
        ));
    }
    return bool;
}
 
Example 6
Source Project: zuihou-admin-cloud   Source File: ParameterServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(Parameter model) {
    boolean bool = SqlHelper.retBool(baseMapper.insert(model));
    if (bool) {
        String cacheKey = buildTenantKey(model.getKey());
        channel.set(getRegion(), cacheKey, model.getValue());
    }
    return bool;
}
 
Example 7
Source Project: zuihou-admin-cloud   Source File: ParameterServiceImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateById(Parameter model) {
    boolean bool = SqlHelper.retBool(getBaseMapper().updateById(model));
    if (bool) {
        String cacheKey = buildTenantKey(model.getKey());
        channel.set(getRegion(), cacheKey, model.getValue());

        SpringUtils.publishEvent(new ParameterUpdateEvent(
                new ParameterUpdate(model.getKey(), model.getValue(), null, BaseContextHandler.getTenant())
        ));
    }
    return bool;
}
 
Example 8
Source Project: My-Blog-layui   Source File: AdminUserServiceImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Transactional
@Override
public boolean updateUserInfo(AdminUser adminUser) {
    return SqlHelper.retBool(adminUserMappe.updateById(adminUser));
}