refactor(项目管理): 文件模块大字段表改为文件模块存储库信息

This commit is contained in:
song-tianyang 2023-09-05 11:12:54 +08:00 committed by 刘瑞斌
parent ba70f598ea
commit c40f7e08ca
7 changed files with 226 additions and 197 deletions

View File

@ -9,32 +9,32 @@ import java.util.Arrays;
import lombok.Data; import lombok.Data;
@Data @Data
public class FileModuleBlob implements Serializable { public class FileModuleRepository implements Serializable {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "file_module_id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{file_module_blob.id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{file_module_repository.file_module_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{file_module_blob.id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{file_module_repository.file_module_id.length_range}", groups = {Created.class, Updated.class})
private String id; private String fileModuleId;
@Schema(description = "存储库路径") @Schema(title = "所属平台;GitHub/Gitlab/Gitee")
private String platform;
@Schema(title = "存储库地址")
private String repositoryPath; private String repositoryPath;
@Schema(description = "存储库Token") @Schema(title = "存储库Token;platform为Gitee时必填")
private String repositoryUserName; private String repositoryUserName;
@Schema(description = "存储库Token") @Schema(title = "存储库Token")
private String repositoryToken; private String repositoryToken;
@Schema(description = "存储库描述")
private byte[] repositoryDesc;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
id("id", "id", "VARCHAR", false), fileModuleId("file_module_id", "fileModuleId", "VARCHAR", false),
platform("platform", "platform", "VARCHAR", false),
repositoryPath("repository_path", "repositoryPath", "VARCHAR", false), repositoryPath("repository_path", "repositoryPath", "VARCHAR", false),
repositoryUserName("repository_user_name", "repositoryUserName", "VARCHAR", false), repositoryUserName("repository_user_name", "repositoryUserName", "VARCHAR", false),
repositoryToken("repository_token", "repositoryToken", "VARCHAR", false), repositoryToken("repository_token", "repositoryToken", "VARCHAR", false);
repositoryDesc("repository_desc", "repositoryDesc", "LONGVARBINARY", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -3,14 +3,14 @@ package io.metersphere.project.domain;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class FileModuleBlobExample { public class FileModuleRepositoryExample {
protected String orderByClause; protected String orderByClause;
protected boolean distinct; protected boolean distinct;
protected List<Criteria> oredCriteria; protected List<Criteria> oredCriteria;
public FileModuleBlobExample() { public FileModuleRepositoryExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
@ -104,73 +104,143 @@ public class FileModuleBlobExample {
criteria.add(new Criterion(condition, value1, value2)); criteria.add(new Criterion(condition, value1, value2));
} }
public Criteria andIdIsNull() { public Criteria andFileModuleIdIsNull() {
addCriterion("id is null"); addCriterion("file_module_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdIsNotNull() { public Criteria andFileModuleIdIsNotNull() {
addCriterion("id is not null"); addCriterion("file_module_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdEqualTo(String value) { public Criteria andFileModuleIdEqualTo(String value) {
addCriterion("id =", value, "id"); addCriterion("file_module_id =", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotEqualTo(String value) { public Criteria andFileModuleIdNotEqualTo(String value) {
addCriterion("id <>", value, "id"); addCriterion("file_module_id <>", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdGreaterThan(String value) { public Criteria andFileModuleIdGreaterThan(String value) {
addCriterion("id >", value, "id"); addCriterion("file_module_id >", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdGreaterThanOrEqualTo(String value) { public Criteria andFileModuleIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id"); addCriterion("file_module_id >=", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLessThan(String value) { public Criteria andFileModuleIdLessThan(String value) {
addCriterion("id <", value, "id"); addCriterion("file_module_id <", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLessThanOrEqualTo(String value) { public Criteria andFileModuleIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id"); addCriterion("file_module_id <=", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLike(String value) { public Criteria andFileModuleIdLike(String value) {
addCriterion("id like", value, "id"); addCriterion("file_module_id like", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotLike(String value) { public Criteria andFileModuleIdNotLike(String value) {
addCriterion("id not like", value, "id"); addCriterion("file_module_id not like", value, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdIn(List<String> values) { public Criteria andFileModuleIdIn(List<String> values) {
addCriterion("id in", values, "id"); addCriterion("file_module_id in", values, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotIn(List<String> values) { public Criteria andFileModuleIdNotIn(List<String> values) {
addCriterion("id not in", values, "id"); addCriterion("file_module_id not in", values, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdBetween(String value1, String value2) { public Criteria andFileModuleIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id"); addCriterion("file_module_id between", value1, value2, "fileModuleId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotBetween(String value1, String value2) { public Criteria andFileModuleIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id"); addCriterion("file_module_id not between", value1, value2, "fileModuleId");
return (Criteria) this;
}
public Criteria andPlatformIsNull() {
addCriterion("platform is null");
return (Criteria) this;
}
public Criteria andPlatformIsNotNull() {
addCriterion("platform is not null");
return (Criteria) this;
}
public Criteria andPlatformEqualTo(String value) {
addCriterion("platform =", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotEqualTo(String value) {
addCriterion("platform <>", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformGreaterThan(String value) {
addCriterion("platform >", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformGreaterThanOrEqualTo(String value) {
addCriterion("platform >=", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformLessThan(String value) {
addCriterion("platform <", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformLessThanOrEqualTo(String value) {
addCriterion("platform <=", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformLike(String value) {
addCriterion("platform like", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotLike(String value) {
addCriterion("platform not like", value, "platform");
return (Criteria) this;
}
public Criteria andPlatformIn(List<String> values) {
addCriterion("platform in", values, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotIn(List<String> values) {
addCriterion("platform not in", values, "platform");
return (Criteria) this;
}
public Criteria andPlatformBetween(String value1, String value2) {
addCriterion("platform between", value1, value2, "platform");
return (Criteria) this;
}
public Criteria andPlatformNotBetween(String value1, String value2) {
addCriterion("platform not between", value1, value2, "platform");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -1,40 +0,0 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.FileModuleBlob;
import io.metersphere.project.domain.FileModuleBlobExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FileModuleBlobMapper {
long countByExample(FileModuleBlobExample example);
int deleteByExample(FileModuleBlobExample example);
int deleteByPrimaryKey(String id);
int insert(FileModuleBlob record);
int insertSelective(FileModuleBlob record);
List<FileModuleBlob> selectByExampleWithBLOBs(FileModuleBlobExample example);
List<FileModuleBlob> selectByExample(FileModuleBlobExample example);
FileModuleBlob selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FileModuleBlob record, @Param("example") FileModuleBlobExample example);
int updateByExampleWithBLOBs(@Param("record") FileModuleBlob record, @Param("example") FileModuleBlobExample example);
int updateByExample(@Param("record") FileModuleBlob record, @Param("example") FileModuleBlobExample example);
int updateByPrimaryKeySelective(FileModuleBlob record);
int updateByPrimaryKeyWithBLOBs(FileModuleBlob record);
int updateByPrimaryKey(FileModuleBlob record);
int batchInsert(@Param("list") List<FileModuleBlob> list);
int batchInsertSelective(@Param("list") List<FileModuleBlob> list, @Param("selective") FileModuleBlob.Column ... selective);
}

View File

@ -0,0 +1,34 @@
package io.metersphere.project.mapper;
import io.metersphere.project.domain.FileModuleRepository;
import io.metersphere.project.domain.FileModuleRepositoryExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FileModuleRepositoryMapper {
long countByExample(FileModuleRepositoryExample example);
int deleteByExample(FileModuleRepositoryExample example);
int deleteByPrimaryKey(String fileModuleId);
int insert(FileModuleRepository record);
int insertSelective(FileModuleRepository record);
List<FileModuleRepository> selectByExample(FileModuleRepositoryExample example);
FileModuleRepository selectByPrimaryKey(String fileModuleId);
int updateByExampleSelective(@Param("record") FileModuleRepository record, @Param("example") FileModuleRepositoryExample example);
int updateByExample(@Param("record") FileModuleRepository record, @Param("example") FileModuleRepositoryExample example);
int updateByPrimaryKeySelective(FileModuleRepository record);
int updateByPrimaryKey(FileModuleRepository record);
int batchInsert(@Param("list") List<FileModuleRepository> list);
int batchInsertSelective(@Param("list") List<FileModuleRepository> list, @Param("selective") FileModuleRepository.Column ... selective);
}

View File

@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.project.mapper.FileModuleBlobMapper"> <mapper namespace="io.metersphere.project.mapper.FileModuleRepositoryMapper">
<resultMap id="BaseResultMap" type="io.metersphere.project.domain.FileModuleBlob"> <resultMap id="BaseResultMap" type="io.metersphere.project.domain.FileModuleRepository">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="file_module_id" jdbcType="VARCHAR" property="fileModuleId" />
<result column="platform" jdbcType="VARCHAR" property="platform" />
<result column="repository_path" jdbcType="VARCHAR" property="repositoryPath" /> <result column="repository_path" jdbcType="VARCHAR" property="repositoryPath" />
<result column="repository_user_name" jdbcType="VARCHAR" property="repositoryUserName" /> <result column="repository_user_name" jdbcType="VARCHAR" property="repositoryUserName" />
<result column="repository_token" jdbcType="VARCHAR" property="repositoryToken" /> <result column="repository_token" jdbcType="VARCHAR" property="repositoryToken" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.project.domain.FileModuleBlob">
<result column="repository_desc" jdbcType="LONGVARBINARY" property="repositoryDesc" />
</resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
@ -69,20 +67,15 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, repository_path, repository_user_name, repository_token file_module_id, platform, repository_path, repository_user_name, repository_token
</sql> </sql>
<sql id="Blob_Column_List"> <select id="selectByExample" parameterType="io.metersphere.project.domain.FileModuleRepositoryExample" resultMap="BaseResultMap">
repository_desc
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.project.domain.FileModuleBlobExample" resultMap="ResultMapWithBLOBs">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
</if> </if>
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
, from file_module_repository
<include refid="Blob_Column_List" />
from file_module_blob
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
@ -90,49 +83,36 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByExample" parameterType="io.metersphere.project.domain.FileModuleBlobExample" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from file_module_blob
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
, from file_module_repository
<include refid="Blob_Column_List" /> where file_module_id = #{fileModuleId,jdbcType=VARCHAR}
from file_module_blob
where id = #{id,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from file_module_blob delete from file_module_repository
where id = #{id,jdbcType=VARCHAR} where file_module_id = #{fileModuleId,jdbcType=VARCHAR}
</delete> </delete>
<delete id="deleteByExample" parameterType="io.metersphere.project.domain.FileModuleBlobExample"> <delete id="deleteByExample" parameterType="io.metersphere.project.domain.FileModuleRepositoryExample">
delete from file_module_blob delete from file_module_repository
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.project.domain.FileModuleBlob"> <insert id="insert" parameterType="io.metersphere.project.domain.FileModuleRepository">
insert into file_module_blob (id, repository_path, repository_user_name, insert into file_module_repository (file_module_id, platform, repository_path,
repository_token, repository_desc) repository_user_name, repository_token)
values (#{id,jdbcType=VARCHAR}, #{repositoryPath,jdbcType=VARCHAR}, #{repositoryUserName,jdbcType=VARCHAR}, values (#{fileModuleId,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR}, #{repositoryPath,jdbcType=VARCHAR},
#{repositoryToken,jdbcType=VARCHAR}, #{repositoryDesc,jdbcType=LONGVARBINARY}) #{repositoryUserName,jdbcType=VARCHAR}, #{repositoryToken,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.project.domain.FileModuleBlob"> <insert id="insertSelective" parameterType="io.metersphere.project.domain.FileModuleRepository">
insert into file_module_blob insert into file_module_repository
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="fileModuleId != null">
id, file_module_id,
</if>
<if test="platform != null">
platform,
</if> </if>
<if test="repositoryPath != null"> <if test="repositoryPath != null">
repository_path, repository_path,
@ -143,13 +123,13 @@
<if test="repositoryToken != null"> <if test="repositoryToken != null">
repository_token, repository_token,
</if> </if>
<if test="repositoryDesc != null">
repository_desc,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="fileModuleId != null">
#{id,jdbcType=VARCHAR}, #{fileModuleId,jdbcType=VARCHAR},
</if>
<if test="platform != null">
#{platform,jdbcType=VARCHAR},
</if> </if>
<if test="repositoryPath != null"> <if test="repositoryPath != null">
#{repositoryPath,jdbcType=VARCHAR}, #{repositoryPath,jdbcType=VARCHAR},
@ -160,22 +140,22 @@
<if test="repositoryToken != null"> <if test="repositoryToken != null">
#{repositoryToken,jdbcType=VARCHAR}, #{repositoryToken,jdbcType=VARCHAR},
</if> </if>
<if test="repositoryDesc != null">
#{repositoryDesc,jdbcType=LONGVARBINARY},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.project.domain.FileModuleBlobExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.project.domain.FileModuleRepositoryExample" resultType="java.lang.Long">
select count(*) from file_module_blob select count(*) from file_module_repository
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Example_Where_Clause" /> <include refid="Example_Where_Clause" />
</if> </if>
</select> </select>
<update id="updateByExampleSelective" parameterType="map"> <update id="updateByExampleSelective" parameterType="map">
update file_module_blob update file_module_repository
<set> <set>
<if test="record.id != null"> <if test="record.fileModuleId != null">
id = #{record.id,jdbcType=VARCHAR}, file_module_id = #{record.fileModuleId,jdbcType=VARCHAR},
</if>
<if test="record.platform != null">
platform = #{record.platform,jdbcType=VARCHAR},
</if> </if>
<if test="record.repositoryPath != null"> <if test="record.repositoryPath != null">
repository_path = #{record.repositoryPath,jdbcType=VARCHAR}, repository_path = #{record.repositoryPath,jdbcType=VARCHAR},
@ -186,28 +166,15 @@
<if test="record.repositoryToken != null"> <if test="record.repositoryToken != null">
repository_token = #{record.repositoryToken,jdbcType=VARCHAR}, repository_token = #{record.repositoryToken,jdbcType=VARCHAR},
</if> </if>
<if test="record.repositoryDesc != null">
repository_desc = #{record.repositoryDesc,jdbcType=LONGVARBINARY},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update file_module_blob
set id = #{record.id,jdbcType=VARCHAR},
repository_path = #{record.repositoryPath,jdbcType=VARCHAR},
repository_user_name = #{record.repositoryUserName,jdbcType=VARCHAR},
repository_token = #{record.repositoryToken,jdbcType=VARCHAR},
repository_desc = #{record.repositoryDesc,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update file_module_blob update file_module_repository
set id = #{record.id,jdbcType=VARCHAR}, set file_module_id = #{record.fileModuleId,jdbcType=VARCHAR},
platform = #{record.platform,jdbcType=VARCHAR},
repository_path = #{record.repositoryPath,jdbcType=VARCHAR}, repository_path = #{record.repositoryPath,jdbcType=VARCHAR},
repository_user_name = #{record.repositoryUserName,jdbcType=VARCHAR}, repository_user_name = #{record.repositoryUserName,jdbcType=VARCHAR},
repository_token = #{record.repositoryToken,jdbcType=VARCHAR} repository_token = #{record.repositoryToken,jdbcType=VARCHAR}
@ -215,9 +182,12 @@
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.FileModuleBlob"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.project.domain.FileModuleRepository">
update file_module_blob update file_module_repository
<set> <set>
<if test="platform != null">
platform = #{platform,jdbcType=VARCHAR},
</if>
<if test="repositoryPath != null"> <if test="repositoryPath != null">
repository_path = #{repositoryPath,jdbcType=VARCHAR}, repository_path = #{repositoryPath,jdbcType=VARCHAR},
</if> </if>
@ -227,39 +197,30 @@
<if test="repositoryToken != null"> <if test="repositoryToken != null">
repository_token = #{repositoryToken,jdbcType=VARCHAR}, repository_token = #{repositoryToken,jdbcType=VARCHAR},
</if> </if>
<if test="repositoryDesc != null">
repository_desc = #{repositoryDesc,jdbcType=LONGVARBINARY},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where file_module_id = #{fileModuleId,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.project.domain.FileModuleBlob"> <update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.FileModuleRepository">
update file_module_blob update file_module_repository
set repository_path = #{repositoryPath,jdbcType=VARCHAR}, set platform = #{platform,jdbcType=VARCHAR},
repository_user_name = #{repositoryUserName,jdbcType=VARCHAR}, repository_path = #{repositoryPath,jdbcType=VARCHAR},
repository_token = #{repositoryToken,jdbcType=VARCHAR},
repository_desc = #{repositoryDesc,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.project.domain.FileModuleBlob">
update file_module_blob
set repository_path = #{repositoryPath,jdbcType=VARCHAR},
repository_user_name = #{repositoryUserName,jdbcType=VARCHAR}, repository_user_name = #{repositoryUserName,jdbcType=VARCHAR},
repository_token = #{repositoryToken,jdbcType=VARCHAR} repository_token = #{repositoryToken,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where file_module_id = #{fileModuleId,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into file_module_blob insert into file_module_repository
(id, repository_path, repository_user_name, repository_token, repository_desc) (file_module_id, platform, repository_path, repository_user_name, repository_token
)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.repositoryPath,jdbcType=VARCHAR}, #{item.repositoryUserName,jdbcType=VARCHAR}, (#{item.fileModuleId,jdbcType=VARCHAR}, #{item.platform,jdbcType=VARCHAR}, #{item.repositoryPath,jdbcType=VARCHAR},
#{item.repositoryToken,jdbcType=VARCHAR}, #{item.repositoryDesc,jdbcType=LONGVARBINARY} #{item.repositoryUserName,jdbcType=VARCHAR}, #{item.repositoryToken,jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
insert into file_module_blob ( insert into file_module_repository (
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
${column.escapedColumnName} ${column.escapedColumnName}
</foreach> </foreach>
@ -268,8 +229,11 @@
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
<foreach collection="selective" item="column" separator=","> <foreach collection="selective" item="column" separator=",">
<if test="'id'.toString() == column.value"> <if test="'file_module_id'.toString() == column.value">
#{item.id,jdbcType=VARCHAR} #{item.fileModuleId,jdbcType=VARCHAR}
</if>
<if test="'platform'.toString() == column.value">
#{item.platform,jdbcType=VARCHAR}
</if> </if>
<if test="'repository_path'.toString() == column.value"> <if test="'repository_path'.toString() == column.value">
#{item.repositoryPath,jdbcType=VARCHAR} #{item.repositoryPath,jdbcType=VARCHAR}
@ -280,9 +244,6 @@
<if test="'repository_token'.toString() == column.value"> <if test="'repository_token'.toString() == column.value">
#{item.repositoryToken,jdbcType=VARCHAR} #{item.repositoryToken,jdbcType=VARCHAR}
</if> </if>
<if test="'repository_desc'.toString() == column.value">
#{item.repositoryDesc,jdbcType=LONGVARBINARY}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -234,17 +234,19 @@ CREATE INDEX idx_create_time ON project_version (create_time);
CREATE INDEX idx_create_user ON project_version (create_user); CREATE INDEX idx_create_user ON project_version (create_user);
CREATE INDEX idx_latest ON project_version (latest); CREATE INDEX idx_latest ON project_version (latest);
CREATE TABLE IF NOT EXISTS file_module_blob CREATE TABLE IF NOT EXISTS file_module_repository
( (
`id` VARCHAR(50) NOT NULL COMMENT 'ID', `file_module_id` VARCHAR(50) NOT NULL COMMENT 'file_module_id',
`repository_desc` LONGBLOB COMMENT '存储库描述', `platform` VARCHAR(10) COMMENT '所属平台;GitHub/Gitlab/Gitee',
`repository_path` VARCHAR(255) COMMENT '存储库路径', `repository_path` VARCHAR(255) COMMENT '存储库地址',
`repository_user_name` VARCHAR(255) COMMENT '存储库Token', `repository_user_name` VARCHAR(255) COMMENT '存储库Token;platform为Gitee时必填',
`repository_token` VARCHAR(255) COMMENT '存储库Token', `repository_token` VARCHAR(255) COMMENT '存储库Token',
PRIMARY KEY (id) PRIMARY KEY (file_module_id)
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '文件管理模块大字段'; COLLATE = utf8mb4_general_ci
COMMENT = '文件存储库模块';
CREATE TABLE IF NOT EXISTS custom_function_blob CREATE TABLE IF NOT EXISTS custom_function_blob
( (

View File

@ -1,6 +1,9 @@
package io.metersphere.sdk.config.interceptor; package io.metersphere.sdk.config.interceptor;
import io.metersphere.project.domain.*; import io.metersphere.project.domain.CustomFieldTemplate;
import io.metersphere.project.domain.CustomFunctionBlob;
import io.metersphere.project.domain.FakeErrorBlob;
import io.metersphere.project.domain.FileMetadataBlob;
import io.metersphere.sdk.util.CompressUtils; import io.metersphere.sdk.util.CompressUtils;
import io.metersphere.sdk.util.MybatisInterceptorConfig; import io.metersphere.sdk.util.MybatisInterceptorConfig;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -15,7 +18,6 @@ public class ProjectInterceptor {
public List<MybatisInterceptorConfig> projectCompressConfigs() { public List<MybatisInterceptorConfig> projectCompressConfigs() {
List<MybatisInterceptorConfig> configList = new ArrayList<>(); List<MybatisInterceptorConfig> configList = new ArrayList<>();
configList.add(new MybatisInterceptorConfig(FileModuleBlob.class, "repositoryDesc", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(FileMetadataBlob.class, "gitInfo", CompressUtils.class, "zip", "unzip")); configList.add(new MybatisInterceptorConfig(FileMetadataBlob.class, "gitInfo", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(FakeErrorBlob.class, "description", CompressUtils.class, "zip", "unzip")); configList.add(new MybatisInterceptorConfig(FakeErrorBlob.class, "description", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(FakeErrorBlob.class, "content", CompressUtils.class, "zip", "unzip")); configList.add(new MybatisInterceptorConfig(FakeErrorBlob.class, "content", CompressUtils.class, "zip", "unzip"));