소스 정리

main
이범준 4 months ago
parent b9880f7c43
commit 69cdea3caa

@ -69,76 +69,6 @@ public interface OgdpMapper extends AbstractMapper {
</where>
""";
/** , .<br />
* @param
* @return ,
*/
@Select(SQLUtil.SCRIPT_START+"""
/* 전체 기관,부서 목록 조회(ogdpMapper.selectAllOgdpList) */
SELECT CONCAT(A.INST_CD,'/',B.DEPT_CD) AS OGDP_CD
, CONCAT(A.SGG_NM, ' / ', A.INST_NM, ' : ', B.DEPT_NM) AS OGDP_NM
, A.INST_CD
, A.INST_NM
, B.DEPT_CD
, B.DEPT_NM
, A.SGG_CD
, A.SGG_NM
FROM TB_SGG A
LEFT OUTER JOIN TB_DEPT B ON (A.INST_CD = B.INST_CD)
UNION
SELECT ('default/default') AS OGDP_CD
, CONCAT(' ',' / ',' ', ' : ', ' ') AS OGDP_NM
, 'default' AS INST_CD
, ' ' AS INST_NM
, 'default' AS DEPT_CD
, ' ' AS DEPT_NM
, 'default' AS SGG_CD
, ' ' AS SGG_NM
FROM DUAL
"""+SQLUtil.SCRIPT_END)
List<DataObject> selectAllOgdpList();
/** , .<br />
* @param stringMap
* @param
* @return ,
*/
@Select(SQLUtil.SCRIPT_START+"""
/* 사용가능한 기관,부서 목록 조회(ogdpMapper.selectAbleOgdpList) */
SELECT CONCAT(A.INST_CD,'/',B.DEPT_CD) AS OGDP_CD
, CONCAT(A.SGG_NM, ' / ', A.INST_NM, ' : ', B.DEPT_NM) AS OGDP_NM
, A.INST_CD
, A.INST_NM
, B.DEPT_CD
, B.DEPT_NM
, A.SGG_CD
, A.SGG_NM
FROM TB_SGG A
LEFT OUTER JOIN TB_DEPT B ON (A.INST_CD = B.INST_CD)
<choose>
<when test='anonymous == "Y" '>
WHERE A.SGG_CD = #{sggCd}
</when>
<otherwise>
<if test="currentUser.institute != 'default'">
WHERE A.SGG_CD = #{currentUser.user.orgID}
</if>
<if test="currentUser.institute == 'default'">
UNION
SELECT 'default/default' AS OGDP_CD
, CONCAT(' ',' / ',' ', ' : ', ' ') AS OGDP_NM
, 'default' AS INST_CD
, ' ' AS INST_NM
, 'default' AS DEPT_CD
, ' ' AS DEPT_NM
, 'default' AS SGG_CD
, ' ' AS SGG_NM
FROM DUAL
</if>
</otherwise>
</choose>
"""+SQLUtil.SCRIPT_END)
List<DataObject> selectAbleOgdpList(Map<String, Object> params);
@Select(SQLUtil.SCRIPT_START+"""

@ -1,6 +1,7 @@
package cokr.xit.fims.base.service.bean;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -8,7 +9,11 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.base.user.DepartmentQuery;
import cokr.xit.base.user.SigunguQuery;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.user.service.bean.DepartmentBean;
import cokr.xit.base.user.service.bean.SigunguBean;
import cokr.xit.fims.base.FimsDepartment;
import cokr.xit.fims.base.FimsSigungu;
import cokr.xit.fims.base.OgdpQuery;
@ -21,7 +26,11 @@ import cokr.xit.foundation.data.DataObject;
@Component("ogdpBean")
public class OgdpBean extends AbstractBean {
@Resource(name="sigunguBean")
private SigunguBean sigunguBean;
@Resource(name="departmentBean")
private DepartmentBean departmentBean;
@Resource(name="ogdpMapper")
private OgdpMapper ogdpMapper;
@ -31,11 +40,75 @@ public class OgdpBean extends AbstractBean {
public Object selectAllOgdpList() {
return ogdpMapper.selectAllOgdpList();
List<DataObject> ogdpList = new ArrayList<>();
List<DataObject> sggs = sigunguBean.getSigunguList(new SigunguQuery());
for(DataObject sgg : sggs) {
List<DataObject> depts = departmentBean.getDepartmentList(new DepartmentQuery().setSggID(sgg.string("SGG_CD")));
for(DataObject dept : depts) {
DataObject ogdp = new DataObject();
ogdp.put("SGG_CD", sgg.string("SGG_CD"));
ogdp.put("SGG_NM", sgg.string("SGG_NM"));
ogdp.put("INST_CD", sgg.string("INST_CD"));
ogdp.put("INST_NM", sgg.string("INST_NM"));
ogdp.put("DEPT_CD", dept.string("DEPT_CD"));
ogdp.put("DEPT_NM", dept.string("DEPT_NM"));
ogdp.put("OGDP_CD", sgg.string("INST_CD") + "/" + dept.string("DEPT_CD"));
ogdp.put("OGDP_NM", sgg.string("SGG_NM") + " / " + sgg.string("INST_NM") + " : " + dept.string("DEPT_NM"));
ogdpList.add(ogdp);
}
}
DataObject sysAdmin = new DataObject();
sysAdmin.put("SGG_CD", "default");
sysAdmin.put("SGG_NM", "기본 시군구");
sysAdmin.put("INST_CD", "default");
sysAdmin.put("INST_NM", "기본 기관");
sysAdmin.put("DEPT_CD", "default");
sysAdmin.put("DEPT_NM", "기본 부서");
sysAdmin.put("OGDP_CD", "default/default");
sysAdmin.put("OGDP_NM", "기본 시군구 / 기본 기관 : 기본 부서");
ogdpList.add(sysAdmin);
return ogdpList;
}
public List<DataObject> selectAbleOgdpList(DataObject params) {
return ogdpMapper.selectAbleOgdpList(params);
public List<DataObject> selectAbleOgdpList(boolean anonymous, String sggCd) {
List<DataObject> ogdpList = new ArrayList<>();
SigunguQuery sggQuery = new SigunguQuery();
if(anonymous) {
sggQuery.setSggIDs(sggCd);
} else if(!currentUser().getInstitute().equals("default")){
sggQuery.setSggIDs(currentUser().getOrgID());
}
List<DataObject> sggs = sigunguBean.getSigunguList(sggQuery);
for(DataObject sgg : sggs) {
List<DataObject> depts = departmentBean.getDepartmentList(new DepartmentQuery().setSggID(sgg.string("SGG_CD")));
for(DataObject dept : depts) {
DataObject ogdp = new DataObject();
ogdp.put("SGG_CD", sgg.string("SGG_CD"));
ogdp.put("SGG_NM", sgg.string("SGG_NM"));
ogdp.put("INST_CD", sgg.string("INST_CD"));
ogdp.put("INST_NM", sgg.string("INST_NM"));
ogdp.put("DEPT_CD", dept.string("DEPT_CD"));
ogdp.put("DEPT_NM", dept.string("DEPT_NM"));
ogdp.put("OGDP_CD", sgg.string("INST_CD") + "/" + dept.string("DEPT_CD"));
ogdp.put("OGDP_NM", sgg.string("SGG_NM") + " / " + sgg.string("INST_NM") + " : " + dept.string("DEPT_NM"));
ogdpList.add(ogdp);
}
}
if(!anonymous && currentUser().getInstitute().equals("default")) {
DataObject sysAdmin = new DataObject();
sysAdmin.put("SGG_CD", "default");
sysAdmin.put("SGG_NM", "기본 시군구");
sysAdmin.put("INST_CD", "default");
sysAdmin.put("INST_NM", "기본 기관");
sysAdmin.put("DEPT_CD", "default");
sysAdmin.put("DEPT_NM", "기본 부서");
sysAdmin.put("OGDP_CD", "default/default");
sysAdmin.put("OGDP_NM", "기본 시군구 / 기본 기관 : 기본 부서");
ogdpList.add(sysAdmin);
}
return ogdpList;
}
public int countUser(String sggCd) {

@ -105,10 +105,7 @@ public class MainController extends cokr.xit.base.web.MainController {
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
DataObject params = new DataObject();
params.set("anonymous", "Y");
params.set("sggCd", sggCd);
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(params);
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(true, sggCd);
mav.addObject("ableOgdpList", ableOgdpList);
mav.addObject("userInfo", "{}");

@ -57,8 +57,7 @@ public class UserController extends cokr.xit.base.user.web.UserController<Manage
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
DataObject params = new DataObject().set("currentUser", currentUser());
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(params);
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(false, currentUser().getOrgID());
mav.addObject("ableOgdpList", ableOgdpList);
return mav;
@ -119,8 +118,8 @@ public class UserController extends cokr.xit.base.user.web.UserController<Manage
mav.addObject("userInfo", toJson(userInfo));
mav.addObject("allOgdpList", ogdpBean.selectAllOgdpList());
DataObject params = new DataObject().set("currentUser", currentUser());
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(params);
List<DataObject> ableOgdpList = ogdpBean.selectAbleOgdpList(false, currentUser().getOrgID());
mav.addObject("ableOgdpList", ableOgdpList);
return mav;

Loading…
Cancel
Save