본문 바로가기

개인학습용

2024.11.22

728x90

1. 파일등록 input type = file에 multiple 옵션시 다중 업로드

 

extend type Query {
  testQuery(
    input1: String = null
    input2: String!
    input3: [String]!
  ): testCollection! @hasServerRole(role: SERVER_USER)
}

 

2. graphQl에서 배열은 [String]으로  

 

 

3. vo에서 int대신 Integer를 쓰자. int는 ajax등의 요청할 때 null 값을 못받는다.

 

4. 폼태그 입력시

 

$.ajax({
   "type":"POST",
   "url":"특정url",
   "data":"queryData",
   :{
      "특정헤더":"특정헤더"
   },
   "success":"function(response",
   "jqXHR)"{
      "alert(""Success!"");"
   },
   "error":"function(response",
   "jqXHR)"{
      "alert(""Error!"");"
   }
})

 

다음과 같이 보내면 ModelAttribute를 사용 가능,

 

contentType: 'application/json'을 유지하고 data : JSON.stringify(queryData) 사용할 경우

 

RequestBody를 사용해야한다.

 

-> ModelAttribute는 form 데이터만 가능하기 때문.

 

 

5. 최신 데이터를 쿼리로 받아올때

DATE를 기준으로 ORDER BY DESC를 해도 되지만

GROUP BY를 사용해서 MAX 값으로 가져와도 된다