사용자관리 버그 수정 및 요청사항 반영, 검색 양식 변경.
parent
83aab6fb11
commit
f4103b95e3
|
|
@ -34,9 +34,9 @@ public class UserInfo extends BaseModel implements UserDetails{
|
|||
@Column(name = "NAME")
|
||||
private String name;
|
||||
@Column(name = "POSITION")
|
||||
private int position;
|
||||
private Integer position;
|
||||
@Column(name = "DEPARTMENT")
|
||||
private int department;
|
||||
private Integer department;
|
||||
@Column(name = "USER_ROLE")
|
||||
private String userRole;
|
||||
@Column(name = "CREATE_DATE", updatable = false)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ public class UserInfoService implements UserDetailsService {
|
|||
|
||||
@Transactional
|
||||
public String insertUserInfo(UserInfo userInfo){
|
||||
if(userInfoRepository.findByUserId(userInfo.getUserId()).orElse(null) != null){
|
||||
return "userIdDuplication";
|
||||
}
|
||||
userInfo.setPassword(convertPassword(userInfo.getPassword()));
|
||||
return userInfoRepository.save(userInfo).getUserId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,18 +20,18 @@
|
|||
ON A.POSITION = B.CODE_SQ
|
||||
INNER JOIN COMMON_CODE C
|
||||
on A.DEPARTMENT = C.CODE_SQ
|
||||
<where>
|
||||
WHERE A.USER_STATUS != 'D'
|
||||
<if test="userId != null and userId != ''">
|
||||
AND A.USER_ID LIKE CONCAT ('%', #{userId},'%')
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND A.USER_ID LIKE CONCAT ('%', #{name},'%')
|
||||
AND A.NAME LIKE CONCAT ('%', #{name},'%')
|
||||
</if>
|
||||
<if test="positionName != null and positionName != ''">
|
||||
AND B.VALUE LIKE CONCAT ('%', #{positionName},'%')
|
||||
<if test="position != null and position != 0">
|
||||
AND A.POSITION = #{position}
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
AND C.VALUE LIKE CONCAT ('%', #{departmentName},'%')
|
||||
<if test="department != null and department != 0">
|
||||
AND A.DEPARTMENT = #{department}
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
AND A.CREATE_DATE >= #{startDate}
|
||||
|
|
@ -39,7 +39,6 @@
|
|||
<if test="endDate != null and endDate != ''">
|
||||
AND A.CREATE_DATE <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY CREATE_DATE DESC
|
||||
LIMIT #{rowCnt} OFFSET #{firstIndex}
|
||||
</select>
|
||||
|
|
@ -47,22 +46,18 @@
|
|||
<select id="selectUserInfoListCnt" resultType="int" parameterType="UserInfo">
|
||||
SELECT COUNT(*)
|
||||
FROM USER_INFO A
|
||||
INNER JOIN COMMON_CODE B
|
||||
ON A.POSITION = B.CODE_SQ
|
||||
INNER JOIN COMMON_CODE C
|
||||
ON A.DEPARTMENT = C.CODE_SQ
|
||||
<where>
|
||||
WHERE A.USER_STATUS != 'D'
|
||||
<if test="userId != null and userId != ''">
|
||||
AND A.USER_ID LIKE CONCAT ('%', #{userId},'%')
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND A.USER_ID LIKE CONCAT ('%', #{name},'%')
|
||||
AND A.NAME LIKE CONCAT ('%', #{name},'%')
|
||||
</if>
|
||||
<if test="positionName != null and positionName != ''">
|
||||
AND B.VALUE LIKE CONCAT ('%', #{positionName},'%')
|
||||
<if test="position != null and position != 0">
|
||||
AND A.POSITION = #{position}
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
AND C.VALUE LIKE CONCAT ('%', #{departmentName},'%')
|
||||
<if test="department != null and department != 0">
|
||||
AND A.DEPARTMENT = #{department}
|
||||
</if>
|
||||
<if test="startDate != null and startDate != ''">
|
||||
AND A.CREATE_DATE >= #{startDate}
|
||||
|
|
@ -70,6 +65,5 @@
|
|||
<if test="endDate != null and endDate != ''">
|
||||
AND A.CREATE_DATE <= #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -30,9 +30,6 @@ $(document).on('click', '.page-item', function (){
|
|||
$("#searchBtn").click();
|
||||
})
|
||||
|
||||
$(document).on('change', '#searchConditionSelector', function (){
|
||||
setSearchCondition();
|
||||
})
|
||||
$(document).on('change', '#passwordUpdateFlag', function (){
|
||||
const passwordDiv = $(".passwordDiv");
|
||||
if(this.checked){
|
||||
|
|
@ -53,10 +50,14 @@ $(document).on('click', '#saveBtn', function (){
|
|||
url : "/admin/insertUserInfo",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success : function(data) {
|
||||
alert("저장되었습니다.")
|
||||
$("#closeModalBtn").click();
|
||||
$("#searchBtn").click();
|
||||
success : function(result) {
|
||||
if(result === "userIdDuplication"){
|
||||
alert("등록된 아이디입니다.")
|
||||
}else{
|
||||
alert("저장되었습니다.")
|
||||
$("#closeModalBtn").click();
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
},
|
||||
error : function(xhr, status) {
|
||||
|
||||
|
|
@ -212,22 +213,4 @@ function childCategoryStatusChange(parentSeq, flag){
|
|||
childCategoryStatusChange($(el).attr("data-categoryseq"), flag);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function setSearchCondition(){
|
||||
const searchConditionSelector = $("#searchConditionSelector").val();
|
||||
const searchTextDiv = $("#searchTextDiv");
|
||||
const dateSelectorDiv = $("#dateSelectorDiv");
|
||||
if(searchConditionSelector === "createDate"){
|
||||
dateSelectorDiv.show();
|
||||
dateSelectorDiv.children().removeAttr("disabled");
|
||||
searchTextDiv.hide();
|
||||
searchTextDiv.children().attr("disabled", "disabled");
|
||||
}else{
|
||||
$("#textSearch").attr("name", searchConditionSelector);
|
||||
searchTextDiv.show();
|
||||
searchTextDiv.children().removeAttr("disabled");
|
||||
dateSelectorDiv.hide();
|
||||
dateSelectorDiv.children().attr("disabled", "disabled");
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +62,7 @@
|
|||
<select class="form-select" id="userStatus" name="userStatus">
|
||||
<option value="T" th:selected="${userInfo.userStatus=='T'}">활성화</option>
|
||||
<option value="F" th:selected="${userInfo.userStatus=='F'}">비활성화</option>
|
||||
<option value="D" th:selected="${userInfo.userStatus=='D'}">비활성화&목록에서 삭제</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,34 +32,51 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row justify-content-end">
|
||||
<div class="col-auto card">
|
||||
<div class="row justify-content-end pt-1">
|
||||
<div class="col-auto">
|
||||
<select class="form-select" id="searchConditionSelector">
|
||||
<option value="userId" th:selected="${searchParams.userId!=null and searchParams.userId!=''}">아이디</option>
|
||||
<option value="name" th:selected="${searchParams.name!=null and searchParams.name!=''}">이름</option>
|
||||
<option value="positionName" th:selected="${searchParams.positionName!=null and searchParams.positionName!=''}">부서</option>
|
||||
<option value="departmentName" th:selected="${searchParams.departmentName!=null and searchParams.departmentName!=''}">직급</option>
|
||||
<option value="createDate" th:selected="${searchParams.startDate!=null and searchParams.startDate!=''} or ${searchParams.endDate!=null and searchParams.endDate!=''}">생성일</option>
|
||||
</select>
|
||||
<div class="row mb-1">
|
||||
<label for="searchUserId" class="col-sm-2 col-form-label">아이디</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control form-control-sm" id="searchUserId" name="userId" th:value="${searchParams.userId}">
|
||||
</div>
|
||||
<label for="searchName" class="col-sm-2 col-form-label">이름</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control form-control-sm" id="searchName" name="name" th:value="${searchParams.name}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label for="searchPosition" class="col-sm-2 col-form-label">직책</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-select" id="searchPosition" name="position">
|
||||
<option value="0" selected>선택해주세요</option>
|
||||
<th:block th:each="commonCode:${session.positionList}">
|
||||
<option th:value="${commonCode.codeSq}" th:text="${commonCode.value}" th:selected="${commonCode.codeSq == searchParams.position}"></option>
|
||||
</th:block>
|
||||
</select>
|
||||
</div>
|
||||
<label for="searchDepartment" class="col-sm-2 col-form-label">부서</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-select" id="searchDepartment" name="department">
|
||||
<option value="0" selected>선택해주세요</option>
|
||||
<th:block th:each="commonCode:${session.departmentList}">
|
||||
<option th:value="${commonCode.codeSq}" th:text="${commonCode.value}" th:selected="${commonCode.codeSq == searchParams.department}"></option>
|
||||
</th:block>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="startDate" class="col-sm-2 col-form-label">생성일</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-auto input-group w-auto input-daterange" id="dateSelectorDiv">
|
||||
<input type="text" class="form-control form-control-sm" id="startDate" name="startDate" placeholder="시작일" autocomplete="off" th:value="${searchParams.startDate}" readonly>
|
||||
<input type="text" class="form-control form-control-sm" id="endDate" name="endDate" placeholder="종료일" autocomplete="off" th:value="${searchParams.endDate}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" id="searchTextDiv">
|
||||
<input type="text" class="form-control" id="textSearch" th:value="${
|
||||
(searchParams.userId!=null and searchParams.userId!='')?searchParams.userId:(
|
||||
(searchParams.name!=null and searchParams.name!='')?searchParams.name:(
|
||||
(searchParams.positionName!=null and searchParams.positionName!='')?searchParams.positionName:(
|
||||
(searchParams.departmentName!=null and searchParams.departmentName!='')?searchParams.departmentName:''
|
||||
)
|
||||
)
|
||||
)
|
||||
}">
|
||||
</div>
|
||||
<div class="col-auto input-group w-auto input-daterange" id="dateSelectorDiv" style="display: none">
|
||||
<input type="text" class="form-control" id="startDate" name="startDate" placeholder="시작일" autocomplete="off" disabled th:value="${searchParams.startDate}">
|
||||
<input type="text" class="form-control" id="endDate" name="endDate" placeholder="종료일" autocomplete="off" disabled th:value="${searchParams.endDate}">
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<input type="submit" class="btn btn-primary" id="searchBtn" value="검색">
|
||||
<div class="col-auto my-auto">
|
||||
<input type="submit" class="btn btn-primary py-4" id="searchBtn" value="검색">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue