From 271304bc5200853500d48d8fbe86812ea84fa774 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Fri, 10 Apr 2020 10:57:34 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=92=AEonkey?= =?UTF-8?q?down=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/OrganizationMember.vue | 10 ++++++---- .../organization/OrganizationWorkspace.vue | 17 +++++++++------- .../settings/personal/PersonSetting.vue | 3 ++- .../settings/system/Organization.vue | 20 +++++++++++-------- .../settings/system/SystemWorkspace.vue | 12 +++++------ .../components/settings/system/User.vue | 6 ++++-- .../settings/workspace/WorkspaceMember.vue | 10 ++++++---- 7 files changed, 46 insertions(+), 32 deletions(-) diff --git a/frontend/src/business/components/settings/organization/OrganizationMember.vue b/frontend/src/business/components/settings/organization/OrganizationMember.vue index 8758e32c2c..de0e9aaa91 100644 --- a/frontend/src/business/components/settings/organization/OrganizationMember.vue +++ b/frontend/src/business/components/settings/organization/OrganizationMember.vue @@ -28,8 +28,8 @@ @@ -79,7 +79,8 @@ @@ -111,7 +112,8 @@ diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index fe5860bf4e..c2a6cb3c21 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -25,8 +25,8 @@ @@ -60,7 +60,8 @@ @@ -92,8 +93,8 @@ @@ -144,7 +145,8 @@ @@ -177,7 +179,8 @@ diff --git a/frontend/src/business/components/settings/personal/PersonSetting.vue b/frontend/src/business/components/settings/personal/PersonSetting.vue index 4ee53e7ca7..f2f905bcde 100644 --- a/frontend/src/business/components/settings/personal/PersonSetting.vue +++ b/frontend/src/business/components/settings/personal/PersonSetting.vue @@ -44,7 +44,8 @@ diff --git a/frontend/src/business/components/settings/system/Organization.vue b/frontend/src/business/components/settings/system/Organization.vue index 5fa9ae875c..54eb3f3106 100644 --- a/frontend/src/business/components/settings/system/Organization.vue +++ b/frontend/src/business/components/settings/system/Organization.vue @@ -27,8 +27,8 @@ @@ -77,8 +77,8 @@ @@ -113,7 +113,8 @@ @@ -130,7 +131,8 @@ @@ -163,7 +165,8 @@ @@ -196,7 +199,8 @@ diff --git a/frontend/src/business/components/settings/system/SystemWorkspace.vue b/frontend/src/business/components/settings/system/SystemWorkspace.vue index a551043ccb..da9daf6aa2 100644 --- a/frontend/src/business/components/settings/system/SystemWorkspace.vue +++ b/frontend/src/business/components/settings/system/SystemWorkspace.vue @@ -77,7 +77,7 @@ @@ -105,7 +105,7 @@ @@ -139,8 +139,8 @@ @@ -195,7 +195,7 @@ @@ -230,7 +230,7 @@ diff --git a/frontend/src/business/components/settings/system/User.vue b/frontend/src/business/components/settings/system/User.vue index 1bdcc09402..6b25785dc2 100644 --- a/frontend/src/business/components/settings/system/User.vue +++ b/frontend/src/business/components/settings/system/User.vue @@ -83,7 +83,8 @@ @@ -105,7 +106,8 @@ diff --git a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue index 2a5472abd6..5ea94860fe 100644 --- a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue +++ b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue @@ -27,8 +27,8 @@ @@ -78,7 +78,8 @@ @@ -110,7 +111,8 @@ From 9120825caafd91abcb0c94f24038cfeac2a65fdd Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 10 Apr 2020 11:14:11 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/annotations/FuzzyQuery.java | 15 ---- .../metersphere/commons/utils/BeanUtils.java | 38 ---------- .../controller/OrganizationController.java | 30 +++++--- .../request/OrganizationRequest.java | 13 ++++ .../controller/request/WorkspaceRequest.java | 3 - .../service/OrganizationService.java | 10 ++- .../metersphere/service/WorkspaceService.java | 10 ++- .../settings/system/Organization.vue | 75 ++++++++++++------- .../settings/system/SystemWorkspace.vue | 5 +- .../settings/system/TestResourcePool.vue | 2 - 10 files changed, 99 insertions(+), 102 deletions(-) delete mode 100644 backend/src/main/java/io/metersphere/commons/annotations/FuzzyQuery.java create mode 100644 backend/src/main/java/io/metersphere/controller/request/OrganizationRequest.java diff --git a/backend/src/main/java/io/metersphere/commons/annotations/FuzzyQuery.java b/backend/src/main/java/io/metersphere/commons/annotations/FuzzyQuery.java deleted file mode 100644 index a896a0e493..0000000000 --- a/backend/src/main/java/io/metersphere/commons/annotations/FuzzyQuery.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.metersphere.commons.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Documented -@Inherited -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface FuzzyQuery { -} diff --git a/backend/src/main/java/io/metersphere/commons/utils/BeanUtils.java b/backend/src/main/java/io/metersphere/commons/utils/BeanUtils.java index c1e70f8d7c..df6882de81 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/BeanUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/BeanUtils.java @@ -1,12 +1,8 @@ package io.metersphere.commons.utils; -import io.metersphere.commons.annotations.FuzzyQuery; import org.apache.commons.lang3.StringUtils; -import org.springframework.util.ReflectionUtils; import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; public class BeanUtils { @@ -69,38 +65,4 @@ public class BeanUtils { return null; } } - - /** - * @param obj - * @return - */ - public static Map objectToMap(Object obj) { - - HashMap map = new HashMap<>(); - if (obj != null) { - ReflectionUtils.doWithFields(obj.getClass(), field -> { - boolean accessFlag = field.isAccessible(); - try { - String varName = field.getName(); - field.setAccessible(true); - Object o = field.get(obj); - if (o != null) { - if (field.isAnnotationPresent(FuzzyQuery.class) && o instanceof String) { - String value = "%" + o + "%"; - map.put(varName, value); - } else { - map.put(varName, field.get(obj)); - } - } - field.setAccessible(accessFlag); - } catch (Exception e) { - - } finally { - field.setAccessible(accessFlag); - } - }); - } - return map; - } - } diff --git a/backend/src/main/java/io/metersphere/controller/OrganizationController.java b/backend/src/main/java/io/metersphere/controller/OrganizationController.java index cfd103e5f9..1ebc2d3f6f 100644 --- a/backend/src/main/java/io/metersphere/controller/OrganizationController.java +++ b/backend/src/main/java/io/metersphere/controller/OrganizationController.java @@ -6,11 +6,13 @@ import io.metersphere.base.domain.Organization; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; +import io.metersphere.controller.request.OrganizationRequest; import io.metersphere.dto.OrganizationMemberDTO; import io.metersphere.service.OrganizationService; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.web.bind.annotation.*; + import javax.annotation.Resource; import java.util.List; @@ -23,26 +25,34 @@ public class OrganizationController { @PostMapping("/add") @RequiresRoles(RoleConstants.ADMIN) - public Organization addOrganization(@RequestBody Organization organization) { return organizationService.addOrganization(organization); } + public Organization addOrganization(@RequestBody Organization organization) { + return organizationService.addOrganization(organization); + } @GetMapping("/list") - @RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN,RoleConstants.TEST_MANAGER}, logical = Logical.OR) - public List getOrganizationList() { return organizationService.getOrganizationList(); } + @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR) + public List getOrganizationList() { + return organizationService.getOrganizationList(new OrganizationRequest()); + } @PostMapping("/list/{goPage}/{pageSize}") - @RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) - public Pager> getOrganizationList(@PathVariable int goPage, @PathVariable int pageSize) { + @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) + public Pager> getOrganizationList(@RequestBody OrganizationRequest request, @PathVariable int goPage, @PathVariable int pageSize) { Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, organizationService.getOrganizationList()); + return PageUtils.setPageInfo(page, organizationService.getOrganizationList(request)); } @GetMapping("/delete/{organizationId}") @RequiresRoles(RoleConstants.ADMIN) - public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) { organizationService.deleteOrganization(organizationId); } + public void deleteOrganization(@PathVariable(value = "organizationId") String organizationId) { + organizationService.deleteOrganization(organizationId); + } @PostMapping("/update") - @RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) - public void updateOrganization(@RequestBody Organization organization) { organizationService.updateOrganization(organization); } + @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) + public void updateOrganization(@RequestBody Organization organization) { + organizationService.updateOrganization(organization); + } @GetMapping("/list/userorg/{userId}") public List getOrganizationListByUserId(@PathVariable String userId) { @@ -50,7 +60,7 @@ public class OrganizationController { } @PostMapping("/member/update") - @RequiresRoles(value = {RoleConstants.ADMIN,RoleConstants.ORG_ADMIN}, logical = Logical.OR) + @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) { organizationService.updateOrgMember(memberDTO); } diff --git a/backend/src/main/java/io/metersphere/controller/request/OrganizationRequest.java b/backend/src/main/java/io/metersphere/controller/request/OrganizationRequest.java new file mode 100644 index 0000000000..3ef692b766 --- /dev/null +++ b/backend/src/main/java/io/metersphere/controller/request/OrganizationRequest.java @@ -0,0 +1,13 @@ +package io.metersphere.controller.request; + +public class OrganizationRequest { + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java b/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java index 1e12ac3970..5e092cd913 100644 --- a/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/WorkspaceRequest.java @@ -1,10 +1,7 @@ package io.metersphere.controller.request; -import io.metersphere.commons.annotations.FuzzyQuery; - public class WorkspaceRequest { private String organizationId; - @FuzzyQuery private String name; public String getOrganizationId() { diff --git a/backend/src/main/java/io/metersphere/service/OrganizationService.java b/backend/src/main/java/io/metersphere/service/OrganizationService.java index ac651ead6a..148c85625d 100644 --- a/backend/src/main/java/io/metersphere/service/OrganizationService.java +++ b/backend/src/main/java/io/metersphere/service/OrganizationService.java @@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtOrganizationMapper; import io.metersphere.base.mapper.ext.ExtUserRoleMapper; import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.exception.MSException; +import io.metersphere.controller.request.OrganizationRequest; import io.metersphere.dto.OrganizationMemberDTO; import io.metersphere.dto.UserRoleHelpDTO; import io.metersphere.i18n.Translator; @@ -48,8 +49,13 @@ public class OrganizationService { return organization; } - public List getOrganizationList() { - return organizationMapper.selectByExample(null); + public List getOrganizationList(OrganizationRequest request) { + OrganizationExample example = new OrganizationExample(); + OrganizationExample.Criteria criteria = example.createCriteria(); + if (StringUtils.isNotBlank(request.getName())) { + criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%")); + } + return organizationMapper.selectByExample(example); } public void deleteOrganization(String organizationId) { diff --git a/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/backend/src/main/java/io/metersphere/service/WorkspaceService.java index 72128457d1..6aabfbe50f 100644 --- a/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -17,6 +17,7 @@ import io.metersphere.i18n.Translator; import io.metersphere.user.SessionUser; import io.metersphere.user.SessionUtils; import org.apache.commons.lang3.StringUtils; +import org.eclipse.jetty.util.StringUtil; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -77,13 +78,16 @@ public class WorkspaceService { criteria.andOrganizationIdEqualTo(request.getOrganizationId()); } if (StringUtils.isNotBlank(request.getName())) { - criteria.andNameLike(request.getName()); + criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%")); } return workspaceMapper.selectByExample(example); } - public List getAllWorkspaceList() { - return extWorkspaceMapper.getWorkspaceWithOrg(); + public List getAllWorkspaceList(WorkspaceRequest request) { + if (StringUtils.isNotBlank(request.getName())) { + request.setName(StringUtils.wrapIfMissing(request.getName(), "%")); + } + return extWorkspaceMapper.getWorkspaceWithOrg(request); } public void deleteWorkspace(String workspaceId) { diff --git a/frontend/src/business/components/settings/system/Organization.vue b/frontend/src/business/components/settings/system/Organization.vue index 5fa9ae875c..b1df098b7d 100644 --- a/frontend/src/business/components/settings/system/Organization.vue +++ b/frontend/src/business/components/settings/system/Organization.vue @@ -9,7 +9,8 @@ - @@ -22,7 +23,8 @@ @@ -102,8 +104,10 @@ - - + + @@ -119,8 +123,10 @@ - - + + @@ -136,10 +142,13 @@ - - + + - + - + - + @@ -184,7 +195,8 @@ - + @@ -239,7 +252,7 @@ rule: { name: [ {required: true, message: this.$t('organization.input_name'), trigger: 'blur'}, - { min: 2, max: 10, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur' }, + {min: 2, max: 10, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}, { required: true, pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/, @@ -248,7 +261,7 @@ } ], description: [ - { max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'} + {max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'} ] }, orgMemberRule: { @@ -292,7 +305,7 @@ // 编辑时填充角色信息 this.$set(this.memberForm, 'roleIds', roleIds); }, - cellClick(row){ + cellClick(row) { // 保存当前点击的组织信息到currentRow this.currentRow = row; this.memberVisible = true; @@ -320,7 +333,7 @@ cancelButtonText: this.$t('commons.cancel'), type: 'warning' }).then(() => { - this.result = this.$get(this.deletePath + row.id,() => { + this.result = this.$get(this.deletePath + row.id, () => { this.$message({ type: 'success', message: this.$t('commons.delete_success') @@ -355,16 +368,16 @@ }); }, createOrganization(createOrganizationForm) { - this.$refs[createOrganizationForm].validate( valide => { + this.$refs[createOrganizationForm].validate(valide => { if (valide) { - this.result = this.$post(this.createPath, this.form,() => { + this.result = this.$post(this.createPath, this.form, () => { this.$message({ type: 'success', message: this.$t('commons.save_success') }); this.initTableData(); this.createVisible = false; - }); + }); } else { return false; } @@ -373,21 +386,27 @@ updateOrganization(udpateOrganizationForm) { this.$refs[udpateOrganizationForm].validate(valide => { if (valide) { - this.result = this.$post(this.updatePath, this.form,() => { + this.result = this.$post(this.updatePath, this.form, () => { this.$message({ type: 'success', message: this.$t('commons.modify_success') }); this.updateVisible = false; this.initTableData(); - }); + }); } else { return false; } }) }, + search() { + this.initTableData(); + }, initTableData() { - this.result = this.$post(this.buildPagePath(this.queryPath),{},response => { + let param = { + name: this.condition + }; + this.result = this.$post(this.buildPagePath(this.queryPath), param, response => { let data = response.data; this.tableData = data.listObject; for (let i = 0; i < this.tableData.length; i++) { @@ -441,7 +460,7 @@ roleIds: this.memberForm.roleIds, organizationId: this.currentRow.id }; - this.result = this.$post("user/special/org/member/add", param,() => { + this.result = this.$post("user/special/org/member/add", param, () => { this.cellClick(this.currentRow); this.addMemberVisible = false; }) @@ -459,7 +478,7 @@ roleIds: this.memberForm.roleIds, organizationId: this.currentRow.id } - this.result = this.$post("/organization/member/update", param,() => { + this.result = this.$post("/organization/member/update", param, () => { this.$message({ type: 'success', message: this.$t('commons.modify_success') @@ -485,8 +504,8 @@ } .member-size { - text-decoration:underline; - cursor:pointer; + text-decoration: underline; + cursor: pointer; } .org-member-name { diff --git a/frontend/src/business/components/settings/system/SystemWorkspace.vue b/frontend/src/business/components/settings/system/SystemWorkspace.vue index a551043ccb..d0e2c6d7d5 100644 --- a/frontend/src/business/components/settings/system/SystemWorkspace.vue +++ b/frontend/src/business/components/settings/system/SystemWorkspace.vue @@ -11,7 +11,7 @@ @@ -353,6 +353,9 @@ this.memberLineData = []; this.list(); }, + search() { + this.list(); + }, list() { let url = '/workspace/list/all/' + this.currentPage + '/' + this.pageSize; this.result = this.$post(url, {name: this.condition}, response => { diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index 8a1cacc241..8c3ca9c22c 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -284,7 +284,6 @@ }, methods: { initTableData() { - this.loading = true; let param = { name: this.condition }; @@ -293,7 +292,6 @@ let data = response.data; this.items = data.listObject; this.total = data.itemCount; - this.loading = false; }) }, changeResourceType() { From c3738739bac832f6727eed06f9104946c2cc4c68 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 10 Apr 2020 11:17:04 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java | 4 +++- .../io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml | 5 +++++ .../java/io/metersphere/controller/WorkspaceController.java | 5 ++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java index 538b463116..57dfd286bf 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.java @@ -1,10 +1,12 @@ package io.metersphere.base.mapper.ext; +import io.metersphere.controller.request.WorkspaceRequest; import io.metersphere.dto.WorkspaceDTO; +import org.apache.ibatis.annotations.Param; import java.util.List; public interface ExtWorkspaceMapper { - List getWorkspaceWithOrg(); + List getWorkspaceWithOrg(@Param("request") WorkspaceRequest request); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml index a406d61bf1..e4c32b353f 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtWorkspaceMapper.xml @@ -5,6 +5,11 @@ \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java index 6804200919..45f02ff1ae 100644 --- a/backend/src/main/java/io/metersphere/controller/WorkspaceController.java +++ b/backend/src/main/java/io/metersphere/controller/WorkspaceController.java @@ -7,7 +7,6 @@ import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.WorkspaceRequest; -import io.metersphere.dto.OrganizationMemberDTO; import io.metersphere.dto.WorkspaceDTO; import io.metersphere.dto.WorkspaceMemberDTO; import io.metersphere.service.WorkspaceService; @@ -73,9 +72,9 @@ public class WorkspaceController { @PostMapping("list/all/{goPage}/{pageSize}") @RequiresRoles(RoleConstants.ADMIN) - public Pager> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize) { + public Pager> getAllWorkspaceList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody WorkspaceRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); - return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList()); + return PageUtils.setPageInfo(page, workspaceService.getAllWorkspaceList(request)); } @GetMapping("/list/userworkspace/{userId}") From ed9d972bee1d56c36f5cc2b9d5ee2042bcfb041a Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 10 Apr 2020 11:25:42 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/OrganizationWorkspace.vue | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index c2a6cb3c21..c014c901bf 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -9,7 +9,7 @@ @@ -20,13 +20,16 @@ @@ -93,8 +96,10 @@ @@ -118,10 +123,13 @@ - - + + - + - + - + @@ -167,7 +177,8 @@ - + { + this.result = this.$post("user/ws/member/add", param, () => { this.cellClick(this.currentWorkspaceRow); this.addMemberVisible = false; }) @@ -394,7 +408,7 @@ roleIds: this.memberForm.roleIds, workspaceId: this.currentWorkspaceRow.id } - this.result = this.$post("/workspace/member/update", param,() => { + this.result = this.$post("/workspace/member/update", param, () => { this.$message({ type: 'success', message: this.$t('commons.modify_success') @@ -472,8 +486,8 @@ } .member-size { - text-decoration:underline; - cursor:pointer; + text-decoration: underline; + cursor: pointer; } .member-title { From 2d17d227eb2e9075a8cd0124335797721ee5d4ec Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 10 Apr 2020 11:36:18 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/base/mapper/ext/ExtProjectMapper.xml | 11 ++++++++--- .../controller/request/ProjectRequest.java | 9 +++++++++ .../java/io/metersphere/service/ProjectService.java | 3 +++ .../src/business/components/project/MsProject.vue | 8 ++++++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml index 5f7d030259..83a699ae00 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtProjectMapper.xml @@ -7,9 +7,14 @@ p.create_time, w.id as workspaceId, w.name as workspaceName from project p join workspace w on p.workspace_id = w.id - - where w.id = #{proRequest.workspaceId} - + + + and p.name like #{proRequest.name, jdbcType=VARCHAR} + + + and w.id = #{proRequest.workspaceId} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/request/ProjectRequest.java b/backend/src/main/java/io/metersphere/controller/request/ProjectRequest.java index af75a12bb1..4a79086123 100644 --- a/backend/src/main/java/io/metersphere/controller/request/ProjectRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/ProjectRequest.java @@ -2,6 +2,15 @@ package io.metersphere.controller.request; public class ProjectRequest { private String workspaceId; + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } public String getWorkspaceId() { return workspaceId; diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 69a378ee29..0190127536 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -47,6 +47,9 @@ public class ProjectService { } public List getProjectList(ProjectRequest request) { + if (StringUtils.isNotBlank(request.getName())) { + request.setName(StringUtils.wrapIfMissing(request.getName(), "%")); + } return extProjectMapper.getProjectWithWorkspace(request); } diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index 5bd421e82e..0923d62d26 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -11,6 +11,7 @@ @@ -101,7 +102,7 @@ if (this.$route.path.split('/')[2] === 'project' && this.$route.path.split('/')[3] === 'create') { this.create(); - this.$router.push( '/' + this.beaseUrl + '/project/all'); + this.$router.push('/' + this.beaseUrl + '/project/all'); } this.list(); }, @@ -172,9 +173,12 @@ }).catch(() => { }); }, + search() { + this.list(); + }, list() { let url = "/project/list/" + this.currentPage + '/' + this.pageSize; - this.result = this.$post(url, {}, (response) => { + this.result = this.$post(url, {name: this.condition}, (response) => { let data = response.data; this.items = data.listObject; this.total = data.itemCount; From d4c33c53f615cefd7c0bc51b3e5ddb096e17d622 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 10 Apr 2020 11:50:09 +0800 Subject: [PATCH 06/13] =?UTF-8?q?btn=20=E7=A6=81=E7=94=A8=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/project/MsProject.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index 0923d62d26..b6789a9f2c 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -57,7 +57,9 @@ From b4cc48f1ed895688ac1857e2e8f73d65770bbeb2 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 10 Apr 2020 11:54:05 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/metersphere/service/WorkspaceService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/service/WorkspaceService.java b/backend/src/main/java/io/metersphere/service/WorkspaceService.java index 6aabfbe50f..7956a9f90c 100644 --- a/backend/src/main/java/io/metersphere/service/WorkspaceService.java +++ b/backend/src/main/java/io/metersphere/service/WorkspaceService.java @@ -17,7 +17,6 @@ import io.metersphere.i18n.Translator; import io.metersphere.user.SessionUser; import io.metersphere.user.SessionUtils; import org.apache.commons.lang3.StringUtils; -import org.eclipse.jetty.util.StringUtil; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -229,6 +228,7 @@ public class WorkspaceService { } public void updateWorkspacebyAdmin(Workspace workspace) { + workspace.setCreateTime(null); workspace.setUpdateTime(System.currentTimeMillis()); workspaceMapper.updateByPrimaryKeySelective(workspace); } From b8296dbff987b7b0d44feffed643a32a6632e91c Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 10 Apr 2020 12:00:15 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/case/components/TestCaseList.vue | 42 ++++++++++--------- .../track/head/TrackHeaderMenus.vue | 10 ++--- .../track/plan/components/TestPlanList.vue | 17 ++++---- frontend/src/i18n/en-US.js | 6 ++- frontend/src/i18n/zh-CN.js | 8 +++- 5 files changed, 47 insertions(+), 36 deletions(-) diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 6071ba24fe..48f9ab4e25 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -7,11 +7,7 @@ {{$t('test_track.test_case')}} - - - - {{$t('commons.create')}} + @@ -108,21 +104,24 @@