feat(user): 支持组件时间标识集合字段
This commit is contained in:
@@ -9,7 +9,6 @@ import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.util.List;
|
||||
@@ -60,9 +59,7 @@ public class ComponentParam {
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty("时间标识")
|
||||
private String timeKey;
|
||||
|
||||
|
||||
private List<String> timeKeys;
|
||||
|
||||
@ApiModelProperty("系统类型")
|
||||
@NotBlank(message = "系统类型不为空")
|
||||
@@ -84,6 +81,4 @@ public class ComponentParam {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.njcn.user.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@@ -80,5 +81,13 @@ public class Component extends BaseEntity {
|
||||
|
||||
private String timeKey;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> timeKeys;
|
||||
|
||||
public String getTimeKey() {
|
||||
if (timeKeys != null) {
|
||||
timeKey = String.join(",", timeKeys);
|
||||
}
|
||||
return timeKey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ public class ComponentVO implements Serializable {
|
||||
@ApiModelProperty("时间标识")
|
||||
private String timeKey;
|
||||
|
||||
@ApiModelProperty("时间标识集合")
|
||||
private List<String> timeKeys;
|
||||
|
||||
@ApiModelProperty("子级")
|
||||
List<ComponentVO> children;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.user.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -25,7 +26,10 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -93,6 +97,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
||||
componentList.forEach(item -> {
|
||||
ComponentVO componentVO = new ComponentVO();
|
||||
BeanUtil.copyProperties(item, componentVO);
|
||||
componentVO.setTimeKeys(StrUtil.split(item.getTimeKey(), ","));
|
||||
// componentVO.setFunctionGroup(Arrays.stream(item.getFunctionGroup().split(",")).map(s -> Integer.valueOf(s.trim())).collect(Collectors.toList()));
|
||||
list.add(componentVO);
|
||||
});
|
||||
@@ -138,6 +143,7 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
||||
list.forEach(item -> {
|
||||
ComponentVO componentVO = new ComponentVO();
|
||||
BeanUtil.copyProperties(item, componentVO);
|
||||
componentVO.setTimeKeys(StrUtil.split(item.getTimeKey(), ","));
|
||||
// componentVO.setFunctionGroup(Arrays.stream(item.getFunctionGroup().split(",")).map(s -> Integer.valueOf(s.trim())).collect(Collectors.toList()));
|
||||
componentVOList.add(componentVO);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user