Notice
Recent Posts
Recent Comments
Link
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

WON.dev

employees 본문

JSP/SEARCH

employees

GAWON 2023. 6. 12. 17:07
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper 
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >

<mapper namespace="org.joonzis.mybatis.mapper.employees"> <!-- 경로 표기법이 클래스명 표기법처럼 사용된다! -->
   <!-- 
      각 태그 속성
      1. id : id를 통해서 sql문을 선택(임의로 결정 가능)
      2. parameterType : 매개변수의 타입
      3. resultType : 리턴 데이터의 타입 (풀 패키지로 작성)
      * insert, update, delete의 경우 무조건 int 형식이기 때문에 작성할 필요가 없다
    -->
    
    <select id="select_all" resultType="org.joonzis.vo.EmployeeVO">
    	SELECT * FROM EMPLOYEES ORDER BY EMPLOYEE_ID
    </select>
    <select id="search_dept" resultType="org.joonzis.vo.EmployeeVO">
    	SELECT * FROM EMPLOYEES WHERE DEPARTMENT_ID = #{department_id}<!-- #{}안에 값에 대소문자 확인 -->
    </select>
    
    <select id="getList" resultType="org.joonzis.vo.EmployeeVO" parameterType="map">
    	SELECT * FROM EMPLOYEES where
    	<choose>
    		<when test="key==1"> employee_id = #{value}</when>
    		<when test="key==2"> first_name = #{value}</when>
    		<when test="key==3"> DEPARTMENT_ID = #{value}</when>
    	</choose>
    </select> 
	
</mapper>

'JSP > SEARCH' 카테고리의 다른 글

EmployeeServiceImpl  (0) 2023.06.12
EmployeeService  (0) 2023.06.12
sqlmap  (0) 2023.06.12
DBService  (0) 2023.06.12
EmployeeDaoImpl  (0) 2023.06.12