@Override
    public ActionResult deleteWithPermission(Long id) {
        Chart data = queryExistent(id).getData();
        PermissionUtils.checkOperationPermission(data.getUserId());

        ChartDO chartDO = new ChartDO();
        chartDO.setId(id);
        chartDO.setDeleted(YesOrNoEnum.YES.getLetter());
        getMapper().updateById(chartDO);
        LambdaQueryWrapper<DashboardChartRelationDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DashboardChartRelationDO::getChartId, id);
        List<DashboardChartRelationDO> relationDO = getDashboardMapper().selectList(queryWrapper);
        List<Long> relationIds = relationDO.stream().map(DashboardChartRelationDO::getId).toList();
        if (CollectionUtils.isNotEmpty(relationIds)) {
            getDashboardMapper().deleteBatchIds(relationIds);
        }
        return ActionResult.isSuccess();
    }
@author moji
@version ChartServiceImpl.java, v 0.1 June 9, 2023 16:06 moji Exp $
@date 2023/06/09
chat2db-server/chat2db-server-domain/chat2db-server-domain-core/src/main/java/ai/chat2db/server/domain/core/impl/ChartServiceImpl.java