feat: ehcache3 set

code /  combo code caching
      사용자별 menu / 권한별 menu caching
main
minuk926 2 years ago
parent fbdbc8f089
commit aa942f402b

@ -24,6 +24,7 @@
<org.apache.tiles.version>3.0.5</org.apache.tiles.version>
<!-- <logback.version>1.2.9</logback.version>-->
<!-- <slf4j.version>1.7.21</slf4j.version>-->
<ehcache.version>2.6.11</ehcache.version>
<logback.version>1.1.3</logback.version>
<slf4j.version>1.7.25</slf4j.version>
<fasterxml.jackson.version>2.13.4</fasterxml.jackson.version>
@ -493,6 +494,44 @@
</dependency>
<!-- Apache Commons Configurations -->
<!-- ehcache -->
<!--
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.googlecode.ehcache-spring-annotations</groupId>
<artifactId>ehcache-spring-annotations</artifactId>
<version>1.2.0</version>
</dependency>
-->
<!-- ehcache -->
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>3.10.2</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.0</version>
</dependency>
<!-- logback -->
<dependency>

@ -1,7 +0,0 @@
package kr.xit.fims.biz.cmm;
import kr.xit.framework.core.utils.XitCmmnUtil;
public class FimsCmmnUtil extends XitCmmnUtil{
}

@ -15,7 +15,7 @@ public interface FimsMapperStrategy<T, P> {
* @author:
* @date: 2022. 9. 14.
*/
public List<T> findList(P param, RowBounds rowBounds);
List<T> findList(P param, RowBounds rowBounds);
/**
* <pre> : </pre>
@ -25,7 +25,7 @@ public interface FimsMapperStrategy<T, P> {
* @author:
* @date: 2022. 9. 14.
*/
public T findView(T vo);
T findView(T vo);
/**
* <pre> : </pre>
@ -33,7 +33,7 @@ public interface FimsMapperStrategy<T, P> {
* @author:
* @date: 2022. 9. 14.
*/
public void addProc(T vo);
void addProc(T vo);
/**
* <pre> : </pre>
@ -41,7 +41,7 @@ public interface FimsMapperStrategy<T, P> {
* @author:
* @date: 2022. 9. 14.
*/
public void modifyProc(T vo);
void modifyProc(T vo);
/**
* <pre> : </pre>
@ -49,5 +49,5 @@ public interface FimsMapperStrategy<T, P> {
* @author:
* @date: 2022. 9. 14.
*/
public void removeProc(T vo);
void removeProc(T vo);
}

@ -7,13 +7,13 @@ import org.apache.ibatis.session.RowBounds;
public interface FimsServiceStrategy<T, P> {
public List<T> findList(P searchVO, RowBounds rowBounds) throws SQLException;
List<T> findList(P searchVO, RowBounds rowBounds) throws SQLException;
public T findView(T vo);
T findView(T vo);
public void addProc(T vo);
void addProc(T vo);
public void modifyProc(T vo);
void modifyProc(T vo);
public void removeProc(T vo);
void removeProc(T vo);
}

