feat: 공통코드 캐싱처리 로직 확장 적용

(그룹 및 조직 코드 반영)
main
Jonguk. Lim 2 years ago
parent 1e4166b686
commit 06d5a2411d

@ -8,5 +8,5 @@ import egovframework.rte.psl.dataaccess.mapper.Mapper;
@Mapper
public interface CacheCodeMapper {
List<Map<String, Object>> selectCodes(final String codeId);
List<Map<String, Object>> selectComboCodes(final String codeId);
List<Map<String, Object>> selectComboCodes(final Map<String,Object> map);
}

@ -20,7 +20,7 @@ public interface CacheService {
* @param codeId
* @return List<T>
*/
List<Map<String, Object>> findComboCodes(final String codeId);
List<Map<String, Object>> findComboCodes(final String codeId, final String type);
/**
* Evict

@ -50,10 +50,13 @@ public class CacheServiceImpl implements CacheService {
return codeMapper.selectCodes(codeId);
}
@Cacheable(cacheNames="codeComboCache", key = "#codeId")
@Cacheable(cacheNames="codeComboCache", key = "#codeId + #type")
@Override
public List<Map<String, Object>> findComboCodes(final String codeId) {
return codeMapper.selectComboCodes(codeId);
public List<Map<String, Object>> findComboCodes(final String codeId, final String type) {
Map<String, Object> map = new HashMap<>();
map.put("codeId", codeId);
map.put("type", type);
return codeMapper.selectComboCodes(map);
}
@Override

@ -31,7 +31,11 @@ public class CacheServiceUtils {
* @return combobox Map
*/
public static List<Map<String,Object>> getComboCodes(final String codeId) {
return JBeanRegistry.getCacheService().findComboCodes(codeId);
return JBeanRegistry.getCacheService().findComboCodes(codeId, "");
}
public static List<Map<String,Object>> getComboCodes(final String codeId, final String type) {
return JBeanRegistry.getCacheService().findComboCodes(codeId, type);
}

@ -42,6 +42,9 @@ public class CodeSelectBoxTag extends TagSupport {
private String onchange = "";
private boolean disabled = false;
// 공통코드가 아닌경우 구분 코드
private String type = "";
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
@ -73,7 +76,7 @@ public class CodeSelectBoxTag extends TagSupport {
// paraMap.put("etc_2", this.etc_2);
// paraMap.put("etc_3", this.etc_3);
List<Map<String, Object>> list = CacheServiceUtils.getComboCodes(codeId);
List<Map<String, Object>> list = CacheServiceUtils.getComboCodes(codeId, type);
for (Map<String, Object> map : list) {
//out.print("<option value='"+map.get("CODE")+"' "+isDefaultSelect((String) map.get("CODE"))+">"+map.get("CODE_NM")+"</option>");

@ -13,19 +13,40 @@
, etc_3
, ordr
FROM xit_cmmn_detail_code
WHERE code_id = #{code_id}
WHERE code_id = #{codeId}
AND use_at = 'Y'
ORDER BY ordr
</select>
<select id="selectComboCodes" parameterType="string" resultType="caseMap">
<select id="selectComboCodes" parameterType="map" resultType="caseMap">
/* cachecode-mysql-mapper|selectComboCodes-공통코드 코드그룹 콤보코드 조회|julim */
<choose>
<when test='type != null and type == "ORGN"'>
/* 조직 코드 */
SELECT orgnzt_id AS code
, orgnzt_nm AS code_nm
FROM xit_orgnzt_info
</when>
<when test='type != null and type == "GROUP"'>
/* 그룹 코드 */
SELECT group_id AS code
, group_nm AS code_nm
FROM xit_author_group_info
</when>
<!-- 공통 코드 -->
<otherwise>
SELECT code
, code_nm
FROM xit_cmmn_detail_code
WHERE code_id = #{code_id}
AND use_at = 'Y'
ORDER BY ordr
, code_nm
FROM xit_cmmn_detail_code
WHERE code_id = #{codeId}
AND use_at = 'Y'
ORDER BY ordr
</otherwise>
</choose>
</select>
</mapper>

@ -13,6 +13,11 @@
<name>select</name>
<tag-class>kr.xit.framework.support.tag.code.CodeSelectBoxTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>type</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>codeId</name>
<required>false</required>

Loading…
Cancel
Save