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) {
|
||||
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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -76,5 +77,19 @@ public class VoteBoardController {
|
||||
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;
|
||||
|
||||
//import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
@ -96,6 +97,9 @@ public class worddictController {
|
||||
@PostMapping("insertCategory")
|
||||
public ApiResponse<Long> insertCategory(@ReqMap MapDto map) {
|
||||
Long result = commoncodservice.insertCategory(map);
|
||||
if(result == -1) {
|
||||
return ApiResponse.okMessage("이미 존재하는 카테고리명입니다.");
|
||||
}
|
||||
return ApiResponse.ok(result);
|
||||
}
|
||||
/**
|
||||
@ -135,4 +139,16 @@ public class worddictController {
|
||||
|
||||
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
|
||||
@PostMapping("/upload")
|
||||
public ApiResponse<String> uploadImage(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
public ApiResponse<String> uploadImage(@ReqMap MultipartFile file) throws IOException {
|
||||
|
||||
if (file.isEmpty()) {
|
||||
return ApiResponse.error(HttpStatus.BAD_REQUEST, "File is empty");
|
||||
|
||||
@ -40,4 +40,6 @@ public interface commoncodMapper {
|
||||
List<MapDto> selectYearCategories();
|
||||
|
||||
List<MapDto> selectCategories();
|
||||
|
||||
Long selectcheckCategoryExists(MapDto map);
|
||||
}
|
||||
|
||||
@ -15,5 +15,7 @@ public interface localvoteMapper {
|
||||
|
||||
List<MapDto> getVoteList(MapDto map);
|
||||
|
||||
Long updateEndData(MapDto map);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@ public interface worddictyMapper {
|
||||
|
||||
int getTotal(MapDto map);
|
||||
|
||||
Long updateword(MapDto map);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.common.exception.NotFoundHandler;
|
||||
import io.company.localhost.mapper.commoncodMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -33,6 +34,10 @@ public class commoncodService {
|
||||
}
|
||||
|
||||
public Long insertCategory(MapDto map) {
|
||||
Long count = commoncodmapper.selectcheckCategoryExists(map);
|
||||
if(count > 0) {
|
||||
return -1L;
|
||||
}
|
||||
return commoncodmapper.insertCategory(map);
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,10 @@ public class localvoteService {
|
||||
|
||||
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) {
|
||||
result = votdetailmapper.insertdetail(map);
|
||||
}else {
|
||||
@ -87,5 +90,9 @@ public class localvoteService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Long updateEndData(MapDto map) {
|
||||
return localvotemapper.updateEndData(map);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -58,8 +58,6 @@ public class worddictyService {
|
||||
return processedList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Long insertWord(MapDto 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>
|
||||
</insert>
|
||||
<select id="getVoteMember" parameterType="int" >
|
||||
select
|
||||
*
|
||||
from
|
||||
votdetail
|
||||
SELECT
|
||||
a.*,
|
||||
n.*,
|
||||
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
|
||||
LOCVOTSEQ = #{LOCVOTSEQ}
|
||||
a.locvotseq = #{LOCVOTSEQ}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -23,20 +23,5 @@
|
||||
,#{userId}
|
||||
,now()
|
||||
)
|
||||
|
||||
</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>
|
||||
|
||||
@ -112,5 +112,12 @@
|
||||
AND
|
||||
CMNCODODR != 0
|
||||
</select>
|
||||
|
||||
<select id="selectcheckCategoryExists" parameterType="Map" resultType="Long">
|
||||
select
|
||||
count(*) checkCategory
|
||||
from
|
||||
commoncod
|
||||
where
|
||||
CMNCODNAM = #{CMNCODNAM}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -28,11 +28,25 @@
|
||||
,DATE_FORMAT(a.LOCVOTRDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTRDT
|
||||
,DATE_FORMAT(a.LOCVOTEDT, '%Y-%m-%d %H:%i') AS formatted_LOCVOTEDT
|
||||
,b.*
|
||||
,c.CMNCODNAM usercolor
|
||||
from
|
||||
localvote a
|
||||
LEFT JOIN
|
||||
netmember b
|
||||
on
|
||||
a.LOCVOTREG = b.MEMBERSEQ
|
||||
left join
|
||||
commoncod c
|
||||
on
|
||||
b.MEMBERCOL = c.CMNCODVAL
|
||||
order by
|
||||
a.LOCVOTRDT desc
|
||||
</select>
|
||||
<update id="updateEndData" parameterType="map">
|
||||
UPDATE
|
||||
localvote
|
||||
SET
|
||||
LOCVOTDDT = now()
|
||||
WHERE LOCVOTSEQ = #{endVoteId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@ -236,4 +236,14 @@
|
||||
where
|
||||
WRDDICSEQ = #{WRDDICSEQ}
|
||||
</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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user