refactor: 场景项目接口优化
This commit is contained in:
parent
6b83069a3d
commit
236fbe5371
|
@ -91,7 +91,7 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
ProjectExample example = new ProjectExample();
|
ProjectExample example = new ProjectExample();
|
||||||
example.createCriteria()
|
example.createCriteria()
|
||||||
.andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId())
|
.andWorkspaceIdEqualTo(project.getWorkspaceId())
|
||||||
.andNameEqualTo(project.getName());
|
.andNameEqualTo(project.getName());
|
||||||
if (projectMapper.countByExample(example) > 0) {
|
if (projectMapper.countByExample(example) > 0) {
|
||||||
MSException.throwException(Translator.get("project_name_already_exists"));
|
MSException.throwException(Translator.get("project_name_already_exists"));
|
||||||
|
@ -106,15 +106,15 @@ public class ProjectService {
|
||||||
project.setCreateTime(createTime);
|
project.setCreateTime(createTime);
|
||||||
project.setUpdateTime(createTime);
|
project.setUpdateTime(createTime);
|
||||||
// set workspace id
|
// set workspace id
|
||||||
project.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
project.setWorkspaceId(project.getWorkspaceId());
|
||||||
project.setCreateUser(SessionUtils.getUserId());
|
project.setCreateUser(project.getCreateUser());
|
||||||
project.setSystemId(systemId);
|
project.setSystemId(systemId);
|
||||||
projectMapper.insertSelective(project);
|
projectMapper.insertSelective(project);
|
||||||
|
|
||||||
// 创建项目为当前用户添加用户组
|
// 创建项目为当前用户添加用户组
|
||||||
UserGroup userGroup = new UserGroup();
|
UserGroup userGroup = new UserGroup();
|
||||||
userGroup.setId(UUID.randomUUID().toString());
|
userGroup.setId(UUID.randomUUID().toString());
|
||||||
userGroup.setUserId(SessionUtils.getUserId());
|
userGroup.setUserId(project.getCreateUser());
|
||||||
userGroup.setCreateTime(System.currentTimeMillis());
|
userGroup.setCreateTime(System.currentTimeMillis());
|
||||||
userGroup.setUpdateTime(System.currentTimeMillis());
|
userGroup.setUpdateTime(System.currentTimeMillis());
|
||||||
userGroup.setGroupId(UserGroupConstants.PROJECT_ADMIN);
|
userGroup.setGroupId(UserGroupConstants.PROJECT_ADMIN);
|
||||||
|
@ -122,7 +122,7 @@ public class ProjectService {
|
||||||
userGroupMapper.insert(userGroup);
|
userGroupMapper.insert(userGroup);
|
||||||
|
|
||||||
// 创建新项目检查当前用户 last_project_id
|
// 创建新项目检查当前用户 last_project_id
|
||||||
extUserMapper.updateLastProjectIdIfNull(project.getId(), SessionUtils.getUserId());
|
extUserMapper.updateLastProjectIdIfNull(project.getId(), project.getCreateUser());
|
||||||
|
|
||||||
return project;
|
return project;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ import MsTableOperator from "../../common/components/MsTableOperator";
|
||||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {
|
import {
|
||||||
getCurrentProjectID,
|
getCurrentProjectID,
|
||||||
getCurrentUser,
|
getCurrentUser, getCurrentUserId,
|
||||||
getCurrentWorkspaceId,
|
getCurrentWorkspaceId,
|
||||||
listenGoBack,
|
listenGoBack,
|
||||||
removeGoBackListener
|
removeGoBackListener
|
||||||
|
@ -295,6 +295,8 @@ export default {
|
||||||
var protocol = document.location.protocol;
|
var protocol = document.location.protocol;
|
||||||
protocol = protocol.substring(0, protocol.indexOf(":"));
|
protocol = protocol.substring(0, protocol.indexOf(":"));
|
||||||
this.form.protocal = protocol;
|
this.form.protocal = protocol;
|
||||||
|
this.form.workspaceId = getCurrentWorkspaceId();
|
||||||
|
this.form.createUser = getCurrentUserId();
|
||||||
this.result = this.$post("/project/" + saveType, this.form, () => {
|
this.result = this.$post("/project/" + saveType, this.form, () => {
|
||||||
this.createVisible = false;
|
this.createVisible = false;
|
||||||
this.list();
|
this.list();
|
||||||
|
|
|
@ -221,7 +221,7 @@ import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {
|
import {
|
||||||
getCurrentOrganizationId,
|
getCurrentOrganizationId,
|
||||||
getCurrentProjectID,
|
getCurrentProjectID,
|
||||||
getCurrentUser,
|
getCurrentUser, getCurrentUserId,
|
||||||
getCurrentWorkspaceId,
|
getCurrentWorkspaceId,
|
||||||
listenGoBack,
|
listenGoBack,
|
||||||
removeGoBackListener
|
removeGoBackListener
|
||||||
|
@ -392,6 +392,8 @@ export default {
|
||||||
var protocol = document.location.protocol;
|
var protocol = document.location.protocol;
|
||||||
protocol = protocol.substring(0, protocol.indexOf(":"));
|
protocol = protocol.substring(0, protocol.indexOf(":"));
|
||||||
this.form.protocal = protocol;
|
this.form.protocal = protocol;
|
||||||
|
this.form.workspaceId = getCurrentWorkspaceId();
|
||||||
|
this.form.createUser = getCurrentUserId();
|
||||||
this.result = this.$post("/project/" + saveType, this.form, () => {
|
this.result = this.$post("/project/" + saveType, this.form, () => {
|
||||||
this.createVisible = false;
|
this.createVisible = false;
|
||||||
Message.success(this.$t('commons.save_success'));
|
Message.success(this.$t('commons.save_success'));
|
||||||
|
|
Loading…
Reference in New Issue