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

The following examples show how to use com.baomidou.mybatisplus.extension.toolkit.SqlHelper. 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: ParameterServiceImpl.java    From zuihou-admin-boot with 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 File: ParameterServiceImpl.java    From zuihou-admin-cloud with 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 File: BlogInfoServiceImpl.java    From My-Blog-layui with 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 File: ParameterServiceImpl.java    From zuihou-admin-boot with 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 File: ParameterServiceImpl.java    From zuihou-admin-boot with 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 File: ParameterServiceImpl.java    From zuihou-admin-cloud with 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 File: ParameterServiceImpl.java    From zuihou-admin-cloud with 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 File: AdminUserServiceImpl.java    From My-Blog-layui with Apache License 2.0 4 votes vote down vote up
@Transactional
@Override
public boolean updateUserInfo(AdminUser adminUser) {
    return SqlHelper.retBool(adminUserMappe.updateById(adminUser));
}