Browse Source

人员添加判重

dev
巴林闲侠 3 years ago
parent
commit
81f0a72620
  1. 9
      api/app/lib/controllers/organization/index.js
  2. 10
      api/app/lib/controllers/project/bind.js
  3. 4
      script/0.0.3/2.alter table project_correlation.sql
  4. 7
      script/0.0.3/2.alter_table_project_correlation.sql

9
api/app/lib/controllers/organization/index.js

@ -36,7 +36,14 @@ async function editUser (ctx) {
pepUserId pepUserId
} }
}) })
if (existUserRes && !existUserRes.deleted && !pomsUserId) { if (
existUserRes && !existUserRes.deleted && !pomsUserId &&
(
(existUserRes.role.includes('admin') && role.includes('admin'))
|| (!existUserRes.role.includes('admin') && !role.includes('admin'))
// 都有或都没有管理员
)
) {
// 新增已存在未删除 // 新增已存在未删除
throw '人员账号已添加' throw '人员账号已添加'
} }

10
api/app/lib/controllers/project/bind.js

@ -6,8 +6,18 @@ async function bindAnxin2pep (ctx) {
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
const { bindId, name, pepProjectId, anxinProjectId = [], app = [] } = ctx.request.body const { bindId, name, pepProjectId, anxinProjectId = [], app = [] } = ctx.request.body
const existRes = await models.ProjectCorrelation.findOne({
where: {
pepProjectId: pepProjectId
}
})
if (bindId) { if (bindId) {
} else {
if (existRes) {
throw '当前项企项目已绑定'
}
} }
ctx.status = 20; ctx.status = 20;

4
script/0.0.3/2.alter table project_correlation.sql

@ -1,4 +0,0 @@
alter table project_correlation drop column pep_project_id;
alter table project_correlation
add pep_project_id int not null;

7
script/0.0.3/2.alter_table_project_correlation.sql

@ -0,0 +1,7 @@
alter table project_correlation drop column pep_project_id;
alter table project_correlation
add pep_project_id int not null;
alter table project_correlation
add del bool default false;
Loading…
Cancel
Save