feat: Implement user ID duplication check in user registration and update processes
- Added functionality to check for existing user IDs during new user registration and updates to prevent overwriting accounts from different companies. - Enhanced error handling to return appropriate messages when a duplicate user ID is detected. - Updated the frontend to include user ID duplication verification, ensuring a smoother user experience during user creation and editing. - These changes aim to improve data integrity and user management across multiple company implementations.
This commit is contained in:
@@ -502,7 +502,8 @@ class NumberingRuleService {
|
||||
|
||||
let baseSequence = currentCounter;
|
||||
|
||||
// 2. 규칙에 tableName/columnName이 설정되어 있으면 대상 테이블에서 MAX 조회
|
||||
// 2. 규칙에 tableName/columnName이 설정되어 있으면 대상 테이블에서 MAX만 사용 (순수 MAX+1 방식)
|
||||
// - 삭제된 번호 재사용 가능 (카운터 값 무시)
|
||||
if (rule.tableName && rule.columnName) {
|
||||
try {
|
||||
const sortedParts = [...rule.parts].sort((a: any, b: any) => a.order - b.order);
|
||||
@@ -515,12 +516,10 @@ class NumberingRuleService {
|
||||
psInfo.prefix, psInfo.suffix, psInfo.seqLength, companyCode
|
||||
);
|
||||
|
||||
if (maxFromTable > baseSequence) {
|
||||
logger.info("테이블 내 최대값이 카운터보다 높음 → 동기화", {
|
||||
ruleId, companyCode, currentCounter, maxFromTable,
|
||||
});
|
||||
baseSequence = maxFromTable;
|
||||
}
|
||||
logger.info("테이블 MAX 기준 채번", {
|
||||
ruleId, companyCode, currentCounter, maxFromTable,
|
||||
});
|
||||
baseSequence = maxFromTable;
|
||||
}
|
||||
} catch (error: any) {
|
||||
logger.warn("테이블 기반 MAX 조회 실패, 카운터 기반 폴백", {
|
||||
@@ -1422,7 +1421,7 @@ class NumberingRuleService {
|
||||
? 0
|
||||
: await this.getSequenceForPrefix(pool, ruleId, companyCode, prefixKey);
|
||||
|
||||
// 대상 테이블에서 실제 최대 시퀀스 조회
|
||||
// 대상 테이블에서 실제 최대 시퀀스만 사용 (순수 MAX+1)
|
||||
let baseSeq = currentSeq;
|
||||
if (rule.tableName && rule.columnName) {
|
||||
try {
|
||||
@@ -1436,13 +1435,10 @@ class NumberingRuleService {
|
||||
psInfo.prefix, psInfo.suffix, psInfo.seqLength, companyCode
|
||||
);
|
||||
|
||||
|
||||
if (maxFromTable > baseSeq) {
|
||||
logger.info("미리보기: 테이블 내 최대값이 카운터보다 높음", {
|
||||
ruleId, companyCode, currentSeq, maxFromTable,
|
||||
});
|
||||
baseSeq = maxFromTable;
|
||||
}
|
||||
logger.info("미리보기: 테이블 MAX 기준 채번", {
|
||||
ruleId, companyCode, currentSeq, maxFromTable,
|
||||
});
|
||||
baseSeq = maxFromTable;
|
||||
}
|
||||
} catch (error: any) {
|
||||
logger.warn("미리보기: 테이블 기반 MAX 조회 실패, 카운터 기반 폴백", {
|
||||
|
||||
Reference in New Issue
Block a user