기관/부서 관련 소스 제거

main
이범준 5 months ago
parent cd56ef75f7
commit 6bf47b785b

@ -1,70 +0,0 @@
package cokr.xit.applib.ogdp;
import cokr.xit.foundation.component.QueryRequest;
public class OgdpQuery extends QueryRequest {
private static final long serialVersionUID = 1L;
private String sggCd; // 시군구 코드
private String deptCd; // 부서 코드
private String instCd; // 기관 코드
private String useYn; // 사용 여부
private String delYn; // 삭제 여부
private String selectAdd;
public String getSggCd() {
return ifEmpty(sggCd, () -> null);
}
public <T extends OgdpQuery> T setSggCd(String sggCd) {
this.sggCd = sggCd;
return self();
}
public String getDeptCd() {
return ifEmpty(deptCd, () -> null);
}
public <T extends OgdpQuery> T setDeptCd(String deptCd) {
this.deptCd = deptCd;
return self();
}
public String getInstCd() {
return ifEmpty(instCd, () -> null);
}
public <T extends OgdpQuery> T setInstCd(String instCd) {
this.instCd = instCd;
return self();
}
public String getUseYn() {
return ifEmpty(useYn, () -> null);
}
public <T extends OgdpQuery> T setUseYn(String useYn) {
this.useYn = useYn;
return self();
}
public String getDelYn() {
return ifEmpty(delYn, () -> null);
}
public <T extends OgdpQuery> T setDelYn(String delYn) {
this.delYn = delYn;
return self();
}
public String getSelectAdd() {
return ifEmpty(selectAdd, () -> null);
}
public <T extends OgdpQuery> T setSelectAdd(String selectAdd) {
this.selectAdd = selectAdd;
return self();
}
}

@ -1,36 +0,0 @@
package cokr.xit.applib.ogdp;
import cokr.xit.base.user.Sigungu;
import lombok.Getter;
import lombok.Setter;
/**
*
* @author leebj
*/
@Getter
@Setter
public class OgdpSigungu extends Sigungu {
/**
*
*/
private String symbolFilepath;
/**
*
*/
private String symbolFilename;
/**
*
*/
private String logoFilepath;
/**
*
*/
private String logoFilename;
}

@ -1,347 +0,0 @@
package cokr.xit.applib.ogdp.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.applib.SQLUtil;
import cokr.xit.applib.ogdp.OgdpQuery;
import cokr.xit.applib.ogdp.OgdpSigungu;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@Mapper("ogdpMapper")
public interface OgdpMapper extends AbstractMapper {
/** , .<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);
/** ,,,,, .<br />
* @param ID
* @return ,,,,,
*/
@Select(SQLUtil.SCRIPT_START+"""
/* 사용자의 시군구,기관,부서 조회(ogdpMapper.selectOgdpInfoOfUser) */
SELECT S.SGG_CD
, S.SGG_NM
, U.NSTT_CD AS INST_CD
, S.INST_NM
, U.DEPT_CD
, D.DEPT_NM
FROM TB_USER U
LEFT OUTER JOIN TB_SGG S ON (U.ORG_ID = S.SGG_CD)
LEFT OUTER JOIN TB_DEPT D ON (U.DEPT_CD = D.DEPT_CD)
WHERE U.USER_ID = #{userId}
"""+SQLUtil.SCRIPT_END)
DataObject selectOgdpInfoOfUser(String userId);
/** .<br />
* @param
* @return
*/
@Select(SQLUtil.SCRIPT_START+"""
/* 모든 시군구 조회(ogdpMapper.selectAllSggList) */
SELECT SGG_CD
, SGG_NM
, (SELECT (CASE WHEN COUNT(*) > 0 THEN 'Y' ELSE 'N' END) FROM TB_USER WHERE NSTT_CD = A.INST_CD) AS USER_USE_YN
FROM TB_SGG A
WHERE USE_YN = 'Y'
"""+SQLUtil.SCRIPT_END)
List<DataObject> selectAllSggList();
/** .
* @param sgg
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
default boolean updateSgg(OgdpSigungu sgg) {
return sgg != null && updateSgg(params().set("sgg", sgg)) == 1;
}
/** .
* @param params
* <ul><li>"sgg" - </li>
* <li>"currentUser" - </li>
* </ul>
* @return
*/
@Update(SQLUtil.SCRIPT_START+"""
/* 시군구 설정정보 수정 (ogdpMapper.updateSgg) */
UPDATE TB_SGG
SET MDFCN_DT =
"""
+SQLUtil.now
+"""
, MDFR = #{sgg.modifiedBy}
<if test="sgg.symbolFilepath != null">
, SYMBOL_FILE_PATH = #{sgg.symbolFilepath} <!-- -->
, SYMBOL_FILE_NM = #{sgg.symbolFilename} <!-- -->
</if>
<if test="sgg.logoFilepath != null">
, LOGO_FILE_PATH = #{sgg.logoFilepath} <!-- -->
, LOGO_FILE_NM = #{sgg.logoFilename} <!-- -->
</if>
<if test="sgg.officialSealFilepath != null">
, OFFCS_FILE_PATH = #{sgg.officialSealFilepath} <!-- -->
, OFFCS_FILE_NM = #{sgg.officialSealFilename} <!-- -->
</if>
WHERE SGG_CD = #{sgg.sggID}
"""+SQLUtil.SCRIPT_END)
int updateSgg(Map<String, Object> params);
/** .
* @param req
* @return
*/
default DataObject selectSggInfo(OgdpQuery req) {
// 사용 여부 확인
if (req.getUseYn() == null) {
req.setUseYn("Y");
}
return selectSgg(req);
}
/** .
* @param req
* @return
*/
@SelectProvider(type=OgdpMapper.class, method="selectSggProvider")
DataObject selectSgg(OgdpQuery req);
public static String selectSggProvider() {
String comment = " /* 시군구 객체 가져오기(ogdpMapper.selectSgg) */ ";
String selectFrom = """
SELECT S.SGG_CD <!-- -->
, S.SGG_NM <!-- -->
, S.INST_SE_CD <!-- -->
, S.INST_CD <!-- -->
, S.INST_NM <!-- -->
, (CASE
WHEN S.INST_DADDR IS NULL OR S.INST_DADDR = ''
THEN S.INST_ADDR
ELSE CONCAT(S.INST_ADDR,' ',S.INST_DADDR)
END) AS INST_FULL_ADDR <!-- -->
, S.INST_ADDR <!-- -->
, S.INST_DADDR <!-- -->
, S.INST_ZIP <!-- -->
, S.SYMBOL_FILE_PATH <!-- -->
, S.SYMBOL_FILE_NM <!-- -->
, S.LOGO_FILE_PATH <!-- -->
, S.LOGO_FILE_NM <!-- -->
, S.OFFCS_FILE_PATH <!-- -->
, S.OFFCS_FILE_NM <!-- -->
FROM TB_SGG S
""";
String where = """
<where>
<if test="sggCd != null">
AND S.SGG_CD = #{sggCd} <!-- -->
</if>
<if test="useYn != null">
AND S.USE_YN = #{useYn} <!-- -->
</if>
</where>
""";
return SQLUtil.SCRIPT_START
+ comment
+ selectFrom + where
+ SQLUtil.SCRIPT_END;
}
@UpdateProvider(type=OgdpMapper.class, method="updateDeptProvider")
int updateDept(Map<String, Object> params);
public static String updateDeptProvider(Map<String, Object> params) {
String comment = "/* 부서 수정(ogdpMapper.updateDept) */ ";
String updateSet = """
UPDATE TB_DEPT
SET MDFCN_DT =
"""
+SQLUtil.now
+"""
<!-- -->
, MDFR = #{dept.modifiedBy} <!-- -->
""";
String where = """
WHERE DEPT_CD = #{dept.deptID}
AND USE_YN = 'Y'
""";
String updateSetAdd = params.get("updateSetAdd") == null ? "" : (String)params.get("updateSetAdd");
return SQLUtil.SCRIPT_START
+ comment
+ updateSet + updateSetAdd + where
+ SQLUtil.SCRIPT_END;
}
@SelectProvider(type=OgdpMapper.class, method="selectDeptInfoProvider")
DataObject selectDeptInfo(OgdpQuery req);
public static String selectDeptInfoProvider(OgdpQuery req) {
String comment = "/* 부서 객체 가져오기(ogdpMapper.selectDeptInfo) */ ";
String selectFromWhere = selectDept(req);
return SQLUtil.SCRIPT_START
+ comment
+ selectFromWhere
+ SQLUtil.SCRIPT_END;
}
@SelectProvider(type=OgdpMapper.class, method="selectDeptListProvider")
List<DataObject> selectDeptList(OgdpQuery query);
public static String selectDeptListProvider(OgdpQuery req) {
String comment = "/* 부서 객체 목록 가져오기(ogdpMapper.selectDeptList) */ ";
String selectFromWhere = selectDept(req);
return SQLUtil.SCRIPT_START
+ comment
+ SQLUtil.pagingPrefix
+ selectFromWhere
+ SQLUtil.orderBy
+ SQLUtil.pagingSuffix
+ SQLUtil.SCRIPT_END;
}
public static String selectDept(OgdpQuery req) {
String select = """
SELECT D.DEPT_CD <!-- -->
, D.SGG_CD <!-- -->
, (SELECT SGG_NM FROM TB_SGG WHERE SGG_CD = D.SGG_CD) AS SGG_NM <!-- -->
, D.INST_CD <!-- -->
, (SELECT INST_NM FROM TB_SGG WHERE INST_CD = D.INST_CD) AS INST_NM <!-- -->
, D.DEPT_NM <!-- -->
, D.DEPT_TELNO <!-- -->
, D.DEPT_FXNO <!-- -->
, D.USE_YN <!-- -->
, (CASE D.USE_YN WHEN 'Y' THEN '' WHEN 'N' THEN '' ELSE '' END) AS USE_YN_NM <!-- -->
, D.REG_DT <!-- -->
, D.RGTR <!-- -->
, D.MDFCN_DT <!-- -->
, D.MDFR <!-- -->
""";
String fromWhere = """
FROM TB_DEPT D
<where>
<if test="sggCd != null">
AND D.SGG_CD = #{sggCd} <!-- -->
</if>
<if test="deptCd != null">
AND D.DEPT_CD = #{deptCd} <!-- -->
</if>
<if test="instCd != null">
AND D.INST_CD = #{instCd} <!-- -->
</if>
<if test="useYn != null">
AND D.USE_YN = #{useYn} <!-- -->
</if>
</where>
""";
String selectAdd = req.getSelectAdd() == null ? "" : req.getSelectAdd();
return select + selectAdd + fromWhere;
}
}

