[BO] 관리자 에러 수정

This commit is contained in:
kangsunlee
2025-07-15 12:04:36 +09:00
parent cb8525c7b2
commit 2ed5495ac6
19 changed files with 408 additions and 383 deletions

View File

@@ -15,9 +15,17 @@ import org.springframework.web.bind.annotation.RestController;
class AdminIdDuplicateCheckPostController { class AdminIdDuplicateCheckPostController {
private final CheckAdminIdPortIn checkAdminIdPortIn; private final CheckAdminIdPortIn checkAdminIdPortIn;
private final String ID_REGEX = "^[a-zA-Z0-9가-힣_-]{4,15}$";
private final String INVALID_ID_MSG = "아이디는 4~15자, 영문/숫자/한글/특수문자(_,-)만 가능합니다.";
@GetMapping("/api/settings/admin/idCheck") @GetMapping("/api/settings/admin/idCheck")
ResponseEntity<?> selectIdCheck(@RequestParam String id ) { ResponseEntity<?> selectIdCheck(@RequestParam String id ) {
if (!id.matches(ID_REGEX)) {
return ResponseEntity
.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(INVALID_ID_MSG);
}
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id)); return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
} }
} }

View File

@@ -28,4 +28,5 @@ public class AdminCreateBindingVO {
private Boolean accountDisabled; private Boolean accountDisabled;
/* private Boolean accountLocked;*/ /* private Boolean accountLocked;*/
private String roleId; private String roleId;
private Boolean checkDuplicate;
} }

View File

@@ -24,51 +24,68 @@ public class AdminCreateValidator implements Validator {
public void validate(Object target, Errors errors) { public void validate(Object target, Errors errors) {
AdminCreateBindingVO vo = (AdminCreateBindingVO) target; AdminCreateBindingVO vo = (AdminCreateBindingVO) target;
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) { // [1] 필수값 누락 체크
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요."); if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
return;
}
if(vo.getId() == null || vo.getId().isBlank()) {
errors.rejectValue("id", "error.id", "필수입력항목을 확인해주세요.");
return;
}
if(vo.getPassword() == null || vo.getPassword().isBlank()) {
errors.rejectValue("password", "error.password", "필수입력항목을 확인해주세요.");
return;
} }
if (vo.getAccountDisabled() == null ) { // 권한 조사원으로 선택했을 경우
errors.rejectValue("accountDisabled", "error.accountDisabled", "사용여부를 선택해주세요."); if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
} if(vo.getName() == null || vo.getName().isEmpty()) {
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "id", "valid.common.required","아이디는 필수입력값입니다."); return;
Optional.ofNullable(vo.getId())
.filter(id -> !id.matches(ID_REGEX))
.ifPresent(id -> errors.rejectValue("id", "valid.common.id.wrong","아이디를 4~15자, 영문/숫자/한글/특수문자(_,-) 입니다."));
// 비밀번호 유효성 검사
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "valid.common.required","비밀번호는 필수입력값입니다.");
Optional.ofNullable(vo.getPassword())
.filter(password -> !password.matches(PASSWORD_REGEX))
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다."));
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
if (vo.getName() == null || vo.getName().isBlank()) {
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
} }
if (vo.getName().length() > 10) { if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("name", "error.name", "이름은 10자까지 입력가능합니다."); errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
return;
} }
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) { if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요."); errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
} else if (!vo.getPhone1().matches("^\\d{4}$")) { return;
}
if (!vo.getPhone1().matches("^\\d{4}$")) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다."); errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
return;
} }
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) { if (!vo.getPhone2().matches("^\\d{4}$")) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다."); errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
return;
} }
} }
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
if(vo.getAccountDisabled() == null) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
return;
}
// ROLE_ADMIN이 아닌 경우 실사지역 null체크
Optional.ofNullable(vo.getRoleId()) Optional.ofNullable(vo.getRoleId())
.filter(id -> !id.equals("ROLE_ADMIN")) .filter(id -> !id.equals("ROLE_ADMIN"))
.ifPresent(nonAdmins -> { .ifPresent(nonAdmins -> {
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) { if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
errors.rejectValue("regionMainCode", "valid.common.required","실사지역은 필수입력값입니다."); errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
} }
}); });
// [2] 아이디 중복 확인 여부
if (vo.getCheckDuplicate() == null || !vo.getCheckDuplicate()) {
errors.rejectValue("checkDuplicate", "error.checkDuplicate", "아이디 중복 확인을 먼저 진행해주세요.");
return;
}
// [3] 비밀번호 형식 검사
if (!vo.getPassword().matches(PASSWORD_REGEX)) {
errors.rejectValue("password", "valid.common.password.wrong",
"비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.");
}
} }
} }

