Merge branch 'khj' into main

This commit is contained in:
khj0414 2025-01-09 14:43:10 +09:00
commit 013a4e1be4
7 changed files with 266 additions and 0 deletions

View File

@ -0,0 +1,87 @@
/************************************************************
*
* @packageName : io.company.localhost.controller.common
* @fileName : worddictController.java
* @author : 공현지
* @date : 25.01.07
* @description :
*
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 24.12.06 공현지 최초 생성
*
*************************************************************/
package io.company.localhost.controller.common;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.github.pagehelper.PageInfo;
import io.company.localhost.common.annotation.Member;
import io.company.localhost.common.annotation.ParameterCheck;
import io.company.localhost.common.annotation.ReqMap;
import io.company.localhost.common.dto.ApiResponse;
import io.company.localhost.common.dto.MapDto;
import io.company.localhost.service.commoncodService;
import io.company.localhost.service.worddictyService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RequestMapping("/api/worddict")
@RestController
@RequiredArgsConstructor
public class worddictController {
private final worddictyService worddictyservice;
private final commoncodService commoncodservice;
/**
* 용어집 목록 조회
* @param page 페이지번호
* @param searchKeyword 검색키워드
* @param category 카테고리 코드명
* @param indexKeyword 정렬 키워드
* @return
*/
@Member
@ParameterCheck
@GetMapping("getWordList")
public ApiResponse<List<MapDto>> getWordList(@ReqMap MapDto map) {
PageInfo<MapDto> pageInfo = worddictyservice.getWordList(map);
List<MapDto> wordList = pageInfo.getList();
return ApiResponse.ok(wordList);
}
/**
* 용어집 카테고리 목록
* @param
* @return
*/
@Member
@ParameterCheck
@GetMapping("getWordCategory")
public ApiResponse<List<MapDto>> getWordCategory() {
List<MapDto> WordCategoryList = commoncodservice.getWordCategory();
return ApiResponse.ok(WordCategoryList);
}
/**
* 용어집 카테고리 등록
* @param CMNCODNAM 용어집 등록 카테고리 이름
* @return
*/
@Member
@ParameterCheck
@PostMapping("insertCategory")
public ApiResponse<Long> insertCategory(@ReqMap MapDto map) {
Long result = commoncodservice.insertCategory(map);
return ApiResponse.ok(result);
}
}

View File

@ -0,0 +1,16 @@
package io.company.localhost.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import io.company.localhost.common.dto.MapDto;
@Mapper
public interface commoncodMapper {
List<MapDto> getWordCategory();
Long insertCategory(MapDto map);
}

View File

@ -0,0 +1,34 @@
/************************************************************
*
* @packageName : io.company.localhost.mapper
* @fileName : worddictyMapper.java
* @author : 공현지
* @date : 25.01.07
* @description :
*
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 24.12.06 공현지 최초 생성
*
*************************************************************/
package io.company.localhost.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import io.company.localhost.common.dto.MapDto;
@Mapper
public interface worddictyMapper {
List<MapDto> getWordList(MapDto map);
}

View File

@ -0,0 +1,25 @@
package io.company.localhost.service;
import java.util.List;
import org.springframework.stereotype.Service;
import io.company.localhost.common.dto.MapDto;
import io.company.localhost.mapper.commoncodMapper;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class commoncodService {
private final commoncodMapper commoncodmapper;
public List<MapDto> getWordCategory() {
return commoncodmapper.getWordCategory();
}
public Long insertCategory(MapDto map) {
return commoncodmapper.insertCategory(map);
}
}

View File

@ -0,0 +1,46 @@
/************************************************************
*
* @packageName : io.company.localhost.service
* @fileName : worddictyService.java
* @author : 공현지
* @date : 25.01.07
* @description :
*
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 24.12.06 공현지 최초 생성
*
*************************************************************/
package io.company.localhost.service;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.company.localhost.common.dto.MapDto;
import io.company.localhost.mapper.worddictyMapper;
import io.company.localhost.utils.PageUtil;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class worddictyService {
private final worddictyMapper worddictymapper;
public PageInfo<MapDto> getWordList(MapDto map) {
int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1;
PageHelper.startPage(page, 10);
return PageUtil.redefineNavigation(new PageInfo<>(worddictymapper.getWordList(map),10));
}
}

View File

@ -0,0 +1,32 @@
<?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="io.company.localhost.mapper.commoncodMapper">
<select id="getWordCategory" resultType="Map">
select
CMNCODVAL
,CMNCODNAM
from
commoncod
where
CMNCODLV1 = 600
and
CMNCODODR != 0
</select>
<insert id="insertCategory" parameterType="map">
INSERT INTO commoncod
(CMNCODLV1, CMNCODLV2, CMNCODODR, CMNCODVAL, CMNCODNAM, CMNCODYON, CMNCODRDT, CMNCODUDT)
SELECT
600
,IFNULL(MAX(CMNCODLV2), 100) + 1 AS NEXT_CMNCODLV2
,IFNULL(MAX(CMNCODODR), 0) + 1 AS NEXT_CMNCODODR
,CONCAT(600, LPAD(IFNULL(MAX(CMNCODLV2), 100) + 1, 3, '0')) AS CMNCODVAL
,#{CMNCODNAM}
,'1'
,NOW()
,NOW()
FROM
commoncod
WHERE
CMNCODLV1 = 600;
</insert>
</mapper>

View File

@ -0,0 +1,26 @@
<?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="io.company.localhost.mapper.worddictyMapper">
<select id="getWordList" parameterType="map" resultType="Map">
select
*
from
worddicty
where
1=1
<!-- 검색어 조건 -->
<if test="searchKeyword != null and searchKeyword != ''">
and (WRDDICTTL like CONCAT('%', #{searchKeyword}, '%')
or WRDDICCON like CONCAT('%', #{searchKeyword}, '%'))
</if>
<!-- 색인표 조건 -->
<if test="indexKeyword != null and indexKeyword != ''">
and WRDDICTTL like CONCAT(#{indexKeyword}, '%')
</if>
<!-- 카테고리 조건 -->
<if test="category != null and category != ''">
and WRDDICCAT = #{category}
</if>
order by WRDDICRDT desc
</select>
</mapper>