forked from github/dataease
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
9e609dae00
@ -7,6 +7,6 @@ import java.util.List;
|
||||
|
||||
public interface ExtPanelViewLinkageMapper {
|
||||
|
||||
List<PanelViewLinkageDTO> getViewLinkageGather(@Param("panelId") String panelId,@Param("sourceViewId") String sourceViewId);
|
||||
List<PanelViewLinkageDTO> getViewLinkageGather(@Param("panelId") String panelId,@Param("sourceViewId") String sourceViewId,@Param("targetViewIds") List<String> targetViewIds);
|
||||
|
||||
}
|
||||
|
@ -5,26 +5,32 @@
|
||||
<resultMap id="LinkageGatherMap" type="io.dataease.dto.PanelViewLinkageDTO">
|
||||
<result column="target_view_id" jdbcType="VARCHAR" property="targetViewId" />
|
||||
<result column="targetViewName" jdbcType="VARCHAR" property="targetViewName" />
|
||||
<collection property="linkageFields">
|
||||
<result column="linkageActive" property="linkageActive" />
|
||||
<collection property="linkageFields" ofType="io.dataease.dto.PanelViewLinkageFieldDTO">
|
||||
<result column="source_filed" jdbcType="VARCHAR" property="sourceFiled" />
|
||||
<result column="target_filed" jdbcType="VARCHAR" property="targetFiled" />
|
||||
</collection>
|
||||
|
||||
<collection property="linkageFields" ofType="io.dataease.dto.PanelViewLinkageFieldDTO">
|
||||
<result column="source_filed" jdbcType="VARCHAR" property="sourceFiled" />
|
||||
<result column="target_filed" jdbcType="VARCHAR" property="targetFiled" />
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id ="getViewLinkageGather" resultMap="LinkageGatherMap">
|
||||
|
||||
SELECT
|
||||
chart_view.`name` as 'targetViewName',
|
||||
panel_view_linkage.target_view_id,
|
||||
panel_view_linkage_field.source_filed,
|
||||
panel_view_linkage_field.target_filed
|
||||
FROM
|
||||
chart_view
|
||||
LEFT JOIN panel_view_linkage ON chart_view.id = panel_view_linkage.target_view_id
|
||||
LEFT JOIN panel_view_linkage_field ON panel_view_linkage.id = panel_view_linkage_field.linkage_id
|
||||
AND panel_view_linkage.panel_id = #{panelId}
|
||||
AND panel_view_linkage.source_view_id = #{sourceViewId}
|
||||
|
||||
SELECT
|
||||
chart_view.`name` as 'targetViewName',
|
||||
chart_view.id as 'target_view_id',
|
||||
(case when panel_view_linkage.target_view_id is null then 0 else 1 end) as 'linkageActive',
|
||||
panel_view_linkage_field.source_filed,
|
||||
panel_view_linkage_field.target_filed
|
||||
FROM
|
||||
chart_view
|
||||
LEFT JOIN panel_view_linkage ON chart_view.id = panel_view_linkage.target_view_id
|
||||
LEFT JOIN panel_view_linkage_field ON panel_view_linkage.id = panel_view_linkage_field.linkage_id
|
||||
AND panel_view_linkage.panel_id = #{panelId}
|
||||
AND panel_view_linkage.source_view_id = #{sourceViewId}
|
||||
where chart_view.id in
|
||||
<foreach collection="targetViewIds" item="targetViewId" index="index" open="(" close=")" separator=",">
|
||||
#{targetViewId}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.dataease.dto;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.base.domain.PanelViewLinkage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -16,14 +17,27 @@ public class PanelViewLinkageDTO extends PanelViewLinkage {
|
||||
private String targetViewName;
|
||||
|
||||
//关联状态
|
||||
private boolean linkageActive = true;
|
||||
private boolean linkageActive = false;
|
||||
|
||||
private List<PanelViewLinkageFieldDTO> linkageFields = new ArrayList<>();
|
||||
|
||||
|
||||
private List<DatasetTableField> targetViewField = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
public PanelViewLinkageDTO() {
|
||||
|
||||
}
|
||||
|
||||
public List<DatasetTableField> getTargetViewField() {
|
||||
return targetViewField;
|
||||
}
|
||||
|
||||
public void setTargetViewField(List<DatasetTableField> targetViewField) {
|
||||
this.targetViewField = targetViewField;
|
||||
}
|
||||
|
||||
public String getTargetViewName() {
|
||||
return targetViewName;
|
||||
}
|
||||
|
@ -28,17 +28,9 @@ public class PanelViewLinkageService {
|
||||
|
||||
public Map<String, PanelViewLinkageDTO> getViewLinkageGather(PanelLinkageRequest request) {
|
||||
if(CollectionUtils.isNotEmpty(request.getTargetViewIds())){
|
||||
Map<String, PanelViewLinkageDTO> result = Optional.ofNullable(extPanelViewLinkageMapper.getViewLinkageGather(request.getPanelId(),request.getSourceViewId()))
|
||||
Map<String, PanelViewLinkageDTO> result = Optional.ofNullable(extPanelViewLinkageMapper.getViewLinkageGather(request.getPanelId(),request.getSourceViewId(),request.getTargetViewIds()))
|
||||
.orElse(new ArrayList<>()).stream()
|
||||
.collect(Collectors.toMap(PanelViewLinkageDTO::getTargetViewId,PanelViewLinkageDTO->PanelViewLinkageDTO));
|
||||
// Set<String> innerTargetIds = result.keySet();
|
||||
//
|
||||
// // 将对应没有建立关联关系的targetId 也补充进去
|
||||
// request.getTargetViewIds().stream().forEach(targetId->{
|
||||
// if(!innerTargetIds.contains(targetId)){
|
||||
// result.put(targetId,new PanelViewLinkageDTO(false));
|
||||
// }
|
||||
// });
|
||||
return result;
|
||||
}
|
||||
return new HashMap<>();
|
||||
|
Loading…
Reference in New Issue
Block a user