View File

@@ -22,39 +22,55 @@ public class AdminUpdateValidator implements Validator {
public void validate(Object target, Errors errors) { public void validate(Object target, Errors errors) {
AdminUpdateBindingVO vo = (AdminUpdateBindingVO) target; AdminUpdateBindingVO vo = (AdminUpdateBindingVO) target;
if (vo.getRoleId() == null || vo.getRoleId().isEmpty()) { // [1] 필수값 누락 체크
errors.rejectValue("roleId", "error.roleId", "권한을 선택해주세요."); if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
return;
} }
Optional.ofNullable(vo.getUpdatePassword()) // 권한 조사원으로 선택했을 경우
.filter(password -> !password.trim().isEmpty() && !password.matches(PASSWORD_REGEX)) if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
.ifPresent(password -> errors.rejectValue("updatePassword", "valid.common.password.wrong","비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.")); if(vo.getName() == null || vo.getName().isEmpty()) {
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
if (vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) { return;
if (vo.getName() == null || vo.getName().isBlank()) {
errors.rejectValue("name", "error.name", "이름을 입력해주세요.");
} }
if (vo.getName().length() > 10) { if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
errors.rejectValue("name", "error.name", "이름은 10자까지 입력가능합니다."); errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
return;
} }
if (vo.getPhone1() == null || vo.getPhone1().isBlank()) { if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리를 입력해주세요."); errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
} else if (!vo.getPhone1().matches("^\\d{4}$")) { return;
}
if (!vo.getPhone1().matches("^\\d{4}$")) {
errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다."); errors.rejectValue("phone1", "error.phone1", "전화번호 앞자리는 4자리 숫자여야 합니다.");
return;
} }
if (vo.getPhone2() == null || vo.getPhone2().isBlank()) { if (!vo.getPhone2().matches("^\\d{4}$")) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리를 입력해주세요.");
} else if (!vo.getPhone2().matches("^\\d{4}$")) {
errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다."); errors.rejectValue("phone2", "error.phone2", "전화번호 뒷자리는 4자리 숫자여야 합니다.");
return;
} }
} }
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
// 사용여부
if(vo.getAccountDisabled() == null) {
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
return;
}
// ROLE_ADMIN이 아닌 경우 실사지역 null체크
Optional.ofNullable(vo.getRoleId()) Optional.ofNullable(vo.getRoleId())
.filter(id -> !id.equals("ROLE_ADMIN")) .filter(id -> !id.equals("ROLE_ADMIN"))
.ifPresent(nonAdmins -> { .ifPresent(nonAdmins -> {
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) { if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
errors.rejectValue("regionMainCode", "valid.common.required","실사지역을 선택해주세요."); errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
} }
}); });
// [2] 비밀번호 형식 검사
if (!vo.getUpdatePassword().matches(PASSWORD_REGEX)) {
errors.rejectValue("updatePassword", "valid.common.password.wrong",
"비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.");
}
} }
} }

View File

@@ -15,11 +15,6 @@ class SaveHouseholdVisitInfoDao implements SaveHouseholdVisitInfoPortOut {
@Override @Override
@Transactional @Transactional
public void operate(SaveHouseholdVisitInfoCmd cmd) { public void operate(SaveHouseholdVisitInfoCmd cmd) {
// 답례품 전달 완료일 경우 기존 방문들 중 true → false로 변경
if (Boolean.TRUE.equals(cmd.getIsGiftSent())) {
mapper.updateGiftSentToFalse(AuditUtil.update(cmd));
}
if (cmd.getVisitInfoId() != null) { if (cmd.getVisitInfoId() != null) {
mapper.findById(cmd.getHouseholdSeq()) mapper.findById(cmd.getHouseholdSeq())
.ifPresentOrElse(v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)), .ifPresentOrElse(v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)),
@@ -29,5 +24,10 @@ class SaveHouseholdVisitInfoDao implements SaveHouseholdVisitInfoPortOut {
} else { } else {
mapper.createHouseholdVisitInfo(AuditUtil.create(cmd)); mapper.createHouseholdVisitInfo(AuditUtil.create(cmd));
} }
// 답례품 전달 완료일 경우 기존 방문들 중 true → false로 변경
if (Boolean.TRUE.equals(cmd.getIsGiftSent())) {
mapper.updateGiftSentToFalse(AuditUtil.update(cmd));
}
} }
} }

