Merge branch 'khj' into main
This commit is contained in:
commit
b6097165ca
@ -47,4 +47,7 @@ public class ApiResponse<T> {
|
|||||||
public static <T> ApiResponse<T> error(HttpStatus status, String message) {
|
public static <T> ApiResponse<T> error(HttpStatus status, String message) {
|
||||||
return new ApiResponse<>(status, message, null);
|
return new ApiResponse<>(status, message, null);
|
||||||
}
|
}
|
||||||
|
public static <T> ApiResponse<T> okMessage(String message) {
|
||||||
|
return new ApiResponse<>(HttpStatus.OK, message, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@ package io.company.localhost.controller.api;
|
|||||||
|
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
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.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -76,5 +77,19 @@ public class VoteBoardController {
|
|||||||
return ApiResponse.ok(localvoteservice.insertCheckedNums(map));
|
return ApiResponse.ok(localvoteservice.insertCheckedNums(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 투표 종료
|
||||||
|
* @param endVoteId 투표번호
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Member
|
||||||
|
@PatchMapping("updateEndData")
|
||||||
|
public ApiResponse<Long> updateEndData(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
|
||||||
|
|
||||||
|
Long userId = AuthUtil.getUser().getId();
|
||||||
|
map.put("userId", userId);
|
||||||
|
return ApiResponse.ok(localvoteservice.updateEndData(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
*************************************************************/
|
*************************************************************/
|
||||||
package io.company.localhost.controller.api;
|
package io.company.localhost.controller.api;
|
||||||
|
|
||||||
|
//import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
@ -96,6 +97,9 @@ public class worddictController {
|
|||||||
@PostMapping("insertCategory")
|
@PostMapping("insertCategory")
|
||||||
public ApiResponse<Long> insertCategory(@ReqMap MapDto map) {
|
public ApiResponse<Long> insertCategory(@ReqMap MapDto map) {
|
||||||
Long result = commoncodservice.insertCategory(map);
|
Long result = commoncodservice.insertCategory(map);
|
||||||
|
if(result == -1) {
|
||||||
|
return ApiResponse.okMessage("이미 존재하는 카테고리명입니다.");
|
||||||
|
}
|
||||||
return ApiResponse.ok(result);
|
return ApiResponse.ok(result);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -135,4 +139,16 @@ public class worddictController {
|
|||||||
|
|
||||||
return ApiResponse.ok(result);
|
return ApiResponse.ok(result);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 용어 삭제
|
||||||
|
* @param idList 게시판 아이디 리스트
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Member
|
||||||
|
@PatchMapping("deleteword")
|
||||||
|
public ApiResponse<Long> updateword(@AuthenticationPrincipal MemberVo memberVo,@ReqMap MapDto map) {
|
||||||
|
return ApiResponse.ok(worddictyservice.updateword(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public class ImageUploadController {
|
|||||||
*/
|
*/
|
||||||
@ParameterCheck
|
@ParameterCheck
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
public ApiResponse<String> uploadImage(@RequestParam("file") MultipartFile file) throws IOException {
|
public ApiResponse<String> uploadImage(@ReqMap MultipartFile file) throws IOException {
|
||||||
|
|
||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
return ApiResponse.error(HttpStatus.BAD_REQUEST, "File is empty");
|
return ApiResponse.error(HttpStatus.BAD_REQUEST, "File is empty");
|
||||||
|
|||||||
@ -40,4 +40,6 @@ public interface commoncodMapper {
|
|||||||
List<MapDto> selectYearCategories();
|
List<MapDto> selectYearCategories();
|
||||||
|
|
||||||
List<MapDto> selectCategories();
|
List<MapDto> selectCategories();
|
||||||
|
|
||||||
|
Long selectcheckCategoryExists(MapDto map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,5 +15,7 @@ public interface localvoteMapper {
|
|||||||
|
|
||||||
List<MapDto> getVoteList(MapDto map);
|
List<MapDto> getVoteList(MapDto map);
|
||||||
|
|
||||||
|
Long updateEndData(MapDto map);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,8 @@ public interface worddictyMapper {
|
|||||||
|
|
||||||
int getTotal(MapDto map);
|
int getTotal(MapDto map);
|
||||||
|
|
||||||
|
Long updateword(MapDto map);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import java.util.List;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import io.company.localhost.common.dto.MapDto;
|
import io.company.localhost.common.dto.MapDto;
|
||||||
|
import io.company.localhost.common.exception.NotFoundHandler;
|
||||||
import io.company.localhost.mapper.commoncodMapper;
|
import io.company.localhost.mapper.commoncodMapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@ -33,6 +34,10 @@ public class commoncodService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long insertCategory(MapDto map) {
|
public Long insertCategory(MapDto map) {
|
||||||
|
Long count = commoncodmapper.selectcheckCategoryExists(map);
|
||||||
|
if(count > 0) {
|
||||||
|
return -1L;
|
||||||
|
}
|
||||||
return commoncodmapper.insertCategory(map);
|
return commoncodmapper.insertCategory(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,10 @@ public class localvoteService {
|
|||||||
|
|
||||||
Long result = 0L;
|
Long result = 0L;
|
||||||
|
|
||||||
int voteIdInt = (int) map.get("voteId");
|
int voteIdInt = 0 ;
|
||||||
|
if(map.get("voteId") != null) {
|
||||||
|
voteIdInt = (int) map.get("voteId");
|
||||||
|
}
|
||||||
if(voteIdInt != 0) {
|
if(voteIdInt != 0) {
|
||||||
result = votdetailmapper.insertdetail(map);
|
result = votdetailmapper.insertdetail(map);
|
||||||
}else {
|
}else {
|
||||||
@ -87,5 +90,9 @@ public class localvoteService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long updateEndData(MapDto map) {
|
||||||
|
return localvotemapper.updateEndData(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,8 +58,6 @@ public class worddictyService {
|
|||||||
return processedList;
|
return processedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Long insertWord(MapDto map) {
|
public Long insertWord(MapDto map) {
|
||||||
return worddictymapper.insertWord(map);
|
return worddictymapper.insertWord(map);
|
||||||
}
|
}
|
||||||
@ -77,6 +75,11 @@ public class worddictyService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Long updateword(MapDto map) {
|
||||||
|
return worddictymapper.updateword(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,11 +12,30 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="getVoteMember" parameterType="int" >
|
<select id="getVoteMember" parameterType="int" >
|
||||||
select
|
SELECT
|
||||||
*
|
a.*,
|
||||||
from
|
n.*,
|
||||||
votdetail
|
c.CMNCODNAM AS usercolor,
|
||||||
|
CASE
|
||||||
|
WHEN v.LOCVOTSEQ IS NOT NULL THEN 1
|
||||||
|
ELSE 0
|
||||||
|
END AS voted
|
||||||
|
FROM
|
||||||
|
votmember a
|
||||||
|
LEFT JOIN
|
||||||
|
netmember n
|
||||||
|
ON a.MEMBERSEQ = n.MEMBERSEQ
|
||||||
|
LEFT JOIN
|
||||||
|
commoncod c
|
||||||
|
ON
|
||||||
|
n.MEMBERCOL = c.CMNCODVAL
|
||||||
|
LEFT JOIN
|
||||||
|
votrecord v
|
||||||
|
ON
|
||||||
|
a.LOCVOTSEQ = v.LOCVOTSEQ
|
||||||
|
AND
|
||||||
|
a.MEMBERSEQ = v.VOTRECMEM
|
||||||
where
|
where
|
||||||
LOCVOTSEQ = #{LOCVOTSEQ}
|
a.locvotseq = #{LOCVOTSEQ}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -23,20 +23,5 @@
|
|||||||
,#{userId}
|
,#{userId}
|
||||||
,now()
|
,now()
|
||||||
)
|
)
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- <insert id="insertCheckedNums" parameterType="map">
|
|
||||||
INSERT INTO votrecord
|
|
||||||
(
|
|
||||||
LOCVOTSEQ
|
|
||||||
,VOTRECMEM
|
|
||||||
,VOTRECRDT
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
<foreach collection="checkedList" item="item" separator=",">
|
|
||||||
(#{item.LOCVOTSEQ}, #{userId} ,now())
|
|
||||||
</foreach>
|
|
||||||
</insert>-->
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -112,5 +112,12 @@
|
|||||||
AND
|
AND
|
||||||
CMNCODODR != 0
|
CMNCODODR != 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectcheckCategoryExists" parameterType="Map" resultType="Long">
|
||||||
|
select
|
||||||
|
count(*) checkCategory
|
||||||
|
from
|
||||||
|
commoncod
|
||||||
|
where
|
||||||
|
CMNCODNAM = #{CMNCODNAM}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -28,11 +28,25 @@
|
|||||||
,DATE_FORMAT(a.LOCVOTRDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTRDT
|
,DATE_FORMAT(a.LOCVOTRDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTRDT
|
||||||
,DATE_FORMAT(a.LOCVOTEDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTEDT
|
,DATE_FORMAT(a.LOCVOTEDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTEDT
|
||||||
,b.*
|
,b.*
|
||||||
|
,c.CMNCODNAM usercolor
|
||||||
from
|
from
|
||||||
localvote a
|
localvote a
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
netmember b
|
netmember b
|
||||||
on
|
on
|
||||||
a.LOCVOTREG = b.MEMBERSEQ
|
a.LOCVOTREG = b.MEMBERSEQ
|
||||||
|
left join
|
||||||
|
commoncod c
|
||||||
|
on
|
||||||
|
b.MEMBERCOL = c.CMNCODVAL
|
||||||
|
order by
|
||||||
|
a.LOCVOTRDT desc
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateEndData" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
localvote
|
||||||
|
SET
|
||||||
|
LOCVOTDDT = now()
|
||||||
|
WHERE LOCVOTSEQ = #{endVoteId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -236,4 +236,14 @@
|
|||||||
where
|
where
|
||||||
WRDDICSEQ = #{WRDDICSEQ}
|
WRDDICSEQ = #{WRDDICSEQ}
|
||||||
</select>
|
</select>
|
||||||
|
<update id="updateword" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
worddicty
|
||||||
|
SET
|
||||||
|
WRDDICEDT = now()
|
||||||
|
WHERE WRDDICSEQ IN
|
||||||
|
<foreach item="id" collection="idList" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user