@ -2,6 +2,7 @@ package kr.xit.fims.biz.rt.web;
import kr.xit.fims.biz.rt.model.Rt0200SearchVO;
import kr.xit.fims.biz.rt.service.Rt0200Service;
import kr.xit.framework.biz.cmm.CacheCodeUtils;
import kr.xit.framework.core.message.XitMessageSource;
import kr.xit.framework.core.model.ResultResponse;
import kr.xit.framework.core.validation.XitBeanValidator;
@ -56,7 +57,7 @@ public class Rt0200Controller {
@GetMapping(value = "/rt0200Sel")
public ModelAndView rt0200Sel(HttpServletRequest req, Model model){
ModelAndView mav = new ModelAndView();
mav.addObject("searchCodeList", rt0200Service.findSndngProcessSttus());
mav.addObject("searchCodeList", CacheCodeUtils.getComboCodes("ENS003"));
return mav;
}

@ -0,0 +1,32 @@
package kr.xit.framework.biz.cmm;
import java.util.List;
import java.util.Map;
import kr.xit.framework.support.util.JBeanRegistry;
/**
* caching
*/
public class CacheCodeUtils {
/**
* ID(codeGrouId) Map .
*
* @param codeId ID
* @return ID(codeGrouId) Map
*/
public static List<Map<String,Object>> getCodes(final String codeId) {
return JBeanRegistry.getCacheService().findCodes(codeId);
}
/**
* combobox Map .
* @param codeId query binding data Map
* @return combobox Map
*/
public static List<Map<String,Object>> getComboCodes(final String codeId) {
return JBeanRegistry.getCacheService().findComboCodes(codeId);
}
}

@ -0,0 +1,33 @@
package kr.xit.framework.biz.cmm;
import java.util.List;
import java.util.Map;
import kr.xit.framework.support.util.JBeanRegistry;
/**
* caching
*
*/
public class CacheMenuUtils {
/**
*
*
* @param uniqId String
* @return List<Map<String,Object>>
*/
public static List<Map<String,String>> findMenuListByUser(final String uniqId) {
return JBeanRegistry.getCacheService().findMenuListByUser(uniqId);
}
/**
*
* @param authorCode String
* @return List<Map<String,Object>>
*/
public static List<Map<String,String>> findMenuListByAuthorCode(final String authorCode) {
return JBeanRegistry.getCacheService().findMenuListByAuthorCode(authorCode);
}
}

@ -0,0 +1,11 @@
package kr.xit.framework.biz.cmm.mapper;
import java.util.List;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
@Mapper
public interface CacheCodeMapper<T> {
List<T> selectCodes(final String codeId);
List<T> selectComboCodes(final String codeId);
}

@ -0,0 +1,12 @@
package kr.xit.framework.biz.cmm.mapper;
import java.util.List;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
@Mapper
public interface CacheMenuMapper<T> {
List<T> selectMenuListByUser(final String uniqId);
List<T> selectMenuListByAuthorCode(final String authorCode);
}

@ -0,0 +1,54 @@
package kr.xit.framework.biz.cmm.service;
import java.util.List;
import java.util.Map;
public interface CacheService {
/**
* Map .
* @param codeId
* @return List<T>
*/
List<Map<String, Object>> findCodes(final String codeId);
/**
* Map .
* @param codeId
* @return List<T>
*/
List<Map<String, Object>> findComboCodes(final String codeId);
/**
*
* @param uniqId
* @return List<T>
*/
List<Map<String, String>> findMenuListByUser(final String uniqId);
/**
*
* @param authorCode
* @return List<T>
*/
List<Map<String, String>> findMenuListByAuthorCode(final String authorCode);
/**
* Evict
*/
void evictAllCodeCache();
/**
* Evict
*/
void evictAllMenuCache();
/**
* Evict
*/
void evictCodeCache(final String codeId);
/**
* Evict
*/
void evictMenuCache(final String userId);
}

@ -0,0 +1,72 @@
package kr.xit.framework.biz.cmm.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import kr.xit.framework.biz.cmm.service.CacheService;
import kr.xit.framework.biz.cmm.mapper.CacheCodeMapper;
import kr.xit.framework.biz.cmm.mapper.CacheMenuMapper;
import lombok.AllArgsConstructor;
@AllArgsConstructor
@Service
public class CacheServiceImpl implements CacheService {
@SuppressWarnings("rawtypes")
private final CacheCodeMapper codeMapper;
@SuppressWarnings("rawtypes")
private final CacheMenuMapper menuMapper;
@SuppressWarnings("unchecked")
@Cacheable(cacheNames="codeCache", key = "#codeId")
@Override
public List<Map<String, Object>> findCodes(final String codeId) {
return codeMapper.selectCodes(codeId);
}
@SuppressWarnings("unchecked")
@Cacheable(cacheNames="codeComboCache", key = "#codeId")
@Override
public List<Map<String, Object>> findComboCodes(final String codeId) {
return codeMapper.selectComboCodes(codeId);
}
@SuppressWarnings("unchecked")
@Cacheable(cacheNames="menuCache", key = "#uniqId")
@Override
public List<Map<String, String>> findMenuListByUser(final String uniqId) {
return menuMapper.selectMenuListByUser(uniqId);
}
@Cacheable(cacheNames="menuCache", key = "#authorCode")
@Override
public List<Map<String, String>> findMenuListByAuthorCode(final String authorCode) {
return menuMapper.selectMenuListByAuthorCode(authorCode);
}
@Override
@CacheEvict(cacheNames="codeCache", allEntries = true)
public void evictAllCodeCache() {
}
@Override
@CacheEvict(cacheNames="menuCache", allEntries = true)
public void evictAllMenuCache() {
}
@Override
@CacheEvict(cacheNames="codeCache", allEntries = true)
public void evictCodeCache(final String codeId) {
}
@Override
@CacheEvict(cacheNames="menuCache", allEntries = true)
public void evictMenuCache(final String key) {
}
}

@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import egovframework.rte.fdl.cmmn.exception.FdlException;
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
import egovframework.rte.fdl.security.intercept.EgovReloadableFilterInvocationSecurityMetadataSource;
import kr.xit.framework.biz.cmm.CacheMenuUtils;
import lombok.extern.slf4j.Slf4j;
import kr.xit.framework.biz.cmm.mapper.XitFrameUnitMapper;
import kr.xit.framework.biz.cmm.model.XitAuthorGroupInfoVO;
@ -291,28 +292,14 @@ public class XitFrameUnitServiceImpl implements XitFrameUnitService {
@Override
public List<Map<String, String>> findMenuListByUser(String uniqId) {
List<Map<String, String>> result = null;
try {
result = xitFrameUnitMapper.findMenuListByUser(uniqId);
} catch (SQLException e) {
throw new RuntimeException("사용자별 메뉴목록 조회 실패", e);
}
return result;
return CacheMenuUtils.findMenuListByUser(uniqId);
}
@Override
public List<Map<String, String>> findMenuListByAuthorCode(String authorCode){
List<Map<String, String>> result = null;
try {
result = xitFrameUnitMapper.findMenuListByAuthorCode(authorCode);
} catch (SQLException e) {
throw new RuntimeException("권한별 메뉴목록 조회 실패", e);
}
return result;
return CacheMenuUtils.findMenuListByAuthorCode(authorCode);
}
@Override
public int findUserIdDuplCheck(String id) {
/**

@ -0,0 +1,58 @@
package kr.xit.framework.biz.cmm.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import kr.xit.framework.biz.cmm.CacheCodeUtils;
import kr.xit.framework.biz.cmm.CacheMenuUtils;
import kr.xit.framework.core.constants.FrameworkConstants;
/**
* ,
*
*/
@Controller
@RequestMapping(value="/framework/biz/cmm/cache")
public class
CacheController {
/**
*
* @param codeId String
* @return ModelAndView
*/
@GetMapping(value="/getCodeList")
public ModelAndView getCodeList(final String codeId) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
mav.addObject(codeId, CacheCodeUtils.getCodes(codeId));
return mav;
}
/**
* Combo
* @param codeId String
* @return ModelAndView
*/
@GetMapping(value="/getComboCodeList")
public ModelAndView getComboCodeList(final String codeId) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
mav.addObject(codeId, CacheCodeUtils.getComboCodes(codeId));
return mav;
}
@GetMapping(value="/getMenuListByUser")
public ModelAndView getMenuListByUser(final String uniqId) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
mav.addObject("allMenuList", CacheMenuUtils.findMenuListByUser(uniqId));
return mav;
}
@GetMapping(value="/getMenuListByAuthorCode")
public ModelAndView getMenuListByAuthorCode(final String authorCode) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
mav.addObject("allMenuList", CacheMenuUtils.findMenuListByAuthorCode(authorCode));
return mav;
}
}