View File

@@ -67,11 +67,13 @@ public class ResearcherDao implements ResearcherPortOut {
@Override @Override
@UpdateCommand @UpdateCommand
public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) { public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) {
if(Boolean.TRUE.equals(reqVO.getIsGiftSent())) { int updated = researcherMapper.updateVisitHousehold(reqVO);
if (Boolean.TRUE.equals(reqVO.getIsGiftSent())) {
researcherMapper.updateGiftSentToFalse(reqVO); researcherMapper.updateGiftSentToFalse(reqVO);
} }
return researcherMapper.updateVisitHousehold(reqVO); return updated;
} }
@Override @Override

View File

@@ -25,13 +25,18 @@
AND rhh.is_deleted = false AND rhh.is_deleted = false
WHERE a.is_deleted = false AND a.account_disabled = false WHERE a.is_deleted = false AND a.account_disabled = false
<if test="cmd.searchField != null and cmd.searchField != '' and cmd.searchValue != ''"> <if test="cmd.searchValue != null and cmd.searchValue != ''">
/* 조사원 검색 */ /* 조사원 검색 */
<choose> <choose>
<when test="cmd.searchField == ''">
AND (
a.name ILIKE '%' || #{cmd.searchValue} || '%'
OR a.phone ILIKE '%' || #{cmd.searchValue} || '%'
)
</when>
<when test="cmd.searchField eq 'name'"> <when test="cmd.searchField eq 'name'">
AND a.name ILIKE '%' || #{cmd.searchValue} || '%' AND a.name ILIKE '%' || #{cmd.searchValue} || '%'
</when> </when>
<when test="cmd.searchField eq 'phone'"> <when test="cmd.searchField eq 'phone'">
AND a.phone ILIKE '%' || #{cmd.searchValue} || '%' AND a.phone ILIKE '%' || #{cmd.searchValue} || '%'
</when> </when>

View File

