feat(REQ-2545): 页面绑定关系增加类型字段。
This commit is contained in:
parent
fbe6368214
commit
0d46b1b1eb
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.tyr.client.model.req;
|
package cn.axzo.tyr.client.model.req;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author likunpeng
|
* @author likunpeng
|
||||||
@ -31,4 +33,11 @@ public class GetPageElementReq {
|
|||||||
*/
|
*/
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Boolean querySelectedOnly = Boolean.FALSE;
|
private Boolean querySelectedOnly = Boolean.FALSE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询的关联类型,默认全查
|
||||||
|
* 如果要过滤页面路由的,relationTypes传[0]
|
||||||
|
*/
|
||||||
|
@Builder.Default
|
||||||
|
private List<Integer> relationTypes = Lists.newArrayList(0, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,10 +28,11 @@ public class SaasPageElementFeatureResourceRelationDao extends ServiceImpl<SaasP
|
|||||||
.orderByDesc(BaseEntity::getId)
|
.orderByDesc(BaseEntity::getId)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
public List<SaasPageElementFeatureResourceRelation> listByUniCodeAndTerminal(List<String> featureResourceUniCodes, String terminal) {
|
public List<SaasPageElementFeatureResourceRelation> listByUniCodeAndTerminal(List<String> featureResourceUniCodes, String terminal, List<Integer> types) {
|
||||||
return lambdaQuery()
|
return lambdaQuery()
|
||||||
.eq(SaasPageElementFeatureResourceRelation::getIsDelete, DeleteEnum.NORMAL.getValue())
|
.eq(SaasPageElementFeatureResourceRelation::getIsDelete, DeleteEnum.NORMAL.getValue())
|
||||||
.in(SaasPageElementFeatureResourceRelation::getFeatureResourceUniCode, featureResourceUniCodes)
|
.in(SaasPageElementFeatureResourceRelation::getFeatureResourceUniCode, featureResourceUniCodes)
|
||||||
|
.in(CollectionUtils.isNotEmpty(types), SaasPageElementFeatureResourceRelation::getType, types)
|
||||||
.eq(SaasPageElementFeatureResourceRelation::getTerminal, terminal)
|
.eq(SaasPageElementFeatureResourceRelation::getTerminal, terminal)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ public class SaasPageElementServiceImpl implements SaasPageElementService {
|
|||||||
.one();
|
.one();
|
||||||
AssertUtil.notNull(saasFeatureResource, "页面或组件信息不存在");
|
AssertUtil.notNull(saasFeatureResource, "页面或组件信息不存在");
|
||||||
|
|
||||||
List<SaasPageElementFeatureResourceRelation> relations = saasPageElementFeatureResourceRelationDao.listByUniCodeAndTerminal(Lists.newArrayList(saasFeatureResource.getUniCode()), saasFeatureResource.getTerminal());
|
List<SaasPageElementFeatureResourceRelation> relations = saasPageElementFeatureResourceRelationDao.listByUniCodeAndTerminal(Lists.newArrayList(saasFeatureResource.getUniCode()), saasFeatureResource.getTerminal(), request.getRelationTypes());
|
||||||
if (CollectionUtils.isEmpty(relations)) {
|
if (CollectionUtils.isEmpty(relations)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ public class SaasPageElementServiceImpl implements SaasPageElementService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PageElementBasicDTO> getByTerminalAndUniCode(String terminal, String featureResourceUniCode) {
|
public List<PageElementBasicDTO> getByTerminalAndUniCode(String terminal, String featureResourceUniCode) {
|
||||||
List<SaasPageElementFeatureResourceRelation> relations = saasPageElementFeatureResourceRelationDao.listByUniCodeAndTerminal(Lists.newArrayList(featureResourceUniCode), terminal);
|
List<SaasPageElementFeatureResourceRelation> relations = saasPageElementFeatureResourceRelationDao.listByUniCodeAndTerminal(Lists.newArrayList(featureResourceUniCode), terminal, null);
|
||||||
if (CollectionUtils.isEmpty(relations)) {
|
if (CollectionUtils.isEmpty(relations)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ public class SaasPageElementServiceImpl implements SaasPageElementService {
|
|||||||
if (CollectionUtils.isEmpty(saasFeatureResources)) {
|
if (CollectionUtils.isEmpty(saasFeatureResources)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<SaasPageElementFeatureResourceRelation> resourceRelations = saasPageElementFeatureResourceRelationDao.listByUniCodeAndTerminal(saasFeatureResources.stream().map(SaasFeatureResource::getUniCode).collect(Collectors.toList()), request.getTerminal());
|
List<SaasPageElementFeatureResourceRelation> resourceRelations = saasPageElementFeatureResourceRelationDao.listByUniCodeAndTerminal(saasFeatureResources.stream().map(SaasFeatureResource::getUniCode).collect(Collectors.toList()), request.getTerminal(), null);
|
||||||
if (CollectionUtils.isNotEmpty(resourceRelations)) {
|
if (CollectionUtils.isNotEmpty(resourceRelations)) {
|
||||||
// 这里会存在重复的数据,下面在过滤转为Set的时候做了去重
|
// 这里会存在重复的数据,下面在过滤转为Set的时候做了去重
|
||||||
relations.addAll(resourceRelations);
|
relations.addAll(resourceRelations);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user