배열 형태로 넘기고 싶으면

5427 단어 MyBatisMyBatis

jQuery.ajaxSettings.traditional = true; 로 체크해주고 data: arr(배열) 넣어서 넘기면 됨

  • mybatis 배열로 foreach. where in 에서 이용
<foreach collection="sUser_type" item="type" index="index"  open="(" close=")" separator=",">
            #{type[index]}
 </foreach>
  • List형태
<foreach collection="sUser_type" item="type"  open="(" close=")" separator=",">
            #{type.value}
 </foreach>

*참고

String 배열의 parameterType은 String으로 설정해주면 됨

<select id="selectPsnExpsList" parameterType="String" resultMap="PsnExpsBean">
     	SELECT 
			BPE.USAGE_DATE, BPE.USAGE_PLACE, BPE.EXPENSE, BPE.ACCT_SUBJECT, BPE.USAGE_CONTENT, BPE.EVIDENCE, BPE.BANK_ACCT_NUMBER, BPE.BANK, BPE.BANK_ACCT_HOLDER, BPE.EMP_NAME, BPE.DEPT_NAME, BPE.ACCT_SUBJECT_CODE, BPE.APP_ID
		FROM 
			BUDGET_PERSONAL_EXPENSE BPE, APP_DOCUMENT_MAIN ADM
		WHERE 
			BPE.APP_ID = ADM.APP_ID
			AND BPE.APP_ID IN (
			<foreach collection="array" item="appId" index="i" separator=",">
				#{appId}
			</foreach>
			)
			ORDER BY BPE.EMP_NAME ASC, BPE.DEPT_NAME ASC, ADM.DRAFT_DT DESC
     </select>

좋은 웹페이지 즐겨찾기