refactor(系统设置): 修改文件管理的tag数据类型
This commit is contained in:
parent
0ef5e7a6bf
commit
fbb478d19c
|
@ -6,6 +6,7 @@ import jakarta.validation.constraints.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -50,7 +51,7 @@ public class FileMetadata implements Serializable {
|
||||||
private String updateUser;
|
private String updateUser;
|
||||||
|
|
||||||
@Schema(description = "标签")
|
@Schema(description = "标签")
|
||||||
private String tags;
|
private java.util.List<String> tags;
|
||||||
|
|
||||||
@Schema(description = "描述")
|
@Schema(description = "描述")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
|
@ -64,19 +64,50 @@ public class FileMetadataExample {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract static class GeneratedCriteria {
|
protected abstract static class GeneratedCriteria {
|
||||||
|
protected List<Criterion> tagsCriteria;
|
||||||
|
|
||||||
|
protected List<Criterion> allCriteria;
|
||||||
|
|
||||||
protected List<Criterion> criteria;
|
protected List<Criterion> criteria;
|
||||||
|
|
||||||
protected GeneratedCriteria() {
|
protected GeneratedCriteria() {
|
||||||
super();
|
super();
|
||||||
criteria = new ArrayList<Criterion>();
|
criteria = new ArrayList<Criterion>();
|
||||||
|
tagsCriteria = new ArrayList<Criterion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getTagsCriteria() {
|
||||||
|
return tagsCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addTagsCriterion(String condition, Object value, String property) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
tagsCriteria.add(new Criterion(condition, value, "io.metersphere.handler.ListTypeHandler"));
|
||||||
|
allCriteria = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addTagsCriterion(String condition, List<String> value1, List<String> value2, String property) {
|
||||||
|
if (value1 == null || value2 == null) {
|
||||||
|
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
tagsCriteria.add(new Criterion(condition, value1, value2, "io.metersphere.handler.ListTypeHandler"));
|
||||||
|
allCriteria = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return criteria.size() > 0;
|
return criteria.size() > 0
|
||||||
|
|| tagsCriteria.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Criterion> getAllCriteria() {
|
public List<Criterion> getAllCriteria() {
|
||||||
return criteria;
|
if (allCriteria == null) {
|
||||||
|
allCriteria = new ArrayList<Criterion>();
|
||||||
|
allCriteria.addAll(criteria);
|
||||||
|
allCriteria.addAll(tagsCriteria);
|
||||||
|
}
|
||||||
|
return allCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Criterion> getCriteria() {
|
public List<Criterion> getCriteria() {
|
||||||
|
@ -88,6 +119,7 @@ public class FileMetadataExample {
|
||||||
throw new RuntimeException("Value for condition cannot be null");
|
throw new RuntimeException("Value for condition cannot be null");
|
||||||
}
|
}
|
||||||
criteria.add(new Criterion(condition));
|
criteria.add(new Criterion(condition));
|
||||||
|
allCriteria = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value, String property) {
|
protected void addCriterion(String condition, Object value, String property) {
|
||||||
|
@ -95,6 +127,7 @@ public class FileMetadataExample {
|
||||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||||
}
|
}
|
||||||
criteria.add(new Criterion(condition, value));
|
criteria.add(new Criterion(condition, value));
|
||||||
|
allCriteria = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||||
|
@ -102,6 +135,7 @@ public class FileMetadataExample {
|
||||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||||
}
|
}
|
||||||
criteria.add(new Criterion(condition, value1, value2));
|
criteria.add(new Criterion(condition, value1, value2));
|
||||||
|
allCriteria = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIdIsNull() {
|
public Criteria andIdIsNull() {
|
||||||
|
@ -784,63 +818,63 @@ public class FileMetadataExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsEqualTo(String value) {
|
public Criteria andTagsEqualTo(List<String> value) {
|
||||||
addCriterion("tags =", value, "tags");
|
addTagsCriterion("tags =", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsNotEqualTo(String value) {
|
public Criteria andTagsNotEqualTo(List<String> value) {
|
||||||
addCriterion("tags <>", value, "tags");
|
addTagsCriterion("tags <>", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsGreaterThan(String value) {
|
public Criteria andTagsGreaterThan(List<String> value) {
|
||||||
addCriterion("tags >", value, "tags");
|
addTagsCriterion("tags >", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsGreaterThanOrEqualTo(String value) {
|
public Criteria andTagsGreaterThanOrEqualTo(List<String> value) {
|
||||||
addCriterion("tags >=", value, "tags");
|
addTagsCriterion("tags >=", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsLessThan(String value) {
|
public Criteria andTagsLessThan(List<String> value) {
|
||||||
addCriterion("tags <", value, "tags");
|
addTagsCriterion("tags <", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsLessThanOrEqualTo(String value) {
|
public Criteria andTagsLessThanOrEqualTo(List<String> value) {
|
||||||
addCriterion("tags <=", value, "tags");
|
addTagsCriterion("tags <=", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsLike(String value) {
|
public Criteria andTagsLike(List<String> value) {
|
||||||
addCriterion("tags like", value, "tags");
|
addTagsCriterion("tags like", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsNotLike(String value) {
|
public Criteria andTagsNotLike(List<String> value) {
|
||||||
addCriterion("tags not like", value, "tags");
|
addTagsCriterion("tags not like", value, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsIn(List<String> values) {
|
public Criteria andTagsIn(List<List<String>> values) {
|
||||||
addCriterion("tags in", values, "tags");
|
addTagsCriterion("tags in", values, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsNotIn(List<String> values) {
|
public Criteria andTagsNotIn(List<List<String>> values) {
|
||||||
addCriterion("tags not in", values, "tags");
|
addTagsCriterion("tags not in", values, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsBetween(String value1, String value2) {
|
public Criteria andTagsBetween(List<String> value1, List<String> value2) {
|
||||||
addCriterion("tags between", value1, value2, "tags");
|
addTagsCriterion("tags between", value1, value2, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andTagsNotBetween(String value1, String value2) {
|
public Criteria andTagsNotBetween(List<String> value1, List<String> value2) {
|
||||||
addCriterion("tags not between", value1, value2, "tags");
|
addTagsCriterion("tags not between", value1, value2, "tags");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<result column="storage" jdbcType="VARCHAR" property="storage" />
|
<result column="storage" jdbcType="VARCHAR" property="storage" />
|
||||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||||
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
|
<result column="update_user" jdbcType="VARCHAR" property="updateUser" />
|
||||||
<result column="tags" jdbcType="VARCHAR" property="tags" />
|
<result column="tags" jdbcType="VARCHAR" property="tags" typeHandler="io.metersphere.handler.ListTypeHandler" />
|
||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||||
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
|
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
|
||||||
<result column="path" jdbcType="VARCHAR" property="path" />
|
<result column="path" jdbcType="VARCHAR" property="path" />
|
||||||
|
@ -45,6 +45,25 @@
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<foreach collection="criteria.tagsCriteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
</trim>
|
</trim>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -74,6 +93,25 @@
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<foreach collection="criteria.tagsCriteria" item="criterion">
|
||||||
|
<choose>
|
||||||
|
<when test="criterion.noValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.singleValue">
|
||||||
|
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.betweenValue">
|
||||||
|
and ${criterion.condition} #{criterion.value,typeHandler=io.metersphere.handler.ListTypeHandler} and #{criterion.secondValue,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
|
</when>
|
||||||
|
<when test="criterion.listValue">
|
||||||
|
and ${criterion.condition}
|
||||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||||
|
#{listItem,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
|
</foreach>
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
</trim>
|
</trim>
|
||||||
</if>
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -117,16 +155,16 @@
|
||||||
insert into file_metadata (id, `name`, `type`,
|
insert into file_metadata (id, `name`, `type`,
|
||||||
`size`, create_time, update_time,
|
`size`, create_time, update_time,
|
||||||
project_id, `storage`, create_user,
|
project_id, `storage`, create_user,
|
||||||
update_user, tags, description,
|
update_user, tags,
|
||||||
module_id, `path`, latest,
|
description, module_id, `path`,
|
||||||
`enable`, ref_id, file_version
|
latest, `enable`, ref_id, file_version
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||||
#{size,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
#{size,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
#{projectId,jdbcType=VARCHAR}, #{storage,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
|
#{projectId,jdbcType=VARCHAR}, #{storage,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
|
||||||
#{updateUser,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
#{updateUser,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
#{moduleId,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{latest,jdbcType=BIT},
|
#{description,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
|
||||||
#{enable,jdbcType=BIT}, #{refId,jdbcType=VARCHAR}, #{fileVersion,jdbcType=VARCHAR}
|
#{latest,jdbcType=BIT}, #{enable,jdbcType=BIT}, #{refId,jdbcType=VARCHAR}, #{fileVersion,jdbcType=VARCHAR}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.project.domain.FileMetadata">
|
<insert id="insertSelective" parameterType="io.metersphere.project.domain.FileMetadata">
|
||||||
|
@ -219,7 +257,7 @@
|
||||||
#{updateUser,jdbcType=VARCHAR},
|
#{updateUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="tags != null">
|
<if test="tags != null">
|
||||||
#{tags,jdbcType=VARCHAR},
|
#{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
</if>
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
#{description,jdbcType=VARCHAR},
|
#{description,jdbcType=VARCHAR},
|
||||||
|
@ -284,7 +322,7 @@
|
||||||
update_user = #{record.updateUser,jdbcType=VARCHAR},
|
update_user = #{record.updateUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.tags != null">
|
<if test="record.tags != null">
|
||||||
tags = #{record.tags,jdbcType=VARCHAR},
|
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.description != null">
|
<if test="record.description != null">
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
|
@ -324,7 +362,7 @@
|
||||||
`storage` = #{record.storage,jdbcType=VARCHAR},
|
`storage` = #{record.storage,jdbcType=VARCHAR},
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
update_user = #{record.updateUser,jdbcType=VARCHAR},
|
update_user = #{record.updateUser,jdbcType=VARCHAR},
|
||||||
tags = #{record.tags,jdbcType=VARCHAR},
|
tags = #{record.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
module_id = #{record.moduleId,jdbcType=VARCHAR},
|
||||||
`path` = #{record.path,jdbcType=VARCHAR},
|
`path` = #{record.path,jdbcType=VARCHAR},
|
||||||
|
@ -367,7 +405,7 @@
|
||||||
update_user = #{updateUser,jdbcType=VARCHAR},
|
update_user = #{updateUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="tags != null">
|
<if test="tags != null">
|
||||||
tags = #{tags,jdbcType=VARCHAR},
|
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
</if>
|
</if>
|
||||||
<if test="description != null">
|
<if test="description != null">
|
||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
|
@ -404,7 +442,7 @@
|
||||||
`storage` = #{storage,jdbcType=VARCHAR},
|
`storage` = #{storage,jdbcType=VARCHAR},
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
update_user = #{updateUser,jdbcType=VARCHAR},
|
update_user = #{updateUser,jdbcType=VARCHAR},
|
||||||
tags = #{tags,jdbcType=VARCHAR},
|
tags = #{tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
module_id = #{moduleId,jdbcType=VARCHAR},
|
module_id = #{moduleId,jdbcType=VARCHAR},
|
||||||
`path` = #{path,jdbcType=VARCHAR},
|
`path` = #{path,jdbcType=VARCHAR},
|
||||||
|
@ -424,10 +462,10 @@
|
||||||
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
|
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR},
|
||||||
#{item.size,jdbcType=BIGINT}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
|
#{item.size,jdbcType=BIGINT}, #{item.createTime,jdbcType=BIGINT}, #{item.updateTime,jdbcType=BIGINT},
|
||||||
#{item.projectId,jdbcType=VARCHAR}, #{item.storage,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR},
|
#{item.projectId,jdbcType=VARCHAR}, #{item.storage,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR},
|
||||||
#{item.updateUser,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR},
|
#{item.updateUser,jdbcType=VARCHAR}, #{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler},
|
||||||
#{item.moduleId,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR}, #{item.latest,jdbcType=BIT},
|
#{item.description,jdbcType=VARCHAR}, #{item.moduleId,jdbcType=VARCHAR}, #{item.path,jdbcType=VARCHAR},
|
||||||
#{item.enable,jdbcType=BIT}, #{item.refId,jdbcType=VARCHAR}, #{item.fileVersion,jdbcType=VARCHAR}
|
#{item.latest,jdbcType=BIT}, #{item.enable,jdbcType=BIT}, #{item.refId,jdbcType=VARCHAR},
|
||||||
)
|
#{item.fileVersion,jdbcType=VARCHAR})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="batchInsertSelective" parameterType="map">
|
<insert id="batchInsertSelective" parameterType="map">
|
||||||
|
@ -471,7 +509,7 @@
|
||||||
#{item.updateUser,jdbcType=VARCHAR}
|
#{item.updateUser,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="'tags'.toString() == column.value">
|
<if test="'tags'.toString() == column.value">
|
||||||
#{item.tags,jdbcType=VARCHAR}
|
#{item.tags,jdbcType=VARCHAR,typeHandler=io.metersphere.handler.ListTypeHandler}
|
||||||
</if>
|
</if>
|
||||||
<if test="'description'.toString() == column.value">
|
<if test="'description'.toString() == column.value">
|
||||||
#{item.description,jdbcType=VARCHAR}
|
#{item.description,jdbcType=VARCHAR}
|
||||||
|
|
|
@ -4,7 +4,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FileUpdateRequest {
|
public class FileUpdateRequest {
|
||||||
|
@ -29,4 +31,12 @@ public class FileUpdateRequest {
|
||||||
|
|
||||||
@Schema(description = "开启/关闭(目前用于jar文件)")
|
@Schema(description = "开启/关闭(目前用于jar文件)")
|
||||||
private Boolean enable;
|
private Boolean enable;
|
||||||
|
|
||||||
|
public List<String> getTags() {
|
||||||
|
if (tags == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>(tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,10 @@ package io.metersphere.project.dto.filemanagement.response;
|
||||||
|
|
||||||
import io.metersphere.project.domain.FileMetadata;
|
import io.metersphere.project.domain.FileMetadata;
|
||||||
import io.metersphere.project.domain.FileMetadataRepository;
|
import io.metersphere.project.domain.FileMetadataRepository;
|
||||||
import io.metersphere.sdk.util.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -86,8 +85,8 @@ public class FileInformationResponse {
|
||||||
this.description = fileMetadata.getDescription();
|
this.description = fileMetadata.getDescription();
|
||||||
this.moduleId = fileMetadata.getModuleId();
|
this.moduleId = fileMetadata.getModuleId();
|
||||||
this.size = fileMetadata.getSize();
|
this.size = fileMetadata.getSize();
|
||||||
if (StringUtils.isNotBlank(fileMetadata.getTags())) {
|
if (CollectionUtils.isNotEmpty(fileMetadata.getTags())) {
|
||||||
tags = JSON.parseArray(fileMetadata.getTags(), String.class);
|
tags = fileMetadata.getTags();
|
||||||
}
|
}
|
||||||
this.enable = fileMetadata.getEnable();
|
this.enable = fileMetadata.getEnable();
|
||||||
this.createTime = fileMetadata.getCreateTime();
|
this.createTime = fileMetadata.getCreateTime();
|
||||||
|
|
|
@ -22,7 +22,10 @@ import io.metersphere.sdk.exception.MSException;
|
||||||
import io.metersphere.sdk.file.FileRepository;
|
import io.metersphere.sdk.file.FileRepository;
|
||||||
import io.metersphere.sdk.file.FileRequest;
|
import io.metersphere.sdk.file.FileRequest;
|
||||||
import io.metersphere.sdk.file.MinioRepository;
|
import io.metersphere.sdk.file.MinioRepository;
|
||||||
import io.metersphere.sdk.util.*;
|
import io.metersphere.sdk.util.CommonBeanFactory;
|
||||||
|
import io.metersphere.sdk.util.GitRepositoryUtil;
|
||||||
|
import io.metersphere.sdk.util.TempFileUtils;
|
||||||
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.mapper.BaseUserMapper;
|
import io.metersphere.system.mapper.BaseUserMapper;
|
||||||
import io.metersphere.system.uid.IDGenerator;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.PageUtils;
|
import io.metersphere.system.utils.PageUtils;
|
||||||
|
@ -358,7 +361,7 @@ public class FileMetadataService {
|
||||||
updateExample.setName(request.getName());
|
updateExample.setName(request.getName());
|
||||||
}
|
}
|
||||||
if (request.getTags() != null) {
|
if (request.getTags() != null) {
|
||||||
updateExample.setTags(JSON.toJSONString(request.getTags()));
|
updateExample.setTags(request.getTags());
|
||||||
} else {
|
} else {
|
||||||
updateExample.setTags(null);
|
updateExample.setTags(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,9 +72,12 @@
|
||||||
<!--要生成的数据库表 -->
|
<!--要生成的数据库表 -->
|
||||||
<!-- <table tableName="custom_function"/>-->
|
<!-- <table tableName="custom_function"/>-->
|
||||||
<!-- <table tableName="fake_error"/>-->
|
<!-- <table tableName="fake_error"/>-->
|
||||||
<!-- <table tableName="file_metadata"/>-->
|
<table tableName="file_metadata">
|
||||||
<table tableName="file_metadata_repository"/>
|
<columnOverride column="tags" javaType="java.util.List<String>" jdbcType="VARCHAR"
|
||||||
<table tableName="file_module_repository"/>
|
typeHandler="io.metersphere.handler.ListTypeHandler"/>
|
||||||
|
</table>
|
||||||
|
<!-- <table tableName="file_metadata_repository"/>-->
|
||||||
|
<!-- <table tableName="file_module_repository"/>-->
|
||||||
<!-- <table tableName="project"/>-->
|
<!-- <table tableName="project"/>-->
|
||||||
<!-- <table tableName="project_application"/>-->
|
<!-- <table tableName="project_application"/>-->
|
||||||
<!-- <table tableName="project_version"/>-->
|
<!-- <table tableName="project_version"/>-->
|
||||||
|
|
|
@ -2428,10 +2428,10 @@ public class FileManagementControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateRequest.getTags() != null) {
|
if (updateRequest.getTags() != null) {
|
||||||
Assertions.assertTrue(CollectionUtils.isEqualCollection(JSON.parseArray(fileMetadata.getTags(), String.class), updateRequest.getTags()));
|
Assertions.assertTrue(CollectionUtils.isEqualCollection(fileMetadata.getTags(), updateRequest.getTags()));
|
||||||
} else {
|
} else {
|
||||||
List<String> fileTags = fileMetadata.getTags() == null ? new ArrayList<>() : JSON.parseArray(fileMetadata.getTags(), String.class);
|
List<String> fileTags = fileMetadata.getTags() == null ? new ArrayList<>() : fileMetadata.getTags();
|
||||||
List<String> oldTags = oldFileMetadata.getTags() == null ? new ArrayList<>() : JSON.parseArray(oldFileMetadata.getTags(), String.class);
|
List<String> oldTags = oldFileMetadata.getTags() == null ? new ArrayList<>() : oldFileMetadata.getTags();
|
||||||
Assertions.assertTrue(CollectionUtils.isEqualCollection(fileTags, oldTags));
|
Assertions.assertTrue(CollectionUtils.isEqualCollection(fileTags, oldTags));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue