동적검색시 쿼리 정렬(ORDER BY) 되도록 수정.

main
jjh 12 months ago
parent e29fdaaa35
commit 98295e3b6e

@ -17,6 +17,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -321,4 +322,35 @@ public class CmmnUtil {
String numStr = Integer.toString(number); String numStr = Integer.toString(number);
return convertNumberToHangul(numStr); return convertNumberToHangul(numStr);
} }
/** .
* @param String
* @return String
*/
public static String convertCamelCaseToSnakeCase(String camelCase) {
Pattern pattern = Pattern.compile("([a-z])([A-Z])");
Matcher matcher = pattern.matcher(camelCase);
String convert = matcher.replaceAll(matchResult -> {
return String.format("%s_%s", matchResult.group(1), matchResult.group(2));
});
return convert.toUpperCase();
}
/** .
* @param String
* @return String
*/
public static String convertSnakeCaseToCamelCase(String snakeCase) {
Pattern compile = Pattern.compile("([a-z])_([a-z])");
Matcher matcher = compile.matcher(snakeCase.toLowerCase());
String convert = matcher.replaceAll(matchResult -> {
return String.format("%s%s", matchResult.group(1).toLowerCase(), matchResult.group(2).toUpperCase());
});
return convert;
}
} }

@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.epst.EpostGdcc; import cokr.xit.fims.epst.EpostGdcc;
import cokr.xit.fims.epst.EpostQuery; import cokr.xit.fims.epst.EpostQuery;
import cokr.xit.fims.epst.dao.EpostGdccMapper; import cokr.xit.fims.epst.dao.EpostGdccMapper;
@ -35,11 +35,17 @@ public class EpostGdccBean extends AbstractComponent {
* @return * @return
*/ */
public List<DataObject> getEpostGdccList(EpostQuery req) { public List<DataObject> getEpostGdccList(EpostQuery req) {
// 사용 여부 확인
if (req.getUseYN() == null) { if (req.getUseYN() == null) {
req.setUseYN("Y"); req.setUseYN("Y");
} }
// 정렬 확인
if (req.getOrderBy() == null) { if (req.getOrderBy() == null) {
if (req.getBy() == null) {
req.setOrderBy("REG_DT"); req.setOrderBy("REG_DT");
} else {
req.setOrderBy(CmmnUtil.convertCamelCaseToSnakeCase(req.getBy()));
}
} }
return epostGdccMapper.selectEpostGdccList(req); return epostGdccMapper.selectEpostGdccList(req);

@ -6,6 +6,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.CrdnSttsHstry; import cokr.xit.fims.cmmn.CrdnSttsHstry;
import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean; import cokr.xit.fims.cmmn.service.bean.CrdnSttsHstryBean;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
@ -41,11 +42,17 @@ public class LevyExclBean extends AbstractComponent {
* @return * @return
*/ */
public List<DataObject> getLevyExclList(LevyExclQuery req) { public List<DataObject> getLevyExclList(LevyExclQuery req) {
// 삭제 여부 확인
if (req.getDelYn() == null) { if (req.getDelYn() == null) {
req.setDelYn("N"); req.setDelYn("N");
} }
// 정렬 확인
if (req.getOrderBy() == null) { if (req.getOrderBy() == null) {
if (req.getBy() == null) {
req.setOrderBy("REG_DT"); req.setOrderBy("REG_DT");
} else {
req.setOrderBy(CmmnUtil.convertCamelCaseToSnakeCase(req.getBy()));
}
} }
return levyExclMapper.selectLevyExclList(req); return levyExclMapper.selectLevyExclList(req);

@ -8,7 +8,6 @@
============================ --> ============================ -->
<resultMap id="levyExclRow" type="cokr.xit.fims.excl.LevyExcl"> <resultMap id="levyExclRow" type="cokr.xit.fims.excl.LevyExcl">
<!-- TB_LEVY_EXCL 부과제외 대장 -->
<result property="levyExclId" column="LEVY_EXCL_ID" /> <!-- 부과 제외 ID --> <result property="levyExclId" column="LEVY_EXCL_ID" /> <!-- 부과 제외 ID -->
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 --> <result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="taskSeCd" column="TASK_SE_CD" /> <!-- 업무 구분 코드 --> <result property="taskSeCd" column="TASK_SE_CD" /> <!-- 업무 구분 코드 -->
@ -77,12 +76,12 @@
, CC.CVLCPT_RCPT_NO /* 민원 접수 번호 */ , CC.CVLCPT_RCPT_NO /* 민원 접수 번호 */
, CC.CVLCPT_PRCS_CD /* 민원 처리 코드 */ , CC.CVLCPT_PRCS_CD /* 민원 처리 코드 */
, CC.CVLCPT_PRCS_CMPTN_DT /* 민원 처리 완료 일시 */ , CC.CVLCPT_PRCS_CMPTN_DT /* 민원 처리 완료 일시 */
, (CONCAT(C.CRDN_YMD, C.CRDN_TM)) AS CRDN_YMD_TM /* 단속 일시 */
, (SELECT GET_CODE_NM('FIM054', LE.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM /* 업무 구분 명 */ , (SELECT GET_CODE_NM('FIM054', LE.TASK_SE_CD) FROM DUAL) AS TASK_SE_NM /* 업무 구분 명 */
, (SELECT GET_CODE_NM('FIM021', LE.LEVY_EXCL_SE_CD) FROM DUAL) AS LEVY_EXCL_SE_NM /* 부과 제외 구분 명 */ , (SELECT GET_CODE_NM('FIM021', LE.LEVY_EXCL_SE_CD) FROM DUAL) AS LEVY_EXCL_SE_NM /* 부과 제외 구분 명 */
, (SELECT GET_CODE_NM('FIM022', LE.LEVY_EXCL_RSN_CD) FROM DUAL) AS LEVY_EXCL_RSN_NM /* 부과 제외 사유 명 */ , (SELECT GET_CODE_NM('FIM022', LE.LEVY_EXCL_RSN_CD) FROM DUAL) AS LEVY_EXCL_RSN_NM /* 부과 제외 사유 명 */
, (SELECT GET_CODE_NM('FIM026', C.CRDN_REG_SE_CD) FROM DUAL) AS CRDN_REG_SE_NM /* 단속 등록 구분 명 */ , (SELECT GET_CODE_NM('FIM026', C.CRDN_REG_SE_CD) FROM DUAL) AS CRDN_REG_SE_NM /* 단속 등록 구분 명 */
, (SELECT GET_CODE_NM('FIM003', C.CRDN_INPT_SE_CD) FROM DUAL) AS CRDN_INPT_SE_NM /* 단속 입력 구분 명 */ , (SELECT GET_CODE_NM('FIM003', C.CRDN_INPT_SE_CD) FROM DUAL) AS CRDN_INPT_SE_NM /* 단속 입력 구분 명 */
, (CONCAT(C.CRDN_YMD, C.CRDN_TM)) AS CRDN_YMD_TM /* 단속 일시 */
, (SELECT GET_CODE_NM('FIM010', C.CRDN_STTS_CD) FROM DUAL) AS CRDN_STTS_NM /* 단속 상태 명 */ , (SELECT GET_CODE_NM('FIM010', C.CRDN_STTS_CD) FROM DUAL) AS CRDN_STTS_NM /* 단속 상태 명 */
, (SELECT GET_CODE_NM('FIM002', CA.CRDN_SE_CD) FROM DUAL) AS CRDN_SE_NM /* 단속 구분 명 */ , (SELECT GET_CODE_NM('FIM002', CA.CRDN_SE_CD) FROM DUAL) AS CRDN_SE_NM /* 단속 구분 명 */
, (SELECT GET_CODE_NM('FIM007', CA.CRDN_SPAREA_CD) FROM DUAL) AS CRDN_SPAREA_NM /* 단속 특별구역 명 */ , (SELECT GET_CODE_NM('FIM007', CA.CRDN_SPAREA_CD) FROM DUAL) AS CRDN_SPAREA_NM /* 단속 특별구역 명 */
@ -132,7 +131,6 @@
AND LE.DEL_YN = #{delYn} /* 삭제 여부 */ AND LE.DEL_YN = #{delYn} /* 삭제 여부 */
</if> </if>
AND C.DEL_YN = 'N' /* 단속 삭제 여부 */ AND C.DEL_YN = 'N' /* 단속 삭제 여부 */
<choose> <choose>
<when test="schDetailRegDtOpt == 'regDt'"> <when test="schDetailRegDtOpt == 'regDt'">
<if test="schDetailRegDtFrom != null"> <if test="schDetailRegDtFrom != null">
@ -221,8 +219,11 @@
<when test="by == 'rtpyrNm'"> P.RTPYR_NM </when> <when test="by == 'rtpyrNm'"> P.RTPYR_NM </when>
<when test="by == 'rtpyrNo'"> P.RTPYR_NO </when> <when test="by == 'rtpyrNo'"> P.RTPYR_NO </when>
<when test="by == 'rtpyrBrdt'"> P.RTPYR_BRDT </when> <when test="by == 'rtpyrBrdt'"> P.RTPYR_BRDT </when>
<when test="by == 'cvlcptRcptNo'"> CC.CVLCPT_RCPT_NO </when>
<when test="by == 'cvlcptRcptYmd'"> CC.CVLCPT_RCPT_YMD </when> <when test="by == 'cvlcptRcptYmd'"> CC.CVLCPT_RCPT_YMD </when>
<when test="by == 'cvlcptAplyNo'"> CC.CVLCPT_APLY_NO </when>
<when test="by == 'cvlcptRcptNo'"> CC.CVLCPT_RCPT_NO </when>
<when test="by == 'cvlcptPrcsCd'"> CC.CVLCPT_PRCS_CD </when>
<when test="by == 'cvlcptPrcsCmptnDt'"> CC.CVLCPT_PRCS_CMPTN_DT </when>
</choose> </choose>
<include refid="dynamicSearch.center" />#{term}<include refid="dynamicSearch.end" /> <include refid="dynamicSearch.center" />#{term}<include refid="dynamicSearch.end" />
</when> </when>

Loading…
Cancel
Save