From 9337b60a7cde0907eef74517d02216ea3656f881 Mon Sep 17 00:00:00 2001 From: Leeyh1121 <130335980+Leeyh1121@users.noreply.github.com> Date: Thu, 25 Jul 2024 20:25:28 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20API=20Key=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=20=EC=B6=94=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/adds/nims/ApiKeyQuery.java | 83 +++++ .../cokr/xit/adds/nims/dao/ApiKeyMapper.java | 45 +++ .../xit/adds/nims/service/ApiKeyService.java | 32 ++ .../nims/service/bean/ApiKeyServiceBean.java | 58 +++ .../sql/mapper/adds/nims/apiKey-mapper.xml | 60 ++++ .../WEB-INF/jsp/adds/nims/apiKey-info.jsp | 229 ++++++++++++ .../WEB-INF/jsp/adds/nims/apiKey-main.jsp | 334 ++++++++++++++++++ 7 files changed, 841 insertions(+) create mode 100644 src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java create mode 100644 src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java create mode 100644 src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java create mode 100644 src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java create mode 100644 src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml create mode 100644 src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp create mode 100644 src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp diff --git a/src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java b/src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java new file mode 100644 index 0000000..24cd71f --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/ApiKeyQuery.java @@ -0,0 +1,83 @@ +package cokr.xit.adds.nims; + +import cokr.xit.foundation.component.QueryRequest; + +/**폐기관리접수 정보 조회 요청 +* +*/ +public class ApiKeyQuery extends QueryRequest{ + + private static final long serialVersionUID = 1L; + + //폐기관리 + private String schDeptCd; // 조회 부서 코드 + private String schUseYn; // 사용여부 + private String deptCd; // 부서 코드 + private String deptNm; // 부서 명 + private String prodApiKey; // ApiKey + private String useYn; // 사용여부 + private String userId; // 사용자 ID + + public String getSchDeptCd() { + return ifEmpty(schDeptCd, () -> null); + } + + public T setSchDeptCd(String schDeptCd) { + this.schDeptCd = schDeptCd; + return self(); + } + + public String getSchUseYn() { + return ifEmpty(schUseYn, () -> null); + } + + public T setSchUseYn(String schUseYn) { + this.schUseYn = schUseYn; + return self(); + } + + public String getDeptCd() { + return ifEmpty(deptCd, () -> null); + } + + public T setDeptCd(String deptCd) { + this.deptCd = deptCd; + return self(); + } + + public String getDeptNm() { + return ifEmpty(deptNm, () -> null); + } + + public T setDeptNm(String deptNm) { + this.deptNm = deptNm; + return self(); + } + + public String getProdApiKey() { + return ifEmpty(prodApiKey, () -> null); + } + + public T setProdApiKey(String prodApiKey) { + this.prodApiKey = prodApiKey; + return self(); + } + + public String getuseYn() { + return ifEmpty(useYn, () -> null); + } + + public T setuseYn(String useYn) { + this.useYn = useYn; + return self(); + } + + public String getUserId() { + return ifEmpty(userId, () -> null); + } + + public T setUserId(String userId) { + this.userId = userId; + return self(); + } +} diff --git a/src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java b/src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java new file mode 100644 index 0000000..b16cfbf --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/dao/ApiKeyMapper.java @@ -0,0 +1,45 @@ +package cokr.xit.adds.nims.dao; + +import java.util.List; + +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; + +import cokr.xit.adds.nims.ApiKeyQuery; +import cokr.xit.adds.nims.DsuseMgtReceiptQuery; +import cokr.xit.foundation.component.AbstractMapper; +import cokr.xit.foundation.data.DataObject; + +/** 폐기관리상세 정보 DAO + */ +@Mapper("apiKeyMapper") +public interface ApiKeyMapper extends AbstractMapper { + + /** + * 지정한 조건에 따라 폐기관리상세 목록을 조회하여 반환한다.
+ * @param req 폐기관리상세 조회 조건 + * @return 폐기관리상세 목록 + */ + List selectApiKeyList(ApiKeyQuery req); + + + /** + * ApiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + int updateApiKey(ApiKeyQuery query); + + /** + * ApiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + int createApiKey(ApiKeyQuery query); + + /** + * ApiKey 중복 조회. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + int selectApiKey(ApiKeyQuery query); +} diff --git a/src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java b/src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java new file mode 100644 index 0000000..d2db509 --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/service/ApiKeyService.java @@ -0,0 +1,32 @@ +package cokr.xit.adds.nims.service; + +import java.util.List; + +import cokr.xit.adds.nims.ApiKeyQuery; +import cokr.xit.foundation.data.DataObject; + +public interface ApiKeyService { + + /** 단속자료 목록을 조회한다. + * @param query ApiKey 조회 조건 + *
  • pageNum: 페이지 번호
  • + *
  • fetchSize: 페이지 목록 건수
  • + *
+ * @return ApiKey 목록 + */ + List getApiKeyList(ApiKeyQuery query); + + /** + * ApiKey 등록. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + String createApiKey(ApiKeyQuery query); + + /** + * ApiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + String updateApiKey(ApiKeyQuery query); +} diff --git a/src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java b/src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java new file mode 100644 index 0000000..eb867d6 --- /dev/null +++ b/src/main/java/cokr/xit/adds/nims/service/bean/ApiKeyServiceBean.java @@ -0,0 +1,58 @@ +package cokr.xit.adds.nims.service.bean; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cokr.xit.adds.nims.ApiKeyQuery; +import cokr.xit.adds.nims.dao.ApiKeyMapper; +import cokr.xit.adds.nims.service.ApiKeyService; +import cokr.xit.foundation.component.AbstractServiceBean; +import cokr.xit.foundation.data.DataObject; + +@Service("apiKeyService") +public class ApiKeyServiceBean extends AbstractServiceBean implements ApiKeyService { + + /** 폐기관리접수 정보 DAO */ + @Resource(name = "apiKeyMapper") + private ApiKeyMapper apiKeyMapper; + + @Override + public List getApiKeyList(ApiKeyQuery query){ + if(ifEmpty(query.getOrderBy(), ()->"").equals("")) { + query.setOrderBy("DEPT_CD DESC"); + } + + return apiKeyMapper.selectApiKeyList(query); + } + + /** apiKey 등록. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + @Override + public String createApiKey(ApiKeyQuery query) { + //if(apiKeyMapper.selectApiKey(query) ) + + if(apiKeyMapper.createApiKey(query) == 1) { + return "[S]"; + } else { + return "[F]"; + } + } + + /** apiKey 수정. + * @param query ApiKeyQuery + * @return 저장된 정보수 + */ + @Override + public String updateApiKey(ApiKeyQuery query) { + if(apiKeyMapper.updateApiKey(query) == 1) { + return "[S]"; + } else { + return "[F]"; + } + } +} diff --git a/src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml b/src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml new file mode 100644 index 0000000..734b988 --- /dev/null +++ b/src/main/resources/sql/mapper/adds/nims/apiKey-mapper.xml @@ -0,0 +1,60 @@ + + + + + + + + SELECT + DEPT_CD /* 폐기관리 ID */ + , DEPT_NM /* 폐기관리_순번 */ + , PROD_API_KEY /* 제품_코드 */ + , USE_YN /* 제품_명 */ + FROM TB_DSUSE_API_KEY_INFO + + + + + + UPDATE TB_DSUSE_API_KEY_INFO + SET PROD_API_KEY = #{prodApiKey} + , USE_YN = #{useYn} + , MDFCN_DT = DATE_FORMAT(now(), '%Y%m%d%H%i%s') + , MDFR = #{userId} + WHERE DEPT_CD = #{deptCd} + + + + INSERT INTO TB_DSUSE_API_KEY_INFO + (DEPT_CD, DEPT_NM, PROD_API_KEY, USE_YN, REG_DT, RGTR) + VALUES + (#{deptCd}, #{deptNm}, #{prodApiKey}, #{useYn}, DATE_FORMAT(now(), '%Y%m%d%H%i%s'), #{userId}) + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp new file mode 100644 index 0000000..6ebccd7 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-info.jsp @@ -0,0 +1,229 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> + +폐기관리 등록 + + +
+ +
+ +
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+ + + + + + +
+ +
+
+ + diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp new file mode 100644 index 0000000..f432242 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/apiKey-main.jsp @@ -0,0 +1,334 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> +Api Key 관리 + +
+ +
+ + +
+ +
+ +
+
+
+
+
+
+ +<%-- --%> +
+
+ + +
+ +
+ + +
+ + +
+ + +