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

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

@ -8,5 +8,5 @@ import egovframework.rte.psl.dataaccess.mapper.Mapper;
@Mapper @Mapper
public interface CacheCodeMapper { public interface CacheCodeMapper {
List<Map<String, Object>> selectCodes(final String codeId); 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 * @param codeId
* @return List<T> * @return List<T>
*/ */
List<Map<String, Object>> findComboCodes(final String codeId); List<Map<String, Object>> findComboCodes(final String codeId, final String type);
/** /**
* Evict * Evict

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

@ -31,7 +31,11 @@ public class CacheServiceUtils {
* @return combobox Map * @return combobox Map
*/ */
public static List<Map<String,Object>> getComboCodes(final String codeId) { 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);
} }

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

@ -13,19 +13,40 @@
, etc_3 , etc_3
, ordr , ordr
FROM xit_cmmn_detail_code FROM xit_cmmn_detail_code
WHERE code_id = #{code_id} WHERE code_id = #{codeId}
AND use_at = 'Y' AND use_at = 'Y'
ORDER BY ordr ORDER BY ordr
</select> </select>
<select id="selectComboCodes" parameterType="string" resultType="caseMap"> <select id="selectComboCodes" parameterType="map" resultType="caseMap">
/* cachecode-mysql-mapper|selectComboCodes-공통코드 코드그룹 콤보코드 조회|julim */ /* 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 SELECT code
, code_nm , code_nm
FROM xit_cmmn_detail_code FROM xit_cmmn_detail_code
WHERE code_id = #{code_id} WHERE code_id = #{codeId}
AND use_at = 'Y' AND use_at = 'Y'
ORDER BY ordr ORDER BY ordr
</otherwise>
</choose>
</select> </select>
</mapper> </mapper>

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

Loading…
Cancel
Save