画像库树图修改
This commit is contained in:
parent
6061b870b1
commit
bc519951f0
@ -9,6 +9,8 @@ import com.xinelu.common.utils.poi.ExcelUtil;
|
|||||||
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
||||||
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
|
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
|
||||||
import com.xinelu.manage.service.labelfieldinfo.ILabelFieldInfoService;
|
import com.xinelu.manage.service.labelfieldinfo.ILabelFieldInfoService;
|
||||||
|
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
|
||||||
|
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -55,8 +57,8 @@ public class LabelFieldInfoController extends BaseController {
|
|||||||
* 查询标签字段信息列表树图
|
* 查询标签字段信息列表树图
|
||||||
*/
|
*/
|
||||||
@GetMapping("/labelFieldList")
|
@GetMapping("/labelFieldList")
|
||||||
public AjaxResult labelFieldList(String fieldType) {
|
public List<LabelFieldTreeVO> labelFieldList(String fieldType) {
|
||||||
return AjaxResult.success(labelFieldInfoService.labelFieldList(fieldType));
|
return labelFieldInfoService.labelFieldList(fieldType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -95,4 +95,12 @@ public interface LabelFieldInfoMapper {
|
|||||||
* @return GroupingValue
|
* @return GroupingValue
|
||||||
*/
|
*/
|
||||||
List<GroupingValue> selectLabelFieldInfoByTaskPartitionDictId(Long taskPartitionDictId);
|
List<GroupingValue> selectLabelFieldInfoByTaskPartitionDictId(Long taskPartitionDictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询标签
|
||||||
|
*
|
||||||
|
* @param taskPartitionDictIds 标签
|
||||||
|
* @return GroupingValue
|
||||||
|
*/
|
||||||
|
List<LabelFieldVO> selectLabelFieldNameByTaskPartitionDictIds(@Param("taskPartitionDictIds") List<Long> taskPartitionDictIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.xinelu.manage.service.labelfieldinfo;
|
|||||||
import com.xinelu.common.core.domain.AjaxResult;
|
import com.xinelu.common.core.domain.AjaxResult;
|
||||||
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
||||||
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
|
import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
|
||||||
|
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
|
||||||
|
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ public interface ILabelFieldInfoService {
|
|||||||
* @param fieldType 字段类型
|
* @param fieldType 字段类型
|
||||||
* @return AjaxResult
|
* @return AjaxResult
|
||||||
*/
|
*/
|
||||||
AjaxResult labelFieldList(String fieldType);
|
List<LabelFieldTreeVO> labelFieldList(String fieldType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增标签字段信息
|
* 新增标签字段信息
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.xinelu.manage.service.labelfieldinfo.impl;
|
package com.xinelu.manage.service.labelfieldinfo.impl;
|
||||||
|
|
||||||
import com.xinelu.common.core.domain.AjaxResult;
|
|
||||||
import com.xinelu.common.exception.ServiceException;
|
import com.xinelu.common.exception.ServiceException;
|
||||||
import com.xinelu.common.utils.SecurityUtils;
|
import com.xinelu.common.utils.SecurityUtils;
|
||||||
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
||||||
@ -8,15 +7,17 @@ import com.xinelu.manage.dto.labelfieldinfo.LabelFieldInfoAddDTO;
|
|||||||
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
|
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
|
||||||
import com.xinelu.manage.mapper.labelfieldinfo.LabelFieldInfoMapper;
|
import com.xinelu.manage.mapper.labelfieldinfo.LabelFieldInfoMapper;
|
||||||
import com.xinelu.manage.service.labelfieldinfo.ILabelFieldInfoService;
|
import com.xinelu.manage.service.labelfieldinfo.ILabelFieldInfoService;
|
||||||
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
|
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldTreeVO;
|
||||||
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
|
import com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -64,18 +65,31 @@ public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
|
|||||||
* @return AjaxResult
|
* @return AjaxResult
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult labelFieldList(String fieldType) {
|
public List<LabelFieldTreeVO> labelFieldList(String fieldType) {
|
||||||
|
int i = 1;
|
||||||
List<LabelFieldVO> labelFieldList = labelFieldInfoMapper.selectLabelFieldList(fieldType);
|
List<LabelFieldVO> labelFieldList = labelFieldInfoMapper.selectLabelFieldList(fieldType);
|
||||||
List<Long> labelFieldIds = labelFieldList.stream().filter(Objects::nonNull).map(LabelFieldVO::getLabelFieldId).filter(Objects::nonNull).collect(Collectors.toList());
|
List<Long> taskPartitionDictIds = labelFieldList.stream().filter(Objects::nonNull).map(LabelFieldVO::getTaskPartitionDictId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
if (labelFieldIds.size() == 0) {
|
if (taskPartitionDictIds.size() == 0) {
|
||||||
return AjaxResult.success(labelFieldList);
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<LabelFieldContentVO> labelFieldContentList = labelFieldContentMapper.selectLabelFieldContent(labelFieldIds);
|
List<LabelFieldVO> collect = labelFieldList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
for (LabelFieldVO labelField : labelFieldList) {
|
List<LabelFieldVO> labelFieldInfoList = labelFieldInfoMapper.selectLabelFieldNameByTaskPartitionDictIds(taskPartitionDictIds);
|
||||||
List<LabelFieldContentVO> collect = labelFieldContentList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getFieldId()) && labelField.getLabelFieldId().equals(item.getFieldId())).collect(Collectors.toList());
|
List<LabelFieldVO> labelFieldVOS = new ArrayList<>();
|
||||||
labelField.setLabelFieldContentList(collect);
|
labelFieldVOS.addAll(collect);
|
||||||
|
labelFieldVOS.addAll(labelFieldInfoList);
|
||||||
|
for (LabelFieldVO labelFieldVO : labelFieldVOS) {
|
||||||
|
labelFieldVO.setCode(i);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return AjaxResult.success(labelFieldList);
|
for (LabelFieldVO labelField : collect) {
|
||||||
|
if (Objects.nonNull(labelField.getTaskPartitionDictId()) && StringUtils.isNotBlank(labelField.getTaskPartitionDictName()) && StringUtils.isNotBlank(labelField.getLabel())) {
|
||||||
|
List<LabelFieldVO> collectLabelFieldInfoList = labelFieldInfoList.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskPartitionDictId()) && labelField.getTaskPartitionDictId().equals(item.getTaskPartitionDictId())).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(collectLabelFieldInfoList)) {
|
||||||
|
labelField.setLabelFieldList(collectLabelFieldInfoList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return collect.stream().map(LabelFieldTreeVO::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,88 @@
|
|||||||
|
package com.xinelu.manage.vo.labelfieldinfo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 画像树图信息对象vo
|
||||||
|
*
|
||||||
|
* @author xinelu
|
||||||
|
* @date 2024-06-27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LabelFieldTreeVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点名称
|
||||||
|
*/
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点层级
|
||||||
|
*/
|
||||||
|
private Integer value;
|
||||||
|
|
||||||
|
|
||||||
|
private String termCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子节点
|
||||||
|
*/
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<LabelFieldTreeVO> children;
|
||||||
|
|
||||||
|
public LabelFieldTreeVO() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabelFieldTreeVO(LabelFieldVO labelField) {
|
||||||
|
this.id = labelField.getId();
|
||||||
|
this.label = labelField.getLabel();
|
||||||
|
this.termCode = labelField.getFieldCode();
|
||||||
|
this.value = labelField.getCode();
|
||||||
|
this.children = labelField.getLabelFieldList().stream().map(LabelFieldTreeVO::new).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTermCode() {
|
||||||
|
return termCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTermCode(String termCode) {
|
||||||
|
this.termCode = termCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Integer value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<LabelFieldTreeVO> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<LabelFieldTreeVO> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
package com.xinelu.manage.vo.labelfieldinfo;
|
package com.xinelu.manage.vo.labelfieldinfo;
|
||||||
|
|
||||||
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
import com.xinelu.manage.domain.labelfieldinfo.LabelFieldInfo;
|
||||||
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,8 +22,17 @@ public class LabelFieldVO extends LabelFieldInfo {
|
|||||||
*/
|
*/
|
||||||
private Long LabelFieldId;
|
private Long LabelFieldId;
|
||||||
|
|
||||||
/**
|
private String label;
|
||||||
* 标签内容
|
|
||||||
*/
|
private Integer code;
|
||||||
private List<LabelFieldContentVO> labelFieldContentList;
|
|
||||||
|
private List<LabelFieldVO> labelFieldList = new ArrayList<LabelFieldVO>();
|
||||||
|
|
||||||
|
public List<LabelFieldVO> getChildren() {
|
||||||
|
return labelFieldList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<LabelFieldVO> children) {
|
||||||
|
this.labelFieldList = children;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -61,14 +61,20 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="selectLabelFieldList" resultType="com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO">
|
<select id="selectLabelFieldList" resultType="com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO">
|
||||||
select id LabelFieldId,
|
select
|
||||||
field_name,
|
lfi.task_partition_dict_id id,
|
||||||
field_code,
|
lfi.task_partition_dict_id,
|
||||||
field_type,
|
lfi.task_partition_dict_name,
|
||||||
field_sort,
|
lfi.task_partition_dict_name label
|
||||||
field_remark
|
from label_field_info lfi
|
||||||
from label_field_info
|
LEFT JOIN task_partition_dict tpd ON tpd.id = lfi.task_partition_dict_id
|
||||||
where field_type = #{fieldType}
|
<where>
|
||||||
|
<if test="fieldType != null and fieldType != ''">
|
||||||
|
lfi.field_type = #{fieldType}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
group by task_partition_dict_id
|
||||||
|
order by tpd.task_partition_sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectLabelFieldInfoById" parameterType="Long"
|
<select id="selectLabelFieldInfoById" parameterType="Long"
|
||||||
@ -248,4 +254,23 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectLabelFieldNameByTaskPartitionDictIds"
|
||||||
|
resultType="com.xinelu.manage.vo.labelfieldinfo.LabelFieldVO">
|
||||||
|
select id,
|
||||||
|
field_name label,
|
||||||
|
field_code,
|
||||||
|
task_partition_dict_id,
|
||||||
|
task_partition_dict_name
|
||||||
|
from label_field_info
|
||||||
|
<where>
|
||||||
|
<if test="taskPartitionDictIds != null and taskPartitionDictIds.size() > 0">
|
||||||
|
task_partition_dict_id in
|
||||||
|
<foreach item="taskPartitionDictIds" collection="taskPartitionDictIds" open="(" separator="," close=")">
|
||||||
|
#{taskPartitionDictIds}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by field_sort
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user