@@ -44,8 +44,10 @@
WHERE household_seq = #{householdSeq} WHERE household_seq = #{householdSeq}
AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(TO_DATE(#{visitDate}, 'YYYY-MM-DD'), 'YYYYMM') AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(TO_DATE(#{visitDate}, 'YYYY-MM-DD'), 'YYYYMM')
AND is_gift_sent = true AND is_gift_sent = true
AND (#{visitInfoId} IS NULL OR id != #{visitInfoId})
AND is_deleted = false AND is_deleted = false
<if test="visitInfoId != null">
AND id != #{visitInfoId}
</if>
</update> </update>
<select id="findById" resultType="java.lang.Long"> <select id="findById" resultType="java.lang.Long">

View File

@@ -156,7 +156,7 @@
<if test="searchMonth != null and searchMonth != ''"> <if test="searchMonth != null and searchMonth != ''">
and TO_CHAR(rhv.visit_date ,'YYYYMM')= #{searchMonth} and TO_CHAR(rhv.visit_date ,'YYYYMM')= #{searchMonth}
</if> </if>
order by rhv.visit_date order by rhv.visit_date, h.household_num
</select> </select>
<select id="selectVisitHouseholdPercentage"> <select id="selectVisitHouseholdPercentage">
@@ -253,8 +253,8 @@
WHERE household_seq = #{householdSeq} WHERE household_seq = #{householdSeq}
AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(#{visitDate}, 'YYYYMM') AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(#{visitDate}, 'YYYYMM')
AND is_gift_sent = true AND is_gift_sent = true
AND (#{id} IS NULL OR id != #{id})
AND is_deleted = false AND is_deleted = false
AND id != #{id}
</update> </update>
<update id="updateVisitHousehold"> <update id="updateVisitHousehold">

View File

@@ -2,8 +2,8 @@ uri=Home
uri.admin.settings=Settings uri.admin.settings=Settings
uri.admin.settings.admins.group=\uAD00\uB9AC\uC790 & \uC5ED\uD560 uri.admin.settings.admins.group=\uAD00\uB9AC\uC790 & \uC5ED\uD560
uri.admin.settings.admins=\uAD00\uB9AC\uC790 uri.admin.settings.admins=\uAD00\uB9AC\uC790
uri.admin.settings.admins.create=\uB4F1\uB85D uri.admin.settings.admins.create=\uAD00\uB9AC\uC790 \uB4F1\uB85D
uri.admin.settings.admins.update.{{pathVar}}=\uC218\uC815 uri.admin.settings.admins.update.{{pathVar}}=\uAD00\uB9AC\uC790 \uC218\uC815
uri.admin.settings.uri.admin=URI \uAD00\uB9AC (Admin) uri.admin.settings.uri.admin=URI \uAD00\uB9AC (Admin)
uri.admin.settings.uri.front=URI \uAD00\uB9AC (Front) uri.admin.settings.uri.front=URI \uAD00\uB9AC (Front)
uri.admin.settings.uicode=UI \uCF54\uB4DC \uAD00\uB9AC uri.admin.settings.uicode=UI \uCF54\uB4DC \uAD00\uB9AC

View File

@@ -9,166 +9,155 @@
th:action="@{/settings/admins/create}" th:action="@{/settings/admins/create}"
th:object="${bindingVO}" th:object="${bindingVO}"
name="adminCreateForm"> name="adminCreateForm">
<div class="content-inner">
<table class="type-form">
<colgroup>
<col width="8%" />
<col width="33.3%" />
<col width="8%" />
<col width="33.3%" />
</colgroup>
<table class="type-form"> <tbody>
<tbody> <tr>
<tr> <th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<th><label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th> <td>
<td> <div class="d-flex">
<div class="d-flex"> <div class="component-input">
<div class="component-input"> <div class="component-select">
<select class="select-list" id="roleId"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
th:field="*{roleId}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th>ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
<td>
<div class="d-flex">
<div class="component-input">
<div class="d-flex">
<div class="input-field">
<input id="id"
name="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"
maxlength="15"
oninput="checkDuplicate = false;"/>
</div>
<button type="button" class="btn" onclick="adminIdCheckDuplicate();">
<span class="btn-txt">중복확인</span>
</button>
</div>
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span>
</div>
</div>
</td>
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="password" type="password" maxlength="5"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"/>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${bindingVO.roleId == 'ROLE_LOCAL_INSPECTOR'} ? 'd-none'">
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="name" type="text" name="name"
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
th:field="*{name}" maxlength="10"/>
</div>
</div>
</td>
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" required>
<option value="value1" selected>010</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone1" name="phone1" placeholder="" th:field="*{phone1}"
maxlength="4" oninput="limitMaxLength(this);">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder="" th:field="*{phone2}"
maxlength="4" oninput="limitMaxLength(this);">
</div>
</div>
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select"> <div class="component-select">
<select class="select-list" id="roleId" <select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'" th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{roleId}" th:field="*{regionMainCode}">
onchange="onRoleChange(this);">
<option value="">선택</option> <option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}" <option th:each="code : ${regionMainCode}"
th:value="${role.id}"></option> th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select> </select>
</div> </div>
<div class="invalid-feedback fw-bold" th:errors="*{roleId}" </td>
th:if="${#fields.hasErrors('roleId')}"> </tr>
에러 메세지 <tr>
<th><label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" name="accountDisabled" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div> </div>
</div> <div class="component-input">
</div> <label for="inlineRadio2" class="radio-inner">
</td> <input id="inlineRadio2" name="accountDisabled" type="radio" value="false" checked>
</tr> <span class="radio-item">
<tr> <span class="radio-txt">사용</span>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th> </span>
<td> </label>
<div class="component-input">
<div class="input-field">
<input id="id"
name="id"
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
th:field="*{id}"/>
<button type="button" class="btn btn-primary" onclick="adminIdCheckDuplicate();">
<span class="btn-txt">중복확인</span>
</button>
<div class="invalid-feedback fw-bold" th:errors="*{id}"
th:if="${#fields.hasErrors('id')}">
에러 메세지
</div> </div>
</div> </td>
<span>4~15자 / 영문,숫자,한글 가능/ 특수문자 _,- 사용가능</span> </tr>
</div> </tbody>
</td> </table>
<th><label for="password">Password<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="password" type="password"
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
th:field="*{password}"/>
<div class="invalid-feedback fw-bold" th:errors="*{password}"
th:if="${#fields.hasErrors('password')}">
에러 메세지
</div>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${bindingVO.roleId == 'ROLE_LOCAL_INSPECTOR'} ? 'd-none'">
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="name" type="text" name="name"
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
th:field="*{name}" maxlength="10"/>
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('name')}">
에러 메세지
</div>
</div>
</div>
</td>
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-select">
<select class="select-list" required>
<option value="value1" selected>010</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone1" name="phone1" placeholder="" th:field="*{phone1}" maxlength="4">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder="" th:field="*{phone2}" maxlength="4">
</div>
</div>
</div>
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('phone1')}">
에러 메세지
</div>
</td>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${bindingVO.roleId != 'ROLE_ADMIN'} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th><label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false" checked>
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</td>
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group"> <div class="component-btns bottom-btn-group">
<div class="btns-row align-right"> <div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;"> <button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">목록으로 이동</span> <span class="btn-txt">취소</span>
</button> </button>
<button type="button" class="btn btn-primary" onclick="createAdmin();"> <button type="button" class="btn btn-primary" onclick="createAdmin();">
<span class="btn-txt">저장</span> <span class="btn-txt">등록</span>
</button> </button>
</div>
</div> </div>
</div> </div>
</form> </form>
@@ -187,8 +176,8 @@
$(document).ready(() => { $(document).ready(() => {
const roleSelect = document.getElementById('roleId'); const roleSelect = document.getElementById('roleId');
onRoleChange(roleSelect); onRoleChange(roleSelect);
}); });
const onRoleChange = (el) => { const onRoleChange = (el) => {
const selectedValues = Array.from(el.selectedOptions).map(option => option.value); const selectedValues = Array.from(el.selectedOptions).map(option => option.value);
const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN'); const isAdmin = !selectedValues.length || selectedValues.includes('ROLE_ADMIN');
@@ -218,19 +207,19 @@
function (code, rstData) { function (code, rstData) {
console.log("error : ", code); console.log("error : ", code);
if(code == 400) alert("아이디를 입력해주세요."); if(code == 400) alert("아이디를 입력해주세요.");
if(code == 422) alert(rstData.responseText);
checkDuplicate = false;
}, },
'get', 'get',
'json' 'json',
{ handle422Type: 'alert' }
); );
} }
const createAdmin = () => {
if (!checkDuplicate) {
alert("아이디 중복 확인을 해주세요.");
return false;
}
const createAdmin = () => {
const f = document.adminCreateForm; const f = document.adminCreateForm;
let dataOj = $(f).serializeObject(); let dataOj = $(f).serializeObject();
dataOj.checkDuplicate = checkDuplicate;
ajaxUtil._ajaxMethod( ajaxUtil._ajaxMethod(
'/api/settings/admin/create', '/api/settings/admin/create',

View File

@@ -13,161 +13,150 @@
<input type="hidden" name="seq" th:field="*{seq}"/> <input type="hidden" name="seq" th:field="*{seq}"/>
<table class="type-form"> <table class="type-form">
<colgroup>
<col width="8%" />
<col width="33.3%" />
<col width="8%" />
<col width="33.3%" />
</colgroup>
<tbody> <tbody>
<tr> <tr>
<th> <label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th> <th> <label for="roleId">권한<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td> <td>
<div class="d-flex"> <div class="d-flex">
<div class="component-input">
<div class="component-select">
<select class="select-list" id="roleId"
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'"
th:field="*{roleId}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input"> <div class="component-input">
<div class="input-field">
<input id="id" readonly="readonly" maxlength="15" th:field="*{id}"/>
</div>
</div>
</td>
<th><label for="updatePassword">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="updatePassword" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password" maxlength="5"/>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="name" type="text" name="name"
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
th:field="*{name}" maxlength="10" />
</div>
</div>
</td>
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-select"> <div class="component-select">
<select class="select-list" id="roleId" <select class="select-list" required>
th:classappend="${#fields.hasErrors('roleId')} ? 'is-invalid'" <option value="value1" selected>010</option>
th:field="*{roleId}"
onchange="onRoleChange(this);">
<option value="">선택</option>
<option th:each="role : ${roles}" th:text="${role.description}"
th:value="${role.id}"></option>
</select> </select>
</div> </div>
<div class="invalid-feedback fw-bold" th:errors="*{roleId}" <div class="component-input">
th:if="${#fields.hasErrors('roleId')}"> <div class="input-field">
에러 메세지 <input type="number" id="phone1" name="phone1" placeholder=""
maxlength="4" oninput="limitMaxLength(this);"
th:value="${bindingVO.phone1 != null ? bindingVO.phone1 : ''}">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="number" id="phone2" name="phone2" placeholder=""
maxlength="4" oninput="limitMaxLength(this);"
th:value="${bindingVO.phone2 != null ? bindingVO.phone2 : ''}">
</div>
</div> </div>
</div> </div>
</div> </td>
</td> </tr>
</tr> <tr class="regionMainCodeArea"
<tr> th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_ADMIN')} ? 'd-none'">
<th><label for="id">ID<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th> <th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td> <td>
<div class="component-input">
<div class="input-field">
<input id="id" readonly="readonly" th:field="*{id}"/>
</div>
</div>
</td>
<th><label for="updatePassword">비밀번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="updatePassword" placeholder="암호를 변경하고 싶다면 입력하세요"
th:classappend="${#fields.hasErrors('updatePassword')} ? 'is-invalid'"
th:field="*{updatePassword}"
type="password"/>
<div class="invalid-feedback fw-bold" th:errors="*{updatePassword}"
th:if="${#fields.hasErrors('updatePassword')}">
에러 메세지
</div>
</div>
<span>총 5자 / 숫자 + 특수문자 1개 이상 (!,@,#,$,%,_,-)</span>
</div>
</td>
</tr>
<tr class="researcherArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_LOCAL_INSPECTOR')} ? 'd-none'">
<th><label for="name">이름<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-input">
<div class="input-field">
<input id="name" type="text" name="name"
th:classappend="${#fields.hasErrors('name')} ? 'is-invalid'"
th:field="*{name}" maxlength="10" />
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('name')}">
에러 메세지
</div>
</div>
</div>
</td>
<th><label for="name">전화번호<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="d-flex">
<div class="component-select"> <div class="component-select">
<select class="select-list" required> <select class="select-list" id="regionMainCode" name="regionMainCode"
<option value="value1" selected>010</option> th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select> </select>
</div> </div>
<div class="component-input"> <div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
<div class="input-field"> th:if="${#fields.hasErrors('regionMainCode')}">
<input type="number" id="phone1" name="phone1" placeholder="" maxlength="4"
th:value="${bindingVO.phone1 != null ? bindingVO.phone1 : ''}">
</div>
</div>
<div class="invalid-feedback fw-bold"
th:if="${#fields.hasErrors('phone1')}">
에러 메세지 에러 메세지
</div> </div>
</td>
</tr>
<tr>
<th> <label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input"> <div class="component-input">
<div class="input-field"> <label for="inlineRadio1" class="radio-inner">
<input type="number" id="phone2" name="phone2" placeholder="" maxlength="4" <input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
th:value="${bindingVO.phone2 != null ? bindingVO.phone2 : ''}"> <span class="radio-item">
</div> <span class="radio-txt">미사용</span>
</span>
</label>
</div> </div>
<div class="invalid-feedback fw-bold" <div class="component-input">
th:if="${#fields.hasErrors('phone2')}"> <label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지 에러 메세지
</div> </div>
</div> </td>
</td> </tr>
</tr>
<tr class="regionMainCodeArea"
th:classappend="${#lists.isEmpty(bindingVO.roleId) or #lists.contains(bindingVO.roleId, 'ROLE_ADMIN')} ? 'd-none'">
<th><label for="regionMainCode">실사<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td>
<div class="component-select">
<select class="select-list" id="regionMainCode" name="regionMainCode"
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
th:field="*{regionMainCode}">
<option value="">선택</option>
<option th:each="code : ${regionMainCode}"
th:value="${code.id}"
th:text="${code.codeText}">
</option>
</select>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
th:if="${#fields.hasErrors('regionMainCode')}">
에러 메세지
</div>
</td>
</tr>
<tr>
<th> <label>사용 여부<i class="ico-required-mark" role="img" aria-label="필수">*</i></label></th>
<td class="radio-group">
<div class="component-input">
<label for="inlineRadio1" class="radio-inner">
<input id="inlineRadio1" th:field="*{accountDisabled}" type="radio" value="true">
<span class="radio-item">
<span class="radio-txt">미사용</span>
</span>
</label>
</div>
<div class="component-input">
<label for="inlineRadio2" class="radio-inner">
<input id="inlineRadio2" th:field="*{accountDisabled}" type="radio" value="false">
<span class="radio-item">
<span class="radio-txt">사용</span>
</span>
</label>
</div>
<div class="invalid-feedback fw-bold" th:errors="*{accountDisabled}"
th:if="${#fields.hasErrors('accountDisabled')}">
에러 메세지
</div>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<!-- <div th:replace="common/components :: auditArea"></div>--> <!-- <div th:replace="common/components :: auditArea"></div>-->
<div class="component-btns bottom-btn-group"> <div class="component-btns bottom-btn-group">
<div class="btns-row"> <div class="btns-row align-right">
<button type="button" class="btn btn-secondary" onclick="gotoList();return false;"> <button type="button" class="btn btn-secondary" onclick="gotoList();return false;">
<span class="btn-txt">목록</span> <span class="btn-txt">취소</span>
</button> </button>
<button type="button" class="btn btn-primary" onclick="updateAdmin();"> <button type="button" class="btn btn-primary" onclick="updateAdmin();">
<span class="btn-txt">저장</span> <span class="btn-txt">등록</span>
</button> </button>
</div> </div>
</div> </div>

View File

@@ -3,7 +3,7 @@
layout:decorate="~{layout/layout}"> layout:decorate="~{layout/layout}">
<div class="layer-wrap" th:fragment="modalFragment"> <div class="layer-wrap" th:fragment="modalFragment">
<form autocomplete="off" method="get" name="reqResearcherForm"> <form autocomplete="off" method="get" name="reqResearcherForm" onsubmit="return false;">
<input name="page" value="0" type="hidden"/> <input name="page" value="0" type="hidden"/>
<input name="size" value="10" type="hidden"> <input name="size" value="10" type="hidden">
@@ -38,7 +38,9 @@
</div> </div>
<div class="component-input"> <div class="component-input">
<div class="input-field"> <div class="input-field">
<input type="text" id="searchField" name="searchValue" placeholder=""> <input type="text" id="searchField"
name="searchValue" placeholder=""
onkeydown="if(event.key === 'Enter'){ event.preventDefault(); getResearchers(0); }">
</div> </div>
</div> </div>
</div> </div>

View File

@@ -197,7 +197,9 @@
<div class="d-flex"> <div class="d-flex">
<div class="component-input"> <div class="component-input">
<div class="input-field"> <div class="input-field">
<input type="text" name="researcherName" id="researcherName" placeholder=""> <input type="text" name="researcherName" id="researcherName"
placeholder="" readonly
style="background-color: #fff; color: #000; cursor: default;">
</div> </div>
</div> </div>
<button type="button" class="btn" onclick="showResearcherModal();"> <button type="button" class="btn" onclick="showResearcherModal();">

View File

@@ -213,8 +213,9 @@
<div class="component-input"> <div class="component-input">
<div class="input-field"> <div class="input-field">
<input type="text" name="researcherName" id="researcherName" <input type="text" name="researcherName" id="researcherName"
placeholder="" placeholder="" readonly
th:value="${householdInfo.researcherName}"> th:value="${householdInfo.researcherName}"
style="background-color: #fff; color: #000; cursor: default;">
<input type="hidden" name="researcherSeq" id="researcherSeq" <input type="hidden" name="researcherSeq" id="researcherSeq"
th:value="${householdInfo.researcherSeq}"> th:value="${householdInfo.researcherSeq}">
</div> </div>

View File

@@ -3,7 +3,7 @@
layout:decorate="~{layout/layout}"> layout:decorate="~{layout/layout}">
<section layout:fragment="content"> <section layout:fragment="content">
<form autocomplete="off" method="get" name="reqForm"> <form autocomplete="off" method="get" name="reqForm" onsubmit="return false;">
<input type="hidden" name="householdSeq" th:value="${seq}"> <input type="hidden" name="householdSeq" th:value="${seq}">
<div class="content-inner"> <div class="content-inner">

View File

@@ -60,8 +60,10 @@
<button type="button" class="tab-label" data-tab-value="tab1">담당 임가 목록</button> <button type="button" class="tab-label" data-tab-value="tab1">담당 임가 목록</button>
<button type="button" class="tab-label" data-tab-value="tab2">임가방문정보</button> <button type="button" class="tab-label" data-tab-value="tab2">임가방문정보</button>
<div class="component-select select-date" id="monthTab2" style="display: none;"> <div class="component-select select-date" id="monthTab2" style="display: none;">
<select name="searchMonth" class="select-list search-month-container" onchange="getHouseholdVisitList();"> <select name="searchMonth" class="select-list search-month-container"
<option th:each="month : ${monthList}" onchange="getVisitHouseholdPercentage();
getHouseholdVisitList();">
<option th:each="month : ${monthList}"
th:value="${month.value}" th:value="${month.value}"
th:text="${month.label}" th:text="${month.label}"
th:selected="${month.value == currentMonth}"> th:selected="${month.value == currentMonth}">
@@ -150,7 +152,7 @@
<th>방문일</th> <th>방문일</th>
<th>관리분야</th> <th>관리분야</th>
<th>내용</th> <th>내용</th>
<th>작성일</th> <th>최종 수정자</th>
<th>답례품 전달</th> <th>답례품 전달</th>
</tr> </tr>
</thead> </thead>
@@ -272,7 +274,7 @@
} }
// 임가 방문 퍼센트 // 임가 방문 퍼센트
const getVisitHouseholdPercentage=()=>{ const getVisitHouseholdPercentage = () => {
const f = document.householdReqForm; const f = document.householdReqForm;
let dataObj = { let dataObj = {

View File

@@ -19,7 +19,7 @@
</div> </div>
<div class="component-input"> <div class="component-input">
<div class="input-field"> <div class="input-field">
<input type="text" id="floatingInput" name="username" placeholder="아이디 입력"> <input type="text" id="floatingInput" name="username" placeholder="아이디 입력" maxlength="15">
</div> </div>
</div> </div>
</div> </div>

View File

@@ -23,8 +23,14 @@
LEFT JOIN uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code LEFT JOIN uicode u ON u.parent_id = 'code.region.main' AND u.id = a.region_main_code
WHERE a.is_deleted = false WHERE a.is_deleted = false
<if test="cmd.searchField != null and cmd.searchValue != null and cmd.searchValue != ''"> <if test="cmd.searchValue != null and cmd.searchValue != ''">
<choose> <choose>
<when test="cmd.searchField == ''">
AND (
a.id ILIKE '%' || #{cmd.searchValue} || '%'
OR a.name ILIKE '%' || #{cmd.searchValue} || '%'
)
</when>
<when test="cmd.searchField == 'name'">AND a.name LIKE '%' || #{cmd.searchValue} || '%'</when> <when test="cmd.searchField == 'name'">AND a.name LIKE '%' || #{cmd.searchValue} || '%'</when>
<when test="cmd.searchField == 'id'">AND a.id LIKE '%' || #{cmd.searchValue} || '%'</when> <when test="cmd.searchField == 'id'">AND a.id LIKE '%' || #{cmd.searchValue} || '%'</when>
</choose> </choose>
@@ -48,24 +54,7 @@
) )
</if> </if>
<if test="pageable.sort != null and !pageable.sort.isEmpty()"> ORDER BY a.seq DESC
ORDER BY
<foreach collection="pageable.sort" item="order" separator=",">
<choose>
<when test="order.property eq 'id'">a.id</when>
<when test="order.property eq 'email'">a.email</when>
<when test="order.property eq 'accountDisabled'">a.account_disabled</when>
<when test="order.property eq 'accountLocked'">a.account_locked</when>
<when test="order.property eq 'createdAt'">a.created_at</when>
<when test="order.property eq 'updatedAt'">a.updated_at</when>
<otherwise>a.created_at</otherwise>
</choose>
<choose>
<when test="order.direction.toString() eq 'DESC'">DESC</when>
<otherwise>ASC</otherwise>
</choose>
</foreach>
</if>
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
</select> </select>