@ -14,6 +14,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.fasterxml.jackson.databind.JsonMappingException;
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
import kr.xit.framework.biz.cmm.CacheMenuUtils;
import kr.xit.framework.core.model.XitRollingNotiVO;
import kr.xit.framework.support.exception.JSONExceptionMessageWriter;
import kr.xit.framework.support.util.Checks;
@ -83,12 +84,12 @@ public class XitMenuListIntercepter extends HandlerInterceptorAdapter {
XitLoginVO loginVO = (XitLoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
//사용자별 메뉴 목록 조회
allMenuList = xitFrameUnitService.findMenuListByUser(loginVO.getUniqId());
allMenuList = CacheMenuUtils.findMenuListByUser(loginVO.getUniqId());
}
else {
//익명사용자 메뉴 목록 조회
allMenuList = xitFrameUnitService.findMenuListByAuthorCode("ROLE_ANONYMOUS");
allMenuList = CacheMenuUtils.findMenuListByAuthorCode("ROLE_ANONYMOUS");
}

@ -0,0 +1,14 @@
package kr.xit.framework.support.cache;
import org.ehcache.event.CacheEvent;
import org.ehcache.event.CacheEventListener;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class EhCacheEventLogger implements CacheEventListener<Object, Object> {
@Override
public void onEvent(CacheEvent<?, ?> cacheEvent) {
log.info("cache event logger message::getKey: {} / getOldValue: {} / getNewValue:{}", cacheEvent.getKey(), cacheEvent.getOldValue(), cacheEvent.getNewValue());
}
}

@ -3,6 +3,7 @@ package kr.xit.framework.support.util;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import kr.xit.framework.biz.cmm.service.CacheService;
import kr.xit.framework.core.message.XitMessageSource;
import kr.xit.framework.core.validation.XitBeanValidator;
@ -12,7 +13,7 @@ import kr.xit.framework.core.validation.XitBeanValidator;
*/
public class JBeanRegistry {
public static final XitBeanValidator getValidator() {
public static XitBeanValidator getValidator() {
return (XitBeanValidator)SpringUtils.getBean(XitBeanValidator.class);
}
@ -20,11 +21,15 @@ public class JBeanRegistry {
* .
* @return MessageSourceAccessor
*/
public static final MessageSourceAccessor getMessageSourceAccessor() {
public static MessageSourceAccessor getMessageSourceAccessor() {
return (MessageSourceAccessor)SpringUtils.getBean(MessageSourceAccessor.class);
}
public static final MessageSource getMessageSource() {
public static MessageSource getMessageSource() {
return (MessageSource)SpringUtils.getBean(XitMessageSource.class);
}
public static CacheService getCacheService() {
return (CacheService)SpringUtils.getBean(CacheService.class);
}
}

@ -8,6 +8,7 @@
<import resource="classpath:/spring/service/context-security.xml"/>
<import resource="classpath:/spring/service/context-transaction.xml"/>
<!-- <import resource="classpath/spring/service/service/context-aspect.xml"/>-->
<import resource="classpath:/spring/service/cache/context-ehcache.xml"/>
<import resource="classpath:/spring/service/context-excel.xml"/>
<import resource="classpath:/spring/service/context-beans.xml"/>
<import resource="classpath:/spring/service/context-datasource.xml"/>

@ -0,0 +1,14 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
<cache:annotation-driven cache-manager="ehCacheManager"/>
<bean id="ehCacheManager" class="org.springframework.cache.jcache.JCacheCacheManager">
<property name="cacheManager">
<bean class="org.springframework.cache.jcache.JCacheManagerFactoryBean"
p:cacheManagerUri="classpath:spring/service/cache/ehcache.xml" />
</property>
</bean>
</beans>

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.ehcache.org/v3">
<!-- 캐시 파일이 생성되는 경로 -->
<persistence directory="${user.home}/data/cache/data"/>
<cache-template name="cacheLog">
<!-- 캐시가 생성되고 삭제되는 이벤트를 모니터링 하고 싶을 때의 설정 -->
<!-- 운영시 comment -->
<listeners>
<listener>
<class>kr.xit.framework.support.cache.EhCacheEventLogger</class> <!-- 캐싱처리에 대한 리스너가 등록된 클래스의 FQCN을 등록한다. -->
<event-firing-mode>ASYNCHRONOUS</event-firing-mode>
<event-ordering-mode>UNORDERED</event-ordering-mode>
<events-to-fire-on>CREATED</events-to-fire-on>
<events-to-fire-on>EVICTED</events-to-fire-on>
<events-to-fire-on>REMOVED</events-to-fire-on>
<events-to-fire-on>UPDATED</events-to-fire-on>
<events-to-fire-on>EXPIRED</events-to-fire-on>
</listener>
</listeners>
</cache-template>
<cache alias="codeComboCache" uses-template="cacheLog"> <!-- cache name -->
<key-type>java.lang.Object</key-type> <!-- 캐시의 키의 FQCN 지정. 기본 값은 java.lang.Object -->
<value-type>java.lang.Object</value-type> <!-- Cache 인스턴스에 저장되는 값의 FQCN. 기본 값은 java.lang.Object -->
<!-- 캐시 만료기간 -->
<!-- unit : days, hours, minutes, seconds, millis, micros, nanos -->
<expiry>
<ttl unit="minutes">5</ttl>
</expiry>
<!-- 캐시 데이터 저장 공간과 용량 지정 -->
<!-- 만약 힙 메모리만 사용한다면 <heap> 요소만으로 대체 가능 -->
<!-- heap unit : entries, TB, GB, MB, KB, B -->
<!-- offheap unit : TB, GB, MB, KB, B -->
<resources>
<!-- 캐시 사용 갯수 지정 -->
<heap unit="entries">100</heap>
<!-- JVM heap 외부 메모리 -->
<offheap unit="MB">10</offheap>
<!-- Disk memory : shutdown시 삭제 여부 지정 -->
<disk unit="MB" persistent="false">50</disk>
</resources>
</cache>
<cache alias="codeCache" uses-template="cacheLog"> <!-- cache name -->
<key-type>java.lang.Object</key-type> <!-- 캐시의 키의 FQCN 지정. 기본 값은 java.lang.Object -->
<value-type>java.lang.Object</value-type> <!-- Cache 인스턴스에 저장되는 값의 FQCN. 기본 값은 java.lang.Object -->
<!-- 캐시 만료기간 -->
<!-- unit : days, hours, minutes, seconds, millis, micros, nanos -->
<expiry>
<ttl unit="minutes">5</ttl>
</expiry>
<!-- 캐시 데이터 저장 공간과 용량 지정 -->
<!-- 만약 힙 메모리만 사용한다면 <heap> 요소만으로 대체 가능 -->
<!-- heap unit : entries, TB, GB, MB, KB, B -->
<!-- offheap unit : TB, GB, MB, KB, B -->
<resources>
<!-- 캐시 사용 갯수 지정 -->
<heap unit="entries">100</heap>
<!-- JVM heap 외부 메모리 -->
<offheap unit="MB">10</offheap>
<!-- Disk memory : shutdown시 삭제 여부 지정 -->
<disk unit="MB" persistent="false">50</disk>
</resources>
</cache>
<cache alias="menuCache" uses-template="cacheLog"> <!-- cache name -->
<key-type>java.lang.Object</key-type> <!-- 캐시의 키의 FQCN 지정. 기본 값은 java.lang.Object -->
<value-type>java.lang.Object</value-type> <!-- Cache 인스턴스에 저장되는 값의 FQCN. 기본 값은 java.lang.Object -->
<!-- 캐시 만료기간 -->
<!-- unit : days, hours, minutes, seconds, millis, micros, nanos -->
<expiry>
<ttl unit="minutes">5</ttl>
</expiry>
<!-- 캐시 데이터 저장 공간과 용량 지정 -->
<!-- 만약 힙 메모리만 사용한다면 <heap> 요소만으로 대체 가능 -->
<!-- heap unit : entries, TB, GB, MB, KB, B -->
<!-- offheap unit : TB, GB, MB, KB, B -->
<resources>
<!-- 캐시 사용 갯수 지정 -->
<heap unit="entries">100</heap>
<!-- JVM heap 외부 메모리 -->
<offheap unit="MB">10</offheap>
<!-- Disk memory : shutdown시 삭제 여부 지정 -->
<disk unit="MB" persistent="false">50</disk>
</resources>
</cache>
</config>

@ -17,6 +17,7 @@
<security:http pattern="/images" security="none"/>
<security:http pattern="/js" security="none"/>
<security:http pattern="/resource" security="none"/>
<!--security:http pattern="/framework/biz/cmm/cache/**" security="none"/-->
<security:http pattern="\A/WEB-INF/jsp/.*\Z" request-matcher="regex" security="none"/>
<!-- 전자정부 프레임워크 사용 시 -->

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.framework.biz.cmm.mapper.CacheCodeMapper">
<select id="selectCodes" parameterType="string" resultType="caseMap">
/* cachecode-mysql-mapper|selectCodes-공통코드 코드그룹 조회|julim */
SELECT code
, code_nm
, code_dc
, etc_1
, etc_2
, etc_3
, ordr
FROM xit_cmmn_detail_code
WHERE code_id = #{code_id}
AND use_at = 'Y'
ORDER BY ordr
</select>
<select id="selectComboCodes" parameterType="string" resultType="caseMap">
/* cachecode-mysql-mapper|selectComboCodes-공통코드 코드그룹 콤보코드 조회|julim */
SELECT code
, code_nm
FROM xit_cmmn_detail_code
WHERE code_id = #{code_id}
AND use_at = 'Y'
ORDER BY ordr
</select>
</mapper>

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="kr.xit.framework.biz.cmm.mapper.CacheMenuMapper">
<select id="selectMenuListByUser" parameterType="string" resultType="java.util.Map">
/* cachemenu-mysql-mapper|selectMenuListByUser-사용자별 메뉴 조회|julim */
<include refid="sql_tree"/>
SELECT D.menu_id AS "menuSid"
, D.menu_name AS "menuName"
, (SELECT CASE SA.URL WHEN '/' THEN '#' ELSE SA.URL END
FROM xit_progrm_list SA
WHERE B.progrm_file_nm = SA.progrm_file_nm ) AS "menuUrl"
, D.menu_depth AS "menuDepth"
, D.parnt_menu_id AS "parentSid"
, D.menu_full_path AS "menuPath"
, D.menu_full_path_name AS "menuPathname"
, '' AS "superYn"
, ( SELECT COUNT(1)
FROM TREE_QUERY SA
WHERE SA.parnt_menu_id = D.menu_id) AS "childCnt"
FROM xit_menu_creat_dtls A
INNER JOIN xit_menu_info B
ON A.menu_no = B.menu_no
INNER JOIN (
SELECT FA.author_code, FA.scrty_setup_trget_id
FROM xit_user_scrty_setup FA
WHERE FA.scrty_setup_trget_id = #{uniqId}
) C
ON A.author_code = C.author_code
INNER JOIN tree_query D
ON B.menu_no = D.menu_id
ORDER BY D.parnt_menu_id, B.menu_ordr
</select>
<select id="selectMenuListByAuthorCode" parameterType="string" resultType="java.util.Map">
/* cachemenu-mysql-mapper|selectMenuListByAuthorCode-권한별 메뉴 조회|julim */
<include refid="sql_tree"/>
SELECT D.menu_id AS "menuSid"
, D.menu_name AS "menuName"
, (
SELECT CASE SA.URL WHEN '/' THEN '#' ELSE SA.URL END
FROM xit_progrm_list SA
WHERE B.progrm_file_nm = SA.progrm_file_nm) AS "menuUrl"
, D.menu_depth AS "menuDepth"
, D.parnt_menu_id AS "parentSid"
, D.menu_full_path AS "menuPath"
, D.menu_full_path_name AS "menuPathname"
, '' AS "superYn"
, (SELECT COUNT(1)
FROM TREE_QUERY SA
WHERE SA.parnt_menu_id = D.menu_id) AS "childCnt"
FROM xit_menu_creat_dtls A
JOIN xit_menu_info B
ON A.menu_no = B.menu_no
JOIN tree_query D
ON B.menu_no = D.menu_id
WHERE A.AUTHOR_CODE = #{authorCode}
ORDER BY D.parnt_menu_id, B.menu_ordr
</select>
<sql id="sql_tree">
WITH RECURSIVE tree_query(
menu_id
, PARNT_menu_id
, menu_name
, menu_full_path
, menu_full_path_name
, menu_depth
) AS (
SELECT A.menu_no AS "menu_id"
, A.upper_menu_no AS "parnt_menu_id"
, A.menu_nm AS "menu_name"
, CONCAT('', A.menu_no) AS "menu_full_path"
, CONCAT('', A.menu_nm) AS "menu_full_path_name"
, 1 AS "menu_depth"
FROM xit_menu_info A
INNER JOIN xit_progrm_list B
ON A.progrm_file_nm = B.progrm_file_nm
WHERE A.UPPER_MENU_NO = 0
UNION ALL
SELECT A.menu_no AS "menu_id"
, A.upper_menu_no AS "parnt_menu_id"
, A.menu_nm AS "menu_name"
, CONCAT(B.menu_full_path, '_', A.menu_no) AS "menu_full_path"
, CONCAT(B.menu_full_path_name, ' > ', A.menu_nm) AS "menu_full_path_name"
, B.menu_depth + 1 AS "menu_depth"
FROM xit_menu_info A
INNER JOIN tree_query B
ON A.upper_menu_no = B.menu_id
WHERE B.menu_id != 0
)
</sql>
</mapper>

@ -132,18 +132,6 @@
const ARR_TOTCNT = [0,0,0];
let CUR_TAB_SEQ = 0;
$(document).ready(function() {
Rt0200_main.init();
$('#totCnt span').text(ARR_TOTCNT[CUR_TAB_SEQ]);
$("#tabs").tabs({active : CUR_TAB_SEQ});
//ARR_INSTANCE[0].refreshLayout();
});
/* *******************************
* 사용자 등록관리 Functions
******************************* */
@ -452,4 +440,13 @@
}
$(document).ready(function() {
Rt0200_main.init();
$('#totCnt span').text(ARR_TOTCNT[CUR_TAB_SEQ]);
$("#tabs").tabs({active : CUR_TAB_SEQ});
//ARR_INSTANCE[0].refreshLayout();
});
</script>

Loading…
Cancel
Save