사용자 기관/부서 관련 수정

dev
mjkhan21 5 months ago
parent d3070b3327
commit b82b8f2aa8

@ -53,11 +53,9 @@
<include refid="utility.orderBy" /></select>
<sql id="sggDepts">SELECT A.SGG_CD, SGG_NM, A.INST_CD, INST_NM, DEPT_CD, DEPT_NM
FROM TB_SGG A, TB_DEPT B
WHERE A.USE_YN = 'Y'
AND B.USE_YN = 'Y'
AND A.SGG_CD = B.SGG_CD
AND A.INST_CD = B.INST_CD</sql>
FROM TB_SGG A LEFT OUTER JOIN TB_DEPT B
ON A.SGG_CD = B.SGG_CD AND A.INST_CD = B.INST_CD
AND A.USE_YN = 'Y' AND B.USE_YN = 'Y'</sql>
<select id="selectSggDepts" resultType="dataobject"><include refid="sggDepts" />
ORDER BY A.SGG_CD, A.INST_CD, DEPT_CD</select>

@ -72,12 +72,8 @@ SELECT USER_ID
, DEPT_NM
FROM TB_USER A
LEFT OUTER JOIN (
SELECT A.SGG_CD, SGG_NM, A.INST_CD, INST_NM, DEPT_CD, DEPT_NM
FROM TB_SGG A LEFT OUTER JOIN TB_DEPT B
ON A.SGG_CD = B.SGG_CD
AND A.INST_CD = B.INST_CD
AND A.USE_YN = 'Y' AND B.USE_YN = 'Y'
) B ON A.NSTT_CD = B.INST_CD AND A.DEPT_CD = B.DEPT_CD
<include refid="cokr.xit.base.user.dao.DepartmentMapper.sggDepts" />
) B ON ORG_ID = B.SGG_CD AND A.NSTT_CD = B.INST_CD AND A.DEPT_CD = B.DEPT_CD
<where><if test="by != null and term != null">AND ${by} LIKE CONCAT('%', #{term}, '%')</if>
<if test="userIDs != null">USER_ID IN (<foreach collection="userIDs" item="userID" separator=",">#{userID}</foreach>)</if>
<if test="status == null and userIDs == null">AND STTS != 'D'</if>
@ -96,7 +92,7 @@ SELECT *
FROM TB_USER
<where><if test="userID != null"> AND USER_ID = #{userID}</if>
<if test="account != null"> AND USER_ACNT = #{account}</if>
<if test="institute != null"> AND NSTT_CD = #{institute}</if></where></select>
<if test="orgID != null"> AND ORG_ID = #{orgID}</if></where></select>
<insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser">/* 사용자 정보 등록(userMapper.insertUser) */
<selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER</selectKey>

@ -47,10 +47,11 @@
</div>
<div class="col-md-6">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="institute">기관</label>
<label class="col-sm-3 col-form-label text-sm-end" for="institute">시군구/기관</label>
<div class="col-sm-9">
<input name="orgID" data-map="ORG_ID" type="hidden">
<select name="institute" data-map="NSTT_CD" class="form-control" onchange="setDepts(this.value);"<c:if test='${!admin}'> disabled</c:if>>
<option value="">기관 선택</option>
<option value="">시군구/기관 선택</option>
</select>
</div>
</div>
@ -174,7 +175,7 @@
<script type="text/javascript">
var sggDepts = new SggDeptControl();
sggDepts.sggs.onDatasetChange = obj => {
let tags = sggDepts.sggs.dataset.inStrings("<option value=\"{INST_CD}\">{INST_NM}</option>");
let tags = sggDepts.sggs.dataset.inStrings("<option value=\"{INST_CD}\">{SGG_NM}/{INST_NM}</option>");
if (tags.length < 1)
tags.push("<option value=\"\">등록된 기관정보가 없습니다.</option>")
document.querySelector("#infoPrefix-form select[name='institute']").innerHTML += tags.join("");
@ -202,6 +203,7 @@ infoPrefixControl.setInfo = obj => {
let password = $(this).prop("required", create);
let div = password.parent().parent().parent();
if (create) {
$("#infoPrefix-form *[name='orgID']").val("${orgID}");
$("#infoPrefix-form *[name='institute']").val("${institute}");
div.show();
} else
@ -265,6 +267,10 @@ async function initPassword() {
}
function setDepts(instCode) {
let found = sggDepts.sggs.dataset._items.filter(item => item.data.INST_CD == instCode);
found = found.length > 0 ? found[0].data : {};
document.querySelector("input[name='orgID']").value = found.SGG_CD;
sggDepts.getDepts({instCode: instCode});
}

@ -56,11 +56,11 @@
<div class="w-px-400 mx-auto">
<div id="formAuthentication" class="mb-3">
<c:if test="${multipleSggs}"><div class="mb-3">
<label for="institute" class="form-label">기관</label>
<select id="institute" class="form-control">
<label for="orgID" class="form-label">시군구</label>
<select id="orgID" class="form-control">
</select>
</div></c:if>
<c:if test="${!multipleSggs}"><input id="institute" type="hidden" /></c:if>
<c:if test="${!multipleSggs}"><input id="orgID" type="hidden" /></c:if>
<div class="mb-3">
<label for="userId" class="form-label">아이디</label>
<input id="userId" type="text" value="${cookie['userAccount'].getValue()}" required class="form-control" placeholder="아이디를 입력하십시오." autofocus />
@ -99,13 +99,13 @@
${functions}
<c:if test="${multipleSggs}">let sggs = new Dataset({
keymapper: row => row.INST_CD,
keymapper: row => row.SGG_CD,
onDatasetChange: obj => {
document.querySelector("#institute").innerHTML = sggs.inStrings("<option value=\"{INST_CD}\">{INST_NM}</option>");
document.querySelector("#orgID").innerHTML = sggs.inStrings("<option value=\"{SGG_CD}\">{SGG_NM}</option>");
}
});
sggs.setData(${sggs});</c:if>
<c:if test="${!multipleSggs}">document.querySelector("#institute").value = ${sggs}[0].INST_CD;</c:if>
<c:if test="${!multipleSggs}">document.querySelector("#orgID").value = ${sggs}[0].SGG_CD;</c:if>
function login() {
if (!$("#formAuthentication input").validInputs()) return;
@ -113,7 +113,7 @@ function login() {
var params = {
account:$("#userId").val(),
password:$("#password").val(),
institute: $("#institute").val(),
orgID: $("#orgID").val(),
rememberCredentials: $("#remember").prop("checked")
};
ajax.post({
@ -140,7 +140,7 @@ $(function(){
if ($("#userId").val())
$("#password").focus();
let input = document.querySelector("#institute"),
let input = document.querySelector("#orgID"),
stored = "${cookie['userInstitute'].getValue()}";
if (stored)
input.value = stored;

Loading…
Cancel
Save