@ -1,108 +0,0 @@
package cokr.xit.applib.ogdp.service.bean;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import cokr.xit.applib.ogdp.OgdpQuery;
import cokr.xit.applib.ogdp.OgdpSigungu;
import cokr.xit.applib.ogdp.dao.OgdpMapper;
import cokr.xit.base.user.Department;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataObject;
public abstract class AbstractOgdpBean extends AbstractBean {
@Resource(name="ogdpMapper")
private OgdpMapper ogdpMapper;
public Object selectAllOgdpList() {
return ogdpMapper.selectAllOgdpList();
}
public List<DataObject> selectAbleOgdpList(DataObject params) {
return ogdpMapper.selectAbleOgdpList(params);
}
public List<DataObject> selectAllSggList(){
return ogdpMapper.selectAllSggList();
}
public DataObject selectOgdpInfoOfUser(String userId){
return ogdpMapper.selectOgdpInfoOfUser(userId);
}
/**userInfo ,, .
* @param userInfo
* @return
*/
public void initUserInfo(UserInfo userInfo) {
DataObject ogdpInfo = ogdpMapper.selectOgdpInfoOfUser(userInfo.getId());
Map<String, Object> infoMap = userInfo.getInfo();
if(ogdpInfo == null) {
infoMap.put("sggCd", "");
infoMap.put("sggNm", "");
infoMap.put("instCd", "");
infoMap.put("instNm", "");
infoMap.put("deptCd", "");
infoMap.put("deptNm", "");
} else {
infoMap.put("sggCd", ogdpInfo.string("SGG_CD"));
infoMap.put("sggNm", ogdpInfo.string("SGG_NM"));
infoMap.put("instCd", ogdpInfo.string("INST_CD"));
infoMap.put("instNm", ogdpInfo.string("INST_NM"));
infoMap.put("deptCd", ogdpInfo.string("DEPT_CD"));
infoMap.put("deptNm", ogdpInfo.string("DEPT_NM"));
}
userInfo.setInfo(infoMap);
}
/** .
* @param sgg
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean updateSgg(OgdpSigungu sgg) {
return ogdpMapper.updateSgg(sgg);
}
/** .
* @param req
* @return
*/
public DataObject getSggInfo(OgdpQuery req) {
return ogdpMapper.selectSggInfo(req);
}
/** .
* @param req
* @return
*/
public abstract List<DataObject> getDeptList(OgdpQuery req);
/** .
* @param req
* @return
*/
public abstract DataObject getDeptInfo(OgdpQuery req);
/** .
* @param dept
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public abstract boolean updateDept(Department dept);
}

@ -1,54 +0,0 @@
package cokr.xit.applib.ogdp.service.bean;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.applib.ogdp.OgdpQuery;
import cokr.xit.applib.ogdp.dao.OgdpMapper;
import cokr.xit.base.user.Department;
import cokr.xit.foundation.data.DataObject;
@Component("defaultOgdpBean")
public class DefaultOgdpBean extends AbstractOgdpBean {
@Resource(name = "ogdpMapper")
private OgdpMapper ogdpMapper;
@Override
public List<DataObject> getDeptList(OgdpQuery query) {
// 기본 정렬
if (query.getOrderBy() == null) {
if(query.getFetchSize() > 0) {
query.setOrderBy("QBODY.DEPT_CD DESC");
} else {
query.setOrderBy("D.DEPT_CD DESC");
}
}
return ogdpMapper.selectDeptList(query);
}
@Override
public DataObject getDeptInfo(OgdpQuery query) {
return ogdpMapper.selectDeptInfo(query);
}
@Override
public boolean updateDept(Department dept) {
boolean result = dept != null && ogdpMapper.updateDept(
new DataObject()
.set("currentUser", currentUser())
.set("dept", dept)) == 1;
return result;
}
}
Loading…
Cancel
Save