feat(测试计划): 接口分享查看左侧模块树接口

--task=1016645 --user=宋昌昌 【接口测试】接口文档-后端 https://www.tapd.cn/55049933/s/1591755
This commit is contained in:
song-cc-rock 2024-10-14 18:33:04 +08:00 committed by Craftsman
parent cfa6bee542
commit 58b9a85050
17 changed files with 224 additions and 77 deletions

View File

@ -24,15 +24,14 @@ public class ApiDocShare implements Serializable {
@Size(min = 1, max = 255, message = "{api_doc_share.name.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 255, message = "{api_doc_share.name.length_range}", groups = {Created.class, Updated.class})
private String name; private String name;
@Schema(title = "是否公开;0: 私有、1: 公开", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "是否私有;0: 公开、1: 私有", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_doc_share.is_public.not_blank}", groups = {Created.class}) @NotNull(message = "{api_doc_share.is_private.not_blank}", groups = {Created.class})
private Boolean isPublic; private Boolean isPrivate;
@Schema(title = "访问密码;私有时需要访问密码") @Schema(title = "访问密码;私有时需要访问密码")
private String password; private String password;
@Schema(title = "允许导出;0: 不允许、1: 允许", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "允许导出;0: 不允许、1: 允许")
@NotNull(message = "{api_doc_share.allow_export.not_blank}", groups = {Created.class})
private Boolean allowExport; private Boolean allowExport;
@Schema(title = "接口范围;全部接口(ALL)、模块(MODULE)、路径(PATH)、标签(TAG)", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "接口范围;全部接口(ALL)、模块(MODULE)、路径(PATH)、标签(TAG)", requiredMode = Schema.RequiredMode.REQUIRED)
@ -68,7 +67,7 @@ public class ApiDocShare implements Serializable {
public enum Column { public enum Column {
id("id", "id", "VARCHAR", false), id("id", "id", "VARCHAR", false),
name("name", "name", "VARCHAR", true), name("name", "name", "VARCHAR", true),
isPublic("is_public", "isPublic", "BIT", false), isPrivate("is_private", "isPrivate", "BIT", false),
password("password", "password", "VARCHAR", true), password("password", "password", "VARCHAR", true),
allowExport("allow_export", "allowExport", "BIT", false), allowExport("allow_export", "allowExport", "BIT", false),
apiRange("api_range", "apiRange", "VARCHAR", false), apiRange("api_range", "apiRange", "VARCHAR", false),

View File

@ -244,63 +244,63 @@ public class ApiDocShareExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicIsNull() { public Criteria andIsPrivateIsNull() {
addCriterion("is_public is null"); addCriterion("is_private is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicIsNotNull() { public Criteria andIsPrivateIsNotNull() {
addCriterion("is_public is not null"); addCriterion("is_private is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicEqualTo(Boolean value) { public Criteria andIsPrivateEqualTo(Boolean value) {
addCriterion("is_public =", value, "isPublic"); addCriterion("is_private =", value, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicNotEqualTo(Boolean value) { public Criteria andIsPrivateNotEqualTo(Boolean value) {
addCriterion("is_public <>", value, "isPublic"); addCriterion("is_private <>", value, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicGreaterThan(Boolean value) { public Criteria andIsPrivateGreaterThan(Boolean value) {
addCriterion("is_public >", value, "isPublic"); addCriterion("is_private >", value, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicGreaterThanOrEqualTo(Boolean value) { public Criteria andIsPrivateGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_public >=", value, "isPublic"); addCriterion("is_private >=", value, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicLessThan(Boolean value) { public Criteria andIsPrivateLessThan(Boolean value) {
addCriterion("is_public <", value, "isPublic"); addCriterion("is_private <", value, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicLessThanOrEqualTo(Boolean value) { public Criteria andIsPrivateLessThanOrEqualTo(Boolean value) {
addCriterion("is_public <=", value, "isPublic"); addCriterion("is_private <=", value, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicIn(List<Boolean> values) { public Criteria andIsPrivateIn(List<Boolean> values) {
addCriterion("is_public in", values, "isPublic"); addCriterion("is_private in", values, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicNotIn(List<Boolean> values) { public Criteria andIsPrivateNotIn(List<Boolean> values) {
addCriterion("is_public not in", values, "isPublic"); addCriterion("is_private not in", values, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicBetween(Boolean value1, Boolean value2) { public Criteria andIsPrivateBetween(Boolean value1, Boolean value2) {
addCriterion("is_public between", value1, value2, "isPublic"); addCriterion("is_private between", value1, value2, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIsPublicNotBetween(Boolean value1, Boolean value2) { public Criteria andIsPrivateNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_public not between", value1, value2, "isPublic"); addCriterion("is_private not between", value1, value2, "isPrivate");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="io.metersphere.api.domain.ApiDocShare"> <resultMap id="BaseResultMap" type="io.metersphere.api.domain.ApiDocShare">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="is_public" jdbcType="BIT" property="isPublic" /> <result column="is_private" jdbcType="BIT" property="isPrivate" />
<result column="password" jdbcType="VARCHAR" property="password" /> <result column="password" jdbcType="VARCHAR" property="password" />
<result column="allow_export" jdbcType="BIT" property="allowExport" /> <result column="allow_export" jdbcType="BIT" property="allowExport" />
<result column="api_range" jdbcType="VARCHAR" property="apiRange" /> <result column="api_range" jdbcType="VARCHAR" property="apiRange" />
@ -75,8 +75,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `name`, is_public, `password`, allow_export, api_range, range_match_symbol, range_match_val, id, `name`, is_private, `password`, allow_export, api_range, range_match_symbol,
invalid_time, invalid_unit, project_id, create_time, create_user range_match_val, invalid_time, invalid_unit, project_id, create_time, create_user
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.api.domain.ApiDocShareExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.api.domain.ApiDocShareExample" resultMap="BaseResultMap">
select select
@ -109,12 +109,12 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.api.domain.ApiDocShare"> <insert id="insert" parameterType="io.metersphere.api.domain.ApiDocShare">
insert into api_doc_share (id, `name`, is_public, insert into api_doc_share (id, `name`, is_private,
`password`, allow_export, api_range, `password`, allow_export, api_range,
range_match_symbol, range_match_val, invalid_time, range_match_symbol, range_match_val, invalid_time,
invalid_unit, project_id, create_time, invalid_unit, project_id, create_time,
create_user) create_user)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{isPublic,jdbcType=BIT}, values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{isPrivate,jdbcType=BIT},
#{password,jdbcType=VARCHAR}, #{allowExport,jdbcType=BIT}, #{apiRange,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{allowExport,jdbcType=BIT}, #{apiRange,jdbcType=VARCHAR},
#{rangeMatchSymbol,jdbcType=VARCHAR}, #{rangeMatchVal,jdbcType=VARCHAR}, #{invalidTime,jdbcType=INTEGER}, #{rangeMatchSymbol,jdbcType=VARCHAR}, #{rangeMatchVal,jdbcType=VARCHAR}, #{invalidTime,jdbcType=INTEGER},
#{invalidUnit,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{invalidUnit,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
@ -129,8 +129,8 @@
<if test="name != null"> <if test="name != null">
`name`, `name`,
</if> </if>
<if test="isPublic != null"> <if test="isPrivate != null">
is_public, is_private,
</if> </if>
<if test="password != null"> <if test="password != null">
`password`, `password`,
@ -170,8 +170,8 @@
<if test="name != null"> <if test="name != null">
#{name,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
</if> </if>
<if test="isPublic != null"> <if test="isPrivate != null">
#{isPublic,jdbcType=BIT}, #{isPrivate,jdbcType=BIT},
</if> </if>
<if test="password != null"> <if test="password != null">
#{password,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
@ -220,8 +220,8 @@
<if test="record.name != null"> <if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
</if> </if>
<if test="record.isPublic != null"> <if test="record.isPrivate != null">
is_public = #{record.isPublic,jdbcType=BIT}, is_private = #{record.isPrivate,jdbcType=BIT},
</if> </if>
<if test="record.password != null"> <if test="record.password != null">
`password` = #{record.password,jdbcType=VARCHAR}, `password` = #{record.password,jdbcType=VARCHAR},
@ -262,7 +262,7 @@
update api_doc_share update api_doc_share
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
is_public = #{record.isPublic,jdbcType=BIT}, is_private = #{record.isPrivate,jdbcType=BIT},
`password` = #{record.password,jdbcType=VARCHAR}, `password` = #{record.password,jdbcType=VARCHAR},
allow_export = #{record.allowExport,jdbcType=BIT}, allow_export = #{record.allowExport,jdbcType=BIT},
api_range = #{record.apiRange,jdbcType=VARCHAR}, api_range = #{record.apiRange,jdbcType=VARCHAR},
@ -283,8 +283,8 @@
<if test="name != null"> <if test="name != null">
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="isPublic != null"> <if test="isPrivate != null">
is_public = #{isPublic,jdbcType=BIT}, is_private = #{isPrivate,jdbcType=BIT},
</if> </if>
<if test="password != null"> <if test="password != null">
`password` = #{password,jdbcType=VARCHAR}, `password` = #{password,jdbcType=VARCHAR},
@ -322,7 +322,7 @@
<update id="updateByPrimaryKey" parameterType="io.metersphere.api.domain.ApiDocShare"> <update id="updateByPrimaryKey" parameterType="io.metersphere.api.domain.ApiDocShare">
update api_doc_share update api_doc_share
set `name` = #{name,jdbcType=VARCHAR}, set `name` = #{name,jdbcType=VARCHAR},
is_public = #{isPublic,jdbcType=BIT}, is_private = #{isPrivate,jdbcType=BIT},
`password` = #{password,jdbcType=VARCHAR}, `password` = #{password,jdbcType=VARCHAR},
allow_export = #{allowExport,jdbcType=BIT}, allow_export = #{allowExport,jdbcType=BIT},
api_range = #{apiRange,jdbcType=VARCHAR}, api_range = #{apiRange,jdbcType=VARCHAR},
@ -337,12 +337,12 @@
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into api_doc_share insert into api_doc_share
(id, `name`, is_public, `password`, allow_export, api_range, range_match_symbol, (id, `name`, is_private, `password`, allow_export, api_range, range_match_symbol,
range_match_val, invalid_time, invalid_unit, project_id, create_time, create_user range_match_val, invalid_time, invalid_unit, project_id, create_time, create_user
) )
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.isPublic,jdbcType=BIT}, (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.isPrivate,jdbcType=BIT},
#{item.password,jdbcType=VARCHAR}, #{item.allowExport,jdbcType=BIT}, #{item.apiRange,jdbcType=VARCHAR}, #{item.password,jdbcType=VARCHAR}, #{item.allowExport,jdbcType=BIT}, #{item.apiRange,jdbcType=VARCHAR},
#{item.rangeMatchSymbol,jdbcType=VARCHAR}, #{item.rangeMatchVal,jdbcType=VARCHAR}, #{item.rangeMatchSymbol,jdbcType=VARCHAR}, #{item.rangeMatchVal,jdbcType=VARCHAR},
#{item.invalidTime,jdbcType=INTEGER}, #{item.invalidUnit,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR}, #{item.invalidTime,jdbcType=INTEGER}, #{item.invalidUnit,jdbcType=VARCHAR}, #{item.projectId,jdbcType=VARCHAR},
@ -365,8 +365,8 @@
<if test="'name'.toString() == column.value"> <if test="'name'.toString() == column.value">
#{item.name,jdbcType=VARCHAR} #{item.name,jdbcType=VARCHAR}
</if> </if>
<if test="'is_public'.toString() == column.value"> <if test="'is_private'.toString() == column.value">
#{item.isPublic,jdbcType=BIT} #{item.isPrivate,jdbcType=BIT}
</if> </if>
<if test="'password'.toString() == column.value"> <if test="'password'.toString() == column.value">
#{item.password,jdbcType=VARCHAR} #{item.password,jdbcType=VARCHAR}

View File

@ -82,7 +82,7 @@ CREATE INDEX idx_num ON schedule(`num`);
CREATE TABLE api_doc_share ( CREATE TABLE api_doc_share (
`id` VARCHAR(50) NOT NULL COMMENT '主键' , `id` VARCHAR(50) NOT NULL COMMENT '主键' ,
`name` VARCHAR(255) NOT NULL COMMENT '名称' , `name` VARCHAR(255) NOT NULL COMMENT '名称' ,
`is_public` BIT(1) NOT NULL DEFAULT 0 COMMENT '是否公开; 0: 私有、1: 公开' , `is_private` BIT(1) NOT NULL DEFAULT 0 COMMENT '是否私有;0: 公开、1: 私有' ,
`password` VARCHAR(10) COMMENT '访问密码; 私有时需要访问密码' , `password` VARCHAR(10) COMMENT '访问密码; 私有时需要访问密码' ,
`allow_export` BIT(1) NOT NULL DEFAULT 0 COMMENT '允许导出; 0: 不允许、1: 允许' , `allow_export` BIT(1) NOT NULL DEFAULT 0 COMMENT '允许导出; 0: 不允许、1: 允许' ,
`api_range` VARCHAR(10) NOT NULL DEFAULT 'ALL' COMMENT '接口范围; 全部接口(ALL)、模块(MODULE)、路径(PATH)、标签(TAG)' , `api_range` VARCHAR(10) NOT NULL DEFAULT 'ALL' COMMENT '接口范围; 全部接口(ALL)、模块(MODULE)、路径(PATH)、标签(TAG)' ,

View File

@ -456,8 +456,8 @@ api_doc_share.id.not_blank=主键不能为空
api_doc_share.id.length_range=主键长度必须在{min}和{max}之间 api_doc_share.id.length_range=主键长度必须在{min}和{max}之间
api_doc_share.name.not_blank=名称不能为空 api_doc_share.name.not_blank=名称不能为空
api_doc_share.name.length_range=名称长度必须在{min}和{max}之间 api_doc_share.name.length_range=名称长度必须在{min}和{max}之间
api_doc_share.is_public.not_blank=是否公开不能为空 api_doc_share.is_private.not_blank=是否公开不能为空
api_doc_share.is_public.length_range=是否公开长度必须在{min}和{max}之间 api_doc_share.is_private.length_range=是否公开长度必须在{min}和{max}之间
api_doc_share.allow_export.not_blank=允许导出不能為空 api_doc_share.allow_export.not_blank=允许导出不能為空
api_doc_share.allow_export.length_range=允许导出長度必須在{min}和{max}之间 api_doc_share.allow_export.length_range=允许导出長度必須在{min}和{max}之间
api_doc_share.api_range.not_blank=接口范围不能为空 api_doc_share.api_range.not_blank=接口范围不能为空

View File

@ -467,8 +467,8 @@ api_doc_share.id.not_blank=id cannot be empty
api_doc_share.id.length_range=id length must be between {min} and {max} api_doc_share.id.length_range=id length must be between {min} and {max}
api_doc_share.name.not_blank=name cannot be empty api_doc_share.name.not_blank=name cannot be empty
api_doc_share.name.length_range=name length must be between {min} and {max} api_doc_share.name.length_range=name length must be between {min} and {max}
api_doc_share.is_public.not_blank=isPublic cannot be empty api_doc_share.is_private.not_blank=isPublic cannot be empty
api_doc_share.is_public.length_range=isPublic length must be between {min} and {max} api_doc_share.is_private.length_range=isPublic length must be between {min} and {max}
api_doc_share.allow_export.not_blank=allowExport cannot be empty api_doc_share.allow_export.not_blank=allowExport cannot be empty
api_doc_share.allow_export.length_range=allowExport length must be between {min} and {max} api_doc_share.allow_export.length_range=allowExport length must be between {min} and {max}
api_doc_share.api_range.not_blank=apiRange cannot be empty api_doc_share.api_range.not_blank=apiRange cannot be empty

View File

@ -435,8 +435,8 @@ api_doc_share.id.not_blank=主键不能为空
api_doc_share.id.length_range=主键长度必须在{min}和{max}之间 api_doc_share.id.length_range=主键长度必须在{min}和{max}之间
api_doc_share.name.not_blank=名称不能为空 api_doc_share.name.not_blank=名称不能为空
api_doc_share.name.length_range=名称长度必须在{min}和{max}之间 api_doc_share.name.length_range=名称长度必须在{min}和{max}之间
api_doc_share.is_public.not_blank=是否公开不能为空 api_doc_share.is_private.not_blank=是否公开不能为空
api_doc_share.is_public.length_range=是否公开长度必须在{min}和{max}之间 api_doc_share.is_private.length_range=是否公开长度必须在{min}和{max}之间
api_doc_share.allow_export.not_blank=允许导出不能為空 api_doc_share.allow_export.not_blank=允许导出不能為空
api_doc_share.allow_export.length_range=允许导出長度必須在{min}和{max}之间 api_doc_share.allow_export.length_range=允许导出長度必須在{min}和{max}之间
api_doc_share.api_range.not_blank=接口范围不能为空 api_doc_share.api_range.not_blank=接口范围不能为空

View File

@ -435,8 +435,8 @@ api_doc_share.id.not_blank=主键不能為空
api_doc_share.id.length_range=主键長度必須在{min}和{max}之间 api_doc_share.id.length_range=主键長度必須在{min}和{max}之间
api_doc_share.name.not_blank=名称不能為空 api_doc_share.name.not_blank=名称不能為空
api_doc_share.name.length_range=名称長度必須在{min}和{max}之间 api_doc_share.name.length_range=名称長度必須在{min}和{max}之间
api_doc_share.is_public.not_blank=是否公开不能為空 api_doc_share.is_private.not_blank=是否公开不能為空
api_doc_share.is_public.length_range=是否公开長度必須在{min}和{max}之间 api_doc_share.is_private.length_range=是否公开長度必須在{min}和{max}之间
api_doc_share.allow_export.not_blank=允许导出不能為空 api_doc_share.allow_export.not_blank=允许导出不能為空
api_doc_share.allow_export.length_range=允许导出長度必須在{min}和{max}之间 api_doc_share.allow_export.length_range=允许导出長度必須在{min}和{max}之间
api_doc_share.api_range.not_blank=接口范围不能為空 api_doc_share.api_range.not_blank=接口范围不能為空

View File

@ -7,10 +7,12 @@ import io.metersphere.api.dto.definition.ApiDocShareDTO;
import io.metersphere.api.dto.definition.ApiDocShareDetail; import io.metersphere.api.dto.definition.ApiDocShareDetail;
import io.metersphere.api.dto.definition.request.ApiDocShareCheckRequest; import io.metersphere.api.dto.definition.request.ApiDocShareCheckRequest;
import io.metersphere.api.dto.definition.request.ApiDocShareEditRequest; import io.metersphere.api.dto.definition.request.ApiDocShareEditRequest;
import io.metersphere.api.dto.definition.request.ApiDocShareModuleRequest;
import io.metersphere.api.dto.definition.request.ApiDocSharePageRequest; import io.metersphere.api.dto.definition.request.ApiDocSharePageRequest;
import io.metersphere.api.service.definition.ApiDocShareLogService; import io.metersphere.api.service.definition.ApiDocShareLogService;
import io.metersphere.api.service.definition.ApiDocShareService; import io.metersphere.api.service.definition.ApiDocShareService;
import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.system.dto.sdk.BaseTreeNode;
import io.metersphere.system.log.annotation.Log; import io.metersphere.system.log.annotation.Log;
import io.metersphere.system.log.constants.OperationLogType; import io.metersphere.system.log.constants.OperationLogType;
import io.metersphere.system.security.CheckOwner; import io.metersphere.system.security.CheckOwner;
@ -30,20 +32,21 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author song-cc-rock * @author song-cc-rock
*/ */
@RestController @RestController
@RequestMapping(value = "/api/doc/share") @RequestMapping(value = "/api/doc/share")
@Tag(name = "接口测试-接口管理-分享") @Tag(name = "接口测试-接口管理-接口定义-分享")
public class ApiDocShareController { public class ApiDocShareController {
@Resource @Resource
private ApiDocShareService apiDocShareService; private ApiDocShareService apiDocShareService;
@PostMapping(value = "/page") @PostMapping(value = "/page")
@Operation(summary = "接口测试-接口管理-分页获取分享列表") @Operation(summary = "接口测试-接口管理-接口定义-分页获取分享列表")
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE) @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE)
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public Pager<List<ApiDocShareDTO>> page(@Validated @RequestBody ApiDocSharePageRequest request) { public Pager<List<ApiDocShareDTO>> page(@Validated @RequestBody ApiDocSharePageRequest request) {
@ -53,7 +56,7 @@ public class ApiDocShareController {
} }
@PostMapping(value = "/add") @PostMapping(value = "/add")
@Operation(summary = "接口测试-接口管理-新增分享") @Operation(summary = "接口测试-接口管理-接口定义-新增分享")
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE) @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE)
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
@Log(type = OperationLogType.ADD, expression = "#msClass.addLog(#request)", msClass = ApiDocShareLogService.class) @Log(type = OperationLogType.ADD, expression = "#msClass.addLog(#request)", msClass = ApiDocShareLogService.class)
@ -62,7 +65,7 @@ public class ApiDocShareController {
} }
@PostMapping(value = "/update") @PostMapping(value = "/update")
@Operation(summary = "接口测试-接口管理-更新分享") @Operation(summary = "接口测试-接口管理-接口定义-更新分享")
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE) @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE)
@CheckOwner(resourceId = "#request.getId()", resourceType = "api_doc_share") @CheckOwner(resourceId = "#request.getId()", resourceType = "api_doc_share")
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#request)", msClass = ApiDocShareLogService.class) @Log(type = OperationLogType.UPDATE, expression = "#msClass.updateLog(#request)", msClass = ApiDocShareLogService.class)
@ -71,7 +74,7 @@ public class ApiDocShareController {
} }
@GetMapping("/delete/{id}") @GetMapping("/delete/{id}")
@Operation(summary = "接口测试-接口管理-删除分享") @Operation(summary = "接口测试-接口管理-接口定义-删除分享")
@Parameter(name = "id", description = "分享ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) @Parameter(name = "id", description = "分享ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE) @RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_DOC_SHARE)
@CheckOwner(resourceId = "#id", resourceType = "api_doc_share") @CheckOwner(resourceId = "#id", resourceType = "api_doc_share")
@ -81,15 +84,27 @@ public class ApiDocShareController {
} }
@PostMapping("/check") @PostMapping("/check")
@Operation(summary = "接口测试-接口管理-校验分享密码") @Operation(summary = "接口测试-接口管理-接口定义-校验分享密码")
public Boolean delete(@Validated @RequestBody ApiDocShareCheckRequest request) { public Boolean delete(@Validated @RequestBody ApiDocShareCheckRequest request) {
return apiDocShareService.check(request); return apiDocShareService.check(request);
} }
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
@Operation(summary = "接口测试-接口管理-查看链接") @Operation(summary = "接口测试-接口管理-接口定义-查看链接")
@Parameter(name = "id", description = "分享ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED)) @Parameter(name = "id", description = "分享ID", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED))
public ApiDocShareDetail detail(@PathVariable String id) { public ApiDocShareDetail detail(@PathVariable String id) {
return apiDocShareService.detail(id); return apiDocShareService.detail(id);
} }
@PostMapping("/module/tree")
@Operation(summary = "接口测试-接口管理-接口定义-模块树")
public List<BaseTreeNode> getShareDocTree(@Validated @RequestBody ApiDocShareModuleRequest request) {
return apiDocShareService.getShareTree(request);
}
@PostMapping("/module/count")
@Operation(summary = "接口测试-接口管理-接口定义-模块树数量")
public Map<String, Long> getShareDocTreeCount(@Validated @RequestBody ApiDocShareModuleRequest request) {
return apiDocShareService.getShareTreeCount(request);
}
} }

View File

@ -5,6 +5,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
/**
* @author song-cc-rock
*/
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class ApiDocShareDTO extends ApiDocShare { public class ApiDocShareDTO extends ApiDocShare {

View File

@ -16,7 +16,7 @@ public class ApiDocShareDetail implements Serializable {
@Schema(title = "是否失效") @Schema(title = "是否失效")
private Boolean invalid; private Boolean invalid;
@Schema(title = "是否公开") @Schema(title = "是否公开")
private Boolean isPublic; private Boolean isPrivate;
@Schema(title = "是否允许导出") @Schema(title = "是否允许导出")
private Boolean allowExport; private Boolean allowExport;
} }

View File

@ -19,7 +19,7 @@ public class ApiDocShareEditRequest implements Serializable {
@Schema(title = "主键", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_doc_share.id.not_blank}", groups = {Updated.class}) @NotBlank(message = "{api_doc_share.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{api_doc_share.id.length_range}", groups = {Created.class, Updated.class}) @Size(min = 1, max = 50, message = "{api_doc_share.id.length_range}", groups = {Updated.class})
private String id; private String id;
@Schema(description = "分享名称", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "分享名称", requiredMode = Schema.RequiredMode.REQUIRED)
@ -44,9 +44,9 @@ public class ApiDocShareEditRequest implements Serializable {
@Schema(title = "失效时间单位;小时(HOUR)、天(DAY)、月(MONTH)、年(YEAR)") @Schema(title = "失效时间单位;小时(HOUR)、天(DAY)、月(MONTH)、年(YEAR)")
private String invalidUnit; private String invalidUnit;
@Schema(title = "是否公开;0: 私有、1: 公开", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(title = "是否私有;0: 公开、1: 私有", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{api_doc_share.is_public.not_blank}", groups = {Created.class}) @NotNull(message = "{api_doc_share.is_private.not_blank}", groups = {Created.class})
private Boolean isPublic; private Boolean isPrivate;
@Schema(title = "访问密码;私有时需要访问密码") @Schema(title = "访问密码;私有时需要访问密码")
private String password; private String password;

View File

@ -0,0 +1,19 @@
package io.metersphere.api.dto.definition.request;
import io.metersphere.api.dto.definition.ApiModuleRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
/**
* @author song-cc-rock
*/
@Data
public class ApiDocShareModuleRequest extends ApiModuleRequest {
@Schema(description = "分享ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_doc_share.id.not_blank}")
@Size(min = 1, max = 50, message = "{api_doc_share.id.length_range}")
private String shareId;
}

View File

@ -7,6 +7,7 @@ import io.metersphere.project.dto.ModuleCountDTO;
import io.metersphere.project.dto.NodeSortQueryParam; import io.metersphere.project.dto.NodeSortQueryParam;
import io.metersphere.system.dto.sdk.BaseModule; import io.metersphere.system.dto.sdk.BaseModule;
import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.dto.sdk.BaseTreeNode;
import io.metersphere.system.interceptor.BaseConditionFilter;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -28,8 +29,10 @@ public interface ExtApiDefinitionModuleMapper {
BaseModule selectModuleByParentIdAndPosOperator(NodeSortQueryParam nodeSortQueryParam); BaseModule selectModuleByParentIdAndPosOperator(NodeSortQueryParam nodeSortQueryParam);
@BaseConditionFilter
List<ApiTreeNode> selectApiDataByRequest(@Param("request") ApiModuleRequest request, @Param("deleted") boolean deleted); List<ApiTreeNode> selectApiDataByRequest(@Param("request") ApiModuleRequest request, @Param("deleted") boolean deleted);
@BaseConditionFilter
List<ModuleCountDTO> countModuleIdByRequest(@Param("request") ApiModuleRequest request, @Param("deleted") boolean deleted, @Param("isRepeat") boolean isRepeat); List<ModuleCountDTO> countModuleIdByRequest(@Param("request") ApiModuleRequest request, @Param("deleted") boolean deleted, @Param("isRepeat") boolean isRepeat);
List<BaseTreeNode> selectNodeByIds(@Param("ids") List<String> ids); List<BaseTreeNode> selectNodeByIds(@Param("ids") List<String> ids);

View File

@ -4,7 +4,7 @@
<mapper namespace="io.metersphere.api.mapper.ExtApiDocShareMapper"> <mapper namespace="io.metersphere.api.mapper.ExtApiDocShareMapper">
<select id="list" resultType="io.metersphere.api.dto.definition.ApiDocShareDTO"> <select id="list" resultType="io.metersphere.api.dto.definition.ApiDocShareDTO">
select id, name, is_public isPublic, create_user createUser, create_time createTime, select id, name, is_private isPrivate, create_user createUser, create_time createTime,
api_range apiRange, range_match_symbol rangeMatchSymbol, range_match_val rangeMatchVal, api_range apiRange, range_match_symbol rangeMatchSymbol, range_match_val rangeMatchVal,
invalid_time invalidTime, invalid_unit invalidUnit, project_id projectId invalid_time invalidTime, invalid_unit invalidUnit, project_id projectId
from api_doc_share from api_doc_share

View File

@ -5,21 +5,27 @@ import io.metersphere.api.dto.definition.ApiDocShareDTO;
import io.metersphere.api.dto.definition.ApiDocShareDetail; import io.metersphere.api.dto.definition.ApiDocShareDetail;
import io.metersphere.api.dto.definition.request.ApiDocShareCheckRequest; import io.metersphere.api.dto.definition.request.ApiDocShareCheckRequest;
import io.metersphere.api.dto.definition.request.ApiDocShareEditRequest; import io.metersphere.api.dto.definition.request.ApiDocShareEditRequest;
import io.metersphere.api.dto.definition.request.ApiDocShareModuleRequest;
import io.metersphere.api.dto.definition.request.ApiDocSharePageRequest; import io.metersphere.api.dto.definition.request.ApiDocSharePageRequest;
import io.metersphere.api.mapper.ApiDocShareMapper; import io.metersphere.api.mapper.ApiDocShareMapper;
import io.metersphere.api.mapper.ExtApiDefinitionMapper; import io.metersphere.api.mapper.ExtApiDefinitionMapper;
import io.metersphere.api.mapper.ExtApiDocShareMapper; import io.metersphere.api.mapper.ExtApiDocShareMapper;
import io.metersphere.sdk.constants.MsAssertionCondition; import io.metersphere.sdk.constants.MsAssertionCondition;
import io.metersphere.sdk.dto.CombineCondition;
import io.metersphere.sdk.dto.CombineSearch;
import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.Translator; import io.metersphere.sdk.util.Translator;
import io.metersphere.system.dto.sdk.BaseTreeNode;
import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils; 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 java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author song-cc-rock * @author song-cc-rock
@ -35,6 +41,8 @@ public class ApiDocShareService {
private ApiDocShareMapper apiDocShareMapper; private ApiDocShareMapper apiDocShareMapper;
@Resource @Resource
private ExtApiDocShareMapper extApiDocShareMapper; private ExtApiDocShareMapper extApiDocShareMapper;
@Resource
private ApiDefinitionModuleService apiDefinitionModuleService;
public static final String RANGE_ALL = "ALL"; public static final String RANGE_ALL = "ALL";
@ -106,7 +114,7 @@ public class ApiDocShareService {
*/ */
public ApiDocShareDetail detail(String id) { public ApiDocShareDetail detail(String id) {
ApiDocShare docShare = checkExit(id); ApiDocShare docShare = checkExit(id);
ApiDocShareDetail detail = ApiDocShareDetail.builder().allowExport(docShare.getAllowExport()).isPublic(docShare.getIsPublic()).build(); ApiDocShareDetail detail = ApiDocShareDetail.builder().allowExport(docShare.getAllowExport()).isPrivate(docShare.getIsPrivate()).build();
if (docShare.getInvalidTime() == null || StringUtils.isBlank(docShare.getInvalidUnit())) { if (docShare.getInvalidTime() == null || StringUtils.isBlank(docShare.getInvalidUnit())) {
detail.setInvalid(false); detail.setInvalid(false);
} else { } else {
@ -116,6 +124,26 @@ public class ApiDocShareService {
return detail; return detail;
} }
/**
* 查询分享左侧模块树
* @param request 请求参数
* @return 模块树
*/
public List<BaseTreeNode> getShareTree(ApiDocShareModuleRequest request) {
ApiDocShare docShare = checkExit(request.getShareId());
return apiDefinitionModuleService.getTree(buildModuleParam(request, docShare), false, true);
}
/**
* 查询分享左侧模块树节点数量
* @param request 请求参数
* @return 模块树节点数量
*/
public Map<String, Long> getShareTreeCount(ApiDocShareModuleRequest request) {
ApiDocShare docShare = checkExit(request.getShareId());
return apiDefinitionModuleService.moduleCount(buildModuleParam(request, docShare), false);
}
/** /**
* 构建分享额外信息 * 构建分享额外信息
* @param docShares 分享列表 * @param docShares 分享列表
@ -162,6 +190,41 @@ public class ApiDocShareService {
return extApiDefinitionMapper.countByShareParam(docShare.getProjectId(), condition.toString()).intValue(); return extApiDefinitionMapper.countByShareParam(docShare.getProjectId(), condition.toString()).intValue();
} }
/**
* 构建模块树查询参数
* @param request 查询参数
* @param docShare 分享对象
* @return 模块树查询参数
*/
public ApiDocShareModuleRequest buildModuleParam(ApiDocShareModuleRequest request, ApiDocShare docShare) {
// 设置接口范围查询条件
if (!StringUtils.equals(docShare.getApiRange(), RANGE_ALL) && !StringUtils.isBlank(docShare.getRangeMatchVal())) {
CombineSearch combineSearch = new CombineSearch();
switch (docShare.getApiRange()) {
case "MODULE" -> request.setModuleIds(List.of(docShare.getRangeMatchVal()));
case "PATH" -> {
if (StringUtils.equals(docShare.getRangeMatchSymbol(), MsAssertionCondition.EQUALS.name())) {
CombineCondition condition = buildModuleCondition("path", docShare.getRangeMatchVal(), MsAssertionCondition.EQUALS.name());
combineSearch.setConditions(List.of(condition));
} else {
CombineCondition condition = buildModuleCondition("path", docShare.getRangeMatchVal(), MsAssertionCondition.CONTAINS.name());
combineSearch.setConditions(List.of(condition));
}
}
case "TAG" -> {
// 暂时只有包含操作
String[] tags = StringUtils.split(docShare.getRangeMatchVal(), ",");
CombineCondition condition = buildModuleCondition("tags", Arrays.asList(tags), MsAssertionCondition.CONTAINS.name());
combineSearch.setConditions(List.of(condition));
}
default -> {
}
}
request.setCombineSearch(combineSearch);
}
return request;
}
/** /**
* 计算截止时间 * 计算截止时间
* @param val 时间值 * @param val 时间值
@ -193,4 +256,21 @@ public class ApiDocShareService {
} }
return docShare; return docShare;
} }
/**
* 组合左侧模块树的查询条件
* @param name 条件字段名
* @param val 条件字段值
* @param operator 操作符
* @return 组合查询条件
*/
private CombineCondition buildModuleCondition(String name, Object val, String operator) {
CombineCondition condition = new CombineCondition();
condition.setCustomField(false);
condition.setCustomFieldType(StringUtils.EMPTY);
condition.setName(name);
condition.setValue(val);
condition.setOperator(operator);
return condition;
}
} }

View File

@ -3,6 +3,7 @@ package io.metersphere.api.controller;
import io.metersphere.api.domain.ApiDocShare; import io.metersphere.api.domain.ApiDocShare;
import io.metersphere.api.dto.definition.request.ApiDocShareCheckRequest; import io.metersphere.api.dto.definition.request.ApiDocShareCheckRequest;
import io.metersphere.api.dto.definition.request.ApiDocShareEditRequest; import io.metersphere.api.dto.definition.request.ApiDocShareEditRequest;
import io.metersphere.api.dto.definition.request.ApiDocShareModuleRequest;
import io.metersphere.api.dto.definition.request.ApiDocSharePageRequest; import io.metersphere.api.dto.definition.request.ApiDocSharePageRequest;
import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.JSON;
import io.metersphere.system.base.BaseTest; import io.metersphere.system.base.BaseTest;
@ -17,6 +18,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.MvcResult;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@ -32,6 +34,8 @@ public class ApiDocShareControllerTests extends BaseTest {
private final static String PAGE = BASE_PATH + "page"; private final static String PAGE = BASE_PATH + "page";
private final static String CHECK = BASE_PATH + "check"; private final static String CHECK = BASE_PATH + "check";
private final static String DETAIL = BASE_PATH + "detail/"; private final static String DETAIL = BASE_PATH + "detail/";
private final static String MODULE_TREE = BASE_PATH + "module/tree";
private final static String MODULE_COUNT = BASE_PATH + "module/count";
@Order(1) @Order(1)
@Test @Test
@ -40,7 +44,7 @@ public class ApiDocShareControllerTests extends BaseTest {
request.setName("share-1"); request.setName("share-1");
request.setProjectId(DEFAULT_PROJECT_ID); request.setProjectId(DEFAULT_PROJECT_ID);
request.setApiRange("ALL"); request.setApiRange("ALL");
request.setIsPublic(false); request.setIsPrivate(false);
request.setPassword("123456"); request.setPassword("123456");
request.setAllowExport(false); request.setAllowExport(false);
MvcResult mvcResult = this.requestPostWithOk(ADD, request).andReturn(); MvcResult mvcResult = this.requestPostWithOk(ADD, request).andReturn();
@ -53,6 +57,11 @@ public class ApiDocShareControllerTests extends BaseTest {
checkRequest.setPassword("123456"); checkRequest.setPassword("123456");
this.requestPostWithOk(CHECK, checkRequest); this.requestPostWithOk(CHECK, checkRequest);
this.requestGetWithOk(DETAIL + docShare.getId()); this.requestGetWithOk(DETAIL + docShare.getId());
ApiDocShareModuleRequest moduleRequest = new ApiDocShareModuleRequest();
moduleRequest.setShareId(docShare.getId());
moduleRequest.setProjectId(DEFAULT_PROJECT_ID);
moduleRequest.setProtocols(List.of("HTTP", "SPX", "Redis", "MongoDB"));
this.requestPostWithOk(MODULE_TREE, moduleRequest);
request.setId(docShare.getId()); request.setId(docShare.getId());
request.setName("share-2"); request.setName("share-2");
request.setPassword(StringUtils.EMPTY); request.setPassword(StringUtils.EMPTY);
@ -63,6 +72,7 @@ public class ApiDocShareControllerTests extends BaseTest {
this.requestPostWithOk(UPDATE, request); this.requestPostWithOk(UPDATE, request);
this.requestPostWithOk(CHECK, checkRequest); this.requestPostWithOk(CHECK, checkRequest);
this.requestGetWithOk(DETAIL + docShare.getId()); this.requestGetWithOk(DETAIL + docShare.getId());
this.requestPostWithOk(MODULE_TREE, moduleRequest);
this.requestGetWithOk(DELETE + docShare.getId()); this.requestGetWithOk(DELETE + docShare.getId());
// 不存在的ID // 不存在的ID
this.requestGet(DELETE + "not-exist-id").andExpect(status().is5xxServerError()); this.requestGet(DELETE + "not-exist-id").andExpect(status().is5xxServerError());
@ -75,7 +85,7 @@ public class ApiDocShareControllerTests extends BaseTest {
request.setName("share-1"); request.setName("share-1");
request.setProjectId(DEFAULT_PROJECT_ID); request.setProjectId(DEFAULT_PROJECT_ID);
request.setApiRange("ALL"); request.setApiRange("ALL");
request.setIsPublic(false); request.setIsPrivate(false);
request.setAllowExport(false); request.setAllowExport(false);
this.requestPostWithOk(ADD, request); this.requestPostWithOk(ADD, request);
request.setInvalidTime(1); request.setInvalidTime(1);
@ -86,12 +96,30 @@ public class ApiDocShareControllerTests extends BaseTest {
request.setApiRange("PATH"); request.setApiRange("PATH");
request.setRangeMatchSymbol("EQUALS"); request.setRangeMatchSymbol("EQUALS");
request.setRangeMatchVal("path-1"); request.setRangeMatchVal("path-1");
this.requestPostWithOk(ADD, request); MvcResult mvcResult = this.requestPostWithOk(ADD, request).andReturn();
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
ApiDocShare docShare = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), ApiDocShare.class);
ApiDocShareModuleRequest moduleRequest = new ApiDocShareModuleRequest();
moduleRequest.setShareId(docShare.getId());
moduleRequest.setProjectId(DEFAULT_PROJECT_ID);
moduleRequest.setProtocols(List.of("HTTP", "SPX", "Redis", "MongoDB"));
this.requestPostWithOk(MODULE_COUNT, moduleRequest);
request.setRangeMatchSymbol("CONTAINS"); request.setRangeMatchSymbol("CONTAINS");
this.requestPostWithOk(ADD, request); MvcResult mvcResult1 = this.requestPostWithOk(ADD, request).andReturn();
String returnData1 = mvcResult1.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder1 = JSON.parseObject(returnData1, ResultHolder.class);
ApiDocShare docShare1 = JSON.parseObject(JSON.toJSONString(resultHolder1.getData()), ApiDocShare.class);
moduleRequest.setShareId(docShare1.getId());
this.requestPostWithOk(MODULE_COUNT, moduleRequest);
request.setApiRange("TAG"); request.setApiRange("TAG");
request.setRangeMatchVal("tag-1,tag-2"); request.setRangeMatchVal("tag-1,tag-2");
this.requestPostWithOk(ADD, request); MvcResult mvcResult2 = this.requestPostWithOk(ADD, request).andReturn();
String returnData2 = mvcResult2.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder resultHolder2 = JSON.parseObject(returnData2, ResultHolder.class);
ApiDocShare docShare2 = JSON.parseObject(JSON.toJSONString(resultHolder2.getData()), ApiDocShare.class);
moduleRequest.setShareId(docShare2.getId());
this.requestPostWithOk(MODULE_COUNT, moduleRequest);
ApiDocSharePageRequest pageRequest = new ApiDocSharePageRequest(); ApiDocSharePageRequest pageRequest = new ApiDocSharePageRequest();
pageRequest.setProjectId(DEFAULT_PROJECT_ID); pageRequest.setProjectId(DEFAULT_PROJECT_ID);
pageRequest.setCurrent(1); pageRequest.setCurrent(1);