mirror of
https://github.com/dataease/dataease.git
synced 2026-05-19 10:18:11 +08:00
Merge branch 'v1.8' of github.com:dataease/dataease into v1.8
This commit is contained in:
@@ -26,4 +26,8 @@ public interface ExtChartViewMapper {
|
||||
ChartViewDTO searchOneWithPrivileges(@Param("userId") String userId,@Param("id") String id );
|
||||
|
||||
void chartCopyWithPanel(@Param("copyId") String copyId);
|
||||
|
||||
void deleteCircleView(@Param("pid") String pid);
|
||||
|
||||
void deleteCircleGroup(@Param("pid") String pid);
|
||||
}
|
||||
|
||||
@@ -228,4 +228,12 @@
|
||||
) pv_copy
|
||||
LEFT JOIN chart_view ON chart_view.id = pv_copy.copy_from_view
|
||||
</insert>
|
||||
|
||||
<delete id="deleteCircleView">
|
||||
delete chart_view from (select GET_CHART_GROUP_WITH_CHILDREN(#{pid}) cids) t,chart_view where FIND_IN_SET(chart_view.id,cids) and chart_type='public'
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCircleGroup">
|
||||
delete chart_group from (select GET_CHART_GROUP_WITH_CHILDREN(#{pid}) cids) t,chart_group where FIND_IN_SET(chart_group.id,cids)
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
@@ -135,43 +135,10 @@
|
||||
|
||||
|
||||
<select id="queryAuthViewsOriginal" resultMap="ExtResultMap">
|
||||
select * from (
|
||||
SELECT
|
||||
chart_group.id,
|
||||
chart_group.id AS 'inner_id',
|
||||
chart_group.NAME,
|
||||
chart_group.NAME AS 'label',
|
||||
chart_group.pid AS pid,
|
||||
chart_group.type AS 'model_inner_type',
|
||||
'spine' AS node_type,
|
||||
'view' AS model_type
|
||||
*
|
||||
FROM
|
||||
chart_group
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
distinct
|
||||
chart_view.id,
|
||||
chart_view.id AS 'inner_id',
|
||||
chart_view.NAME,
|
||||
chart_view.NAME AS 'label',
|
||||
chart_view.scene_id AS pid,
|
||||
chart_view.type AS 'model_inner_type',
|
||||
'leaf' AS node_type,
|
||||
'view' AS model_type
|
||||
FROM
|
||||
chart_view
|
||||
LEFT JOIN panel_view ON panel_view.chart_view_id = chart_view.id
|
||||
<where>
|
||||
<if test="record.pids != null and record.pids.size() > 0">
|
||||
and panel_view.panel_id in
|
||||
<foreach collection="record.pids" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
) viewsOriginal
|
||||
v_history_chart_view viewsOriginal
|
||||
ORDER BY viewsOriginal.node_type desc, CONVERT(viewsOriginal.label using gbk) asc
|
||||
</select>
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ public class ChartGroupController {
|
||||
|
||||
@ApiIgnore
|
||||
@ApiOperation("删除")
|
||||
@PostMapping("/delete/{id}")
|
||||
@PostMapping("/deleteCircle/{id}")
|
||||
public void tree(@PathVariable String id) {
|
||||
chartGroupService.delete(id);
|
||||
chartGroupService.deleteCircle(id);
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.dataease.service.chart;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.ChartGroupMapper;
|
||||
import io.dataease.base.mapper.ext.ExtChartGroupMapper;
|
||||
import io.dataease.base.mapper.ext.ExtChartViewMapper;
|
||||
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
@@ -15,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -36,6 +38,8 @@ public class ChartGroupService {
|
||||
private ExtDataSetGroupMapper extDataSetGroupMapper;
|
||||
@Resource
|
||||
private SysAuthService sysAuthService;
|
||||
@Resource
|
||||
private ExtChartViewMapper extChartViewMapper;
|
||||
|
||||
public ChartGroupDTO save(ChartGroup chartGroup) {
|
||||
checkName(chartGroup);
|
||||
@@ -53,26 +57,13 @@ public class ChartGroupService {
|
||||
return ChartGroupDTO;
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
@Transactional
|
||||
public void deleteCircle(String id) {
|
||||
Assert.notNull(id, "id cannot be null");
|
||||
sysAuthService.checkTreeNoManageCount("chart",id);
|
||||
|
||||
ChartGroup cg = chartGroupMapper.selectByPrimaryKey(id);
|
||||
ChartGroupRequest ChartGroup = new ChartGroupRequest();
|
||||
BeanUtils.copyBean(ChartGroup, cg);
|
||||
Map<String, String> stringStringMap = extDataSetGroupMapper.searchIds(id, "chart");
|
||||
String[] split = stringStringMap.get("ids").split(",");
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (String dsId : split) {
|
||||
if (StringUtils.isNotEmpty(dsId)) {
|
||||
ids.add(dsId);
|
||||
}
|
||||
}
|
||||
ChartGroupExample ChartGroupExample = new ChartGroupExample();
|
||||
ChartGroupExample.createCriteria().andIdIn(ids);
|
||||
chartGroupMapper.deleteByExample(ChartGroupExample);
|
||||
// 删除所有chart
|
||||
deleteChart(ids);
|
||||
//存量视图删除
|
||||
extChartViewMapper.deleteCircleView(id);
|
||||
//存量分组删除
|
||||
extChartViewMapper.deleteCircleGroup(id);
|
||||
}
|
||||
|
||||
public void deleteChart(List<String> sceneIds) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user