refactor(接口测试): 优化接口测试执行过程中的部分对用户操作的步骤
优化接口测试执行过程中的部分对用户操作的步骤,避免一次性查出数据库中的全部用户信息
This commit is contained in:
parent
4702717e4d
commit
d635794605
|
@ -24,9 +24,6 @@ public interface ExtUserMapper {
|
|||
@MapKey("id")
|
||||
Map<String, User> queryNameByIds(List<String> userIds);
|
||||
|
||||
@MapKey("id")
|
||||
Map<String, User> queryName();
|
||||
|
||||
List<String> selectAllId();
|
||||
|
||||
List<String> selectIdsByQuery(@Param("request") UserRequest request);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</if>
|
||||
<if test="userRequest.name != null">
|
||||
AND (u.name like CONCAT('%', #{userRequest.name},'%')
|
||||
or u.id like CONCAT('%', #{userRequest.name},'%'))
|
||||
or u.id like CONCAT('%', #{userRequest.name},'%'))
|
||||
</if>
|
||||
<if test="userRequest.email != null">
|
||||
AND u.email like CONCAT('%', #{userRequest.email},'%')
|
||||
|
@ -68,19 +68,22 @@
|
|||
|
||||
<!--修改密码-->
|
||||
<update id="updatePassword" parameterType="io.metersphere.base.domain.User">
|
||||
update user
|
||||
set
|
||||
password=#{password,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
where id=#{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
update user
|
||||
set password=#{password,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<select id="getDefaultLanguage" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
select param_value from system_parameter
|
||||
where param_key=#{paramKey,jdbcType=VARCHAR}
|
||||
</select>
|
||||
select param_value
|
||||
from system_parameter
|
||||
where param_key = #{paramKey,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="searchUser" parameterType="java.lang.String" resultType="io.metersphere.base.domain.User">
|
||||
select id, name, email, last_workspace_id from `user` where id like CONCAT('%', #{condition},'%') or email like CONCAT('%', #{condition},'%') limit 100;
|
||||
select id, name, email, last_workspace_id
|
||||
from `user`
|
||||
where id like CONCAT('%', #{condition}, '%')
|
||||
or email like CONCAT('%', #{condition}, '%') limit 100;
|
||||
</select>
|
||||
|
||||
<select id="queryNameByIds" resultType="io.metersphere.base.domain.User">
|
||||
|
@ -93,13 +96,9 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryName" resultType="io.metersphere.base.domain.User">
|
||||
select id, name
|
||||
from `user`
|
||||
</select>
|
||||
|
||||
<select id="selectAllId" resultType="java.lang.String">
|
||||
select id from `user`
|
||||
select id
|
||||
from `user`
|
||||
</select>
|
||||
|
||||
<select id="selectIdsByQuery" resultType="java.lang.String">
|
||||
|
@ -109,12 +108,16 @@
|
|||
</select>
|
||||
|
||||
<update id="updateLastProjectIdIfNull">
|
||||
update user set last_project_id = #{projectId} where id = #{userId}
|
||||
and (last_project_id is null or last_project_id = '')
|
||||
update user
|
||||
set last_project_id = #{projectId}
|
||||
where id = #{userId}
|
||||
and (last_project_id is null or last_project_id = '')
|
||||
</update>
|
||||
|
||||
<update id="updateLastWorkspaceIdIfNull">
|
||||
update user set last_workspace_id = #{workspaceId} where id = #{userId}
|
||||
and (last_workspace_id is null or last_workspace_id = '')
|
||||
update user
|
||||
set last_workspace_id = #{workspaceId}
|
||||
where id = #{userId}
|
||||
and (last_workspace_id is null or last_workspace_id = '')
|
||||
</update>
|
||||
</mapper>
|
|
@ -104,10 +104,6 @@ public class UserService {
|
|||
return extUserMapper.queryNameByIds(userIds);
|
||||
}
|
||||
|
||||
public Map<String, User> queryName() {
|
||||
return extUserMapper.queryName();
|
||||
}
|
||||
|
||||
public UserDTO insert(UserRequest userRequest) {
|
||||
checkUserParam(userRequest);
|
||||
String id = userRequest.getId();
|
||||
|
@ -1486,4 +1482,12 @@ public class UserService {
|
|||
public List<User> getProjectMemberOption(String projectId) {
|
||||
return extUserGroupMapper.getProjectMemberOption(projectId);
|
||||
}
|
||||
|
||||
public Map<String, User> getUserIdMapByIds(List<String> userIdList) {
|
||||
return extUserMapper.queryNameByIds(userIdList);
|
||||
}
|
||||
|
||||
public User selectById(String id) {
|
||||
return userMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue