gagamel 5 лет назад
Родитель
Сommit
27dac91bc3

+ 24 - 0
style24.core/src/main/java/com/style24/core/biz/dao/TscClauseDao.java

@@ -0,0 +1,24 @@
+package com.style24.core.biz.dao;
+
+import com.style24.core.support.annotation.ShopDs;
+import com.style24.persistence.domain.Clause;
+
+/**
+ * 약관 Dao
+ *
+ * @author gagamel
+ * @since 2020. 10. 29
+ */
+@ShopDs
+public interface TscClauseDao {
+
+	/**
+	 * 약관 조회
+	 * @param clause - 약관 정보
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	String getClause(Clause clause);
+
+}

+ 41 - 0
style24.core/src/main/java/com/style24/core/biz/service/TscClauseService.java

@@ -0,0 +1,41 @@
+package com.style24.core.biz.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import com.style24.core.biz.dao.TscClauseDao;
+import com.style24.persistence.domain.Clause;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 약관 Service
+ * 
+ * @author gagamel
+ * @since 2020. 10. 29
+ */
+@Service
+@Slf4j
+public class TscClauseService {
+
+	@Autowired
+	private TscClauseDao clauseDao;
+
+	/**
+	 * 약관 조회
+	 * @param siteCd - 사이트코드
+	 * @param clauseType - 약관유형
+	 * @return
+	 * @author gagamel
+	 * @since 2020. 10. 29
+	 */
+	@Cacheable(value = "common", key = "'clause-'.concat(#clauseType)")
+	public String getClause(String siteCd, String clauseType) {
+		Clause clause = new Clause();
+		clause.setSiteCd(siteCd);
+		clause.setClauseType(clauseType);
+		return clauseDao.getClause(clause);
+	}
+
+}

+ 25 - 0
style24.core/src/main/java/com/style24/persistence/domain/Clause.java

@@ -0,0 +1,25 @@
+package com.style24.persistence.domain;
+
+import com.style24.persistence.TscBaseDomain;
+
+import lombok.Data;
+
+/**
+ * 약관 Domain
+ * 
+ * @author gagamel
+ * @since 2020. 10. 29
+ */
+@SuppressWarnings("serial")
+@Data
+public class Clause extends TscBaseDomain {
+
+	private Integer clauseSq;
+	private String siteCd;
+	private String clauseType;
+	private String clauseTitle;
+	private String clauseContent;
+	private String effectDt;
+	private String dispYn;
+
+}

+ 17 - 0
style24.core/src/main/java/com/style24/persistence/mybatis/shop/TscClause.xml

@@ -0,0 +1,17 @@
+<?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="com.style24.core.biz.dao.TscClauseDao">
+
+	<!-- 약관 정보  -->
+	<select id="getClause" parameterType="Clause" resultType="String">
+		/* TscClause.getClause */
+		SELECT CLAUSE_CONTENT
+		FROM   TB_CLAUSE A
+		WHERE  CLAUSE_SQ = (SELECT MAX(CLAUSE_SQ)
+		                    FROM   TB_CLAUSE
+		                    WHERE  SITE_CD = #{siteCd}
+		                    AND    CLAUSE_TYPE = #{clauseType}
+		                   )
+	</select>
+
+</mapper>