게시판 글작성 수정

This commit is contained in:
dyhj625 2025-02-21 11:00:03 +09:00
parent 77af3859f2
commit 8e64369b77
2 changed files with 9 additions and 2 deletions

View File

@ -80,8 +80,7 @@ public class BoardController {
@ParameterCheck @ParameterCheck
@PostMapping @PostMapping
public ApiResponse<BigInteger> createBoard(@ReqMap MapDto map) { public ApiResponse<BigInteger> createBoard(@ReqMap MapDto map) {
Long userId = AuthUtil.getUser().getId();
map.put("MEMBERSEQ", userId);
if (map.containsKey("LOCBRDPWD") && !map.getString("LOCBRDPWD").trim().isEmpty()) { // 체크 if (map.containsKey("LOCBRDPWD") && !map.getString("LOCBRDPWD").trim().isEmpty()) { // 체크
String rawPassword = map.getString("LOCBRDPWD"); String rawPassword = map.getString("LOCBRDPWD");

View File

@ -16,6 +16,7 @@ import com.github.pagehelper.PageInfo;
import io.company.localhost.common.dto.MapDto; import io.company.localhost.common.dto.MapDto;
import io.company.localhost.mapper.localbordMapper; import io.company.localhost.mapper.localbordMapper;
import io.company.localhost.utils.AuthUtil;
import io.company.localhost.utils.PageUtil; import io.company.localhost.utils.PageUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -54,6 +55,13 @@ public class localbordService {
} }
public BigInteger insertBoard(MapDto map) { public BigInteger insertBoard(MapDto map) {
// 익명게시판이면 회원 정보를 null로 설정
if ("300102".equals(String.valueOf(map.get("LOCBRDTYP")))) {
map.put("MEMBERSEQ", null);
}else {
Long userId = AuthUtil.getUser().getId();
map.put("MEMBERSEQ", userId);
}
boardMapper.insertBoard(map); boardMapper.insertBoard(map);
return (BigInteger) map.get("LOCBRDSEQ"); return (BigInteger) map.get("LOCBRDSEQ");
} }