용어집 등록수정 추가
This commit is contained in:
parent
3128d73abf
commit
d2016a3c24
@ -16,8 +16,11 @@ package io.company.localhost.controller.common;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
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.common.dto.MapDto;
|
||||||
import io.company.localhost.service.commoncodService;
|
import io.company.localhost.service.commoncodService;
|
||||||
import io.company.localhost.service.worddictyService;
|
import io.company.localhost.service.worddictyService;
|
||||||
|
import io.company.localhost.utils.AuthUtil;
|
||||||
|
import io.company.localhost.vo.MemberVo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@ -83,5 +88,40 @@ public class worddictController {
|
|||||||
Long result = commoncodservice.insertCategory(map);
|
Long result = commoncodservice.insertCategory(map);
|
||||||
return ApiResponse.ok(result);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,10 @@ public interface worddictyMapper {
|
|||||||
|
|
||||||
List<MapDto> getWordList(MapDto map);
|
List<MapDto> getWordList(MapDto map);
|
||||||
|
|
||||||
|
Long insertWord(MapDto map);
|
||||||
|
|
||||||
|
Long updateWord(MapDto map);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,14 @@ public class worddictyService {
|
|||||||
return PageUtil.redefineNavigation(new PageInfo<>(worddictymapper.getWordList(map),10));
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -28,4 +28,47 @@
|
|||||||
</if>
|
</if>
|
||||||
order by w.WRDDICRDT desc
|
order by w.WRDDICRDT desc
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user