용어집 등록수정 추가

This commit is contained in:
khj0414 2025-01-09 15:48:38 +09:00
parent 3128d73abf
commit d2016a3c24
4 changed files with 95 additions and 0 deletions

View File

@ -16,8 +16,11 @@ package io.company.localhost.controller.common;
import java.util.List;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -30,6 +33,8 @@ 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 io.company.localhost.utils.AuthUtil;
import io.company.localhost.vo.MemberVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -83,5 +88,40 @@ public class worddictController {
Long result = commoncodservice.insertCategory(map);
return ApiResponse.ok(result);
}
/**
* 용어 등록
* @param WRDDICCAT 카테고리,WRDDICTTL 용어,WRDDICCON 내용 ,WRDDICRIK 링크
* @return
*/
@Member
@ParameterCheck
@PostMapping("insertWord")
public ApiResponse<Long> insertWord(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
//userId
Long userId = AuthUtil.getUser().getId();
map.put("userId", userId);
Long result = worddictyservice.insertWord(map);
return ApiResponse.ok(result);
}
/**
* 용어 수정
* @param WRDDICSEQ 용어번호, WRDDICCAT 카테고리, WRDDICTTL 용어,WRDDICCON 내용 ,WRDDICRIK 링크
* @return
*/
@Member
@ParameterCheck
@PatchMapping("updateWord")
public ApiResponse<Long> updateWord(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
//userId
Long userId = AuthUtil.getUser().getId();
map.put("userId", userId);
Long result = worddictyservice.updateWord(map);
return ApiResponse.ok(result);
}
}

View File

@ -25,6 +25,10 @@ public interface worddictyMapper {
List<MapDto> getWordList(MapDto map);
Long insertWord(MapDto map);
Long updateWord(MapDto map);

View File

@ -37,6 +37,14 @@ public class worddictyService {
return PageUtil.redefineNavigation(new PageInfo<>(worddictymapper.getWordList(map),10));
}
public Long insertWord(MapDto map) {
return worddictymapper.insertWord(map);
}
public Long updateWord(MapDto map) {
return worddictymapper.updateWord(map);
}

View File

@ -28,4 +28,47 @@
</if>
order by w.WRDDICRDT desc
</select>
<insert id="insertWord" parameterType="map">
insert into worddicty
(
WRDDICCAT
,WRDDICTTL
,WRDDICCON
,WRDDICREG
,WRDDICRDT
,WRDDICUPD
,WRDDICUDT
<if test="WRDDICRIK != null and WRDDICRIK != ''">
,WRDDICRIK
</if>
)
values
(
#{WRDDICCAT}
,#{WRDDICTTL}
,#{WRDDICCON}
,#{userId}
,now()
,#{userId}
,now()
<if test="WRDDICRIK != null and WRDDICRIK != ''">
,WRDDICRIK
</if>
)
</insert>
<update id="updateWord" parameterType="map">
update
worddicty
set
WRDDICCAT = #{WRDDICCAT}
,WRDDICTTL = #{WRDDICTTL}
,WRDDICCON = #{WRDDICCON}
,WRDDICUPD = #{userId}
,WRDDICUDT = now()
<if test="WRDDICRIK != null and WRDDICRIK != ''">
,WRDDICRIK = #{WRDDICRIK}
</if>
where
WRDDICSEQ = #{WRDDICSEQ}
</update>
</mapper>