Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 예외미루기
- 객체 비교
- Java
- 인터페이스
- 한국건설관리시스템
- EnhancedFor
- 집합_SET
- 정수형타입
- exception
- 제네릭
- 자동차수리시스템
- 대덕인재개발원
- 자바
- 메소드오버로딩
- 오라클
- 참조형변수
- 예외처리
- 환경설정
- oracle
- 컬렉션 타입
- 사용자예외클래스생성
- 추상메서드
- 어윈 사용법
- NestedFor
- 다형성
- GRANT VIEW
- 컬렉션프레임워크
- abstract
- 생성자오버로드
- cursor문
Archives
- Today
- Total
거니의 velog
(7) MyBatis 세팅 본문
[mybatis-config.xml]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org/DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<properties resource="kr/or/ddit/mybatis/config/dbInfo.properties"></properties>
<settings>
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
<setting name="jdbcTypeForNull" value="NULL"></setting>
</settings>
<typeAliases>
<typeAlias type="kr.or.ddit.vo.EmployeeVO" alias="empVo" />
<typeAlias type="kr.or.ddit.vo.FileInfoVO" alias="fileVo" />
<typeAlias type="kr.or.ddit.vo.SealInfoVO" alias="sealVo" />
<typeAlias type="kr.or.ddit.vo.SignLineVO" alias="signLineVo" />
<typeAlias type="kr.or.ddit.vo.SignAcceptVO" alias="signAccVo" />
</typeAliases>
<environments default="oracleDev">
<environment id="oracleDev">
<transactionManager type="JDBC"></transactionManager>
<dataSource type="POOLED">
<property name="driver" value="${driver}" />
<property name="url" value="${url}" />
<property name="username" value="${user}" />
<property name="password" value="${pass}" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="kr/or/ddit/mybatis/mappers/employee-mapper.xml" />
<mapper resource="kr/or/ddit/mybatis/mappers/fileinfo-mapper.xml" />
</mappers>
</configuration>
[employee-mapper.xml]
<?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="employee">
<select id="selectEmpNo" parameterType="String" resultType="String">
select empno from employee where empno = #{empno}
</select>
<select id="loginSelect" parameterType="empVo" resultType="empVo">
<!-- select * from employee where empno = #{empno} and emppass = #{emppass} -->
select * from employee a, jobinfo b, posinfo c
where a.empjob = b.empjob and a.emppos = c.emppos
and empno = #{empno} and emppass = #{emppass}
</select>
<select id="selectEmpPass" parameterType="String" resultType="empVo">
select empemail, emppass from employee where empno = #{empno}
</select>
<select id="dupChkEmpNo" parameterType="String" resultType="String">
select max(empno) as maxempno from employee where empno like #{empno} || '%'
</select>
<insert id="insertEmployee" parameterType="empVo">
INSERT INTO employee (empno, empname, empjob, empcostat, empsal, emphp1, emphp2, emphp3, empaddr, empjoindate, empretiredate, emppass, empemail, emppos, emppercol, empphoto)
VALUES (#{empno}, #{empname}, #{empjob}, '재직중', #{empsal}, #{emphp1}, #{emphp2}, #{emphp3}, #{empaddr}, sysdate, null, #{emppass}, #{empemail}, #{emppos}, #{emppercol}, #{empphoto})
</insert>
<select id="getAllEmpList" resultType="empVo">
select * from employee
</select>
<select id="empUpdateInfo" parameterType="String" resultType="empVo">
select * from employee where empno = #{empno}
</select>
<delete id="deleteEmp" parameterType="String">
delete from employee
where empno = #{empno}
</delete>
<update id="updateEmp" parameterType="empVo">
UPDATE employee
SET
empname = #{empname},
empjob = #{empjob},
empsal = #{empsal},
emphp1 = #{emphp1},
emphp2 = #{emphp2},
emphp3 = #{emphp3},
empaddr = #{empaddr},
empjoindate = sysdate,
emppass = #{emppass},
empemail = #{empemail},
emppos = #{emppos},
emppercol = #{emppercol},
empphoto = #{empphoto}
WHERE
empno = #{empno}
</update>
<select id="signJobSearch" parameterType="String" resultType="empVo">
select * from employee where empjob = #{empjob}
</select>
<insert id="insertSignLine" parameterType="signLineVo">
INSERT INTO signlineinfo (signno, oriempno, empnofir, empnamefir, empjobfir, empposfir, empnosec, empnamesec, empjobsec, emppossec, empnothi, empnamethi, empjobthi, empposthi)
VALUES (sealinfo_seq.nextval, #{oriempno}, #{empnofir}, #{empnamefir}, #{empjobfir}, #{empposfir}, #{empnosec}, #{empnamesec}, #{empjobsec}, #{emppossec}, #{empnothi}, #{empnamethi}, #{empjobthi}, #{empposthi})
</insert>
<select id="signInsertInfo" parameterType="String" resultType="signLineVo">
select * from signlineinfo where oriempno = ${oriempno}
</select>
<delete id="deleteSignLine" parameterType="String">
DELETE FROM signlineinfo
WHERE oriempno = #{oriempno}
</delete>
</mapper>
[fileinfo-mapper.xml]
<?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="fileinfo">
<insert id="insertFileInfo" parameterType="fileVo">
INSERT INTO fileinfo (fileno, filewriter, originfilename, savefilename, filesize, filedate)
VALUES (fileinfo_seq.nextval, #{filewriter}, #{originfilename}, #{savefilename}, #{filesize}, sysdate)
</insert>
<select id="getAllFileInfo" resultType="fileVo">
select * from fileinfo
</select>
<select id="getFileInfo" parameterType="int" resultType="fileVo">
select * from fileinfo where fileno = #{fileno}
</select>
<select id="getFileNoMax" resultType="int">
select max(fileno) from fileinfo
</select>
<delete id="deleteFile" parameterType="int">
DELETE FROM fileinfo
WHERE fileno = #{fileno}
</delete>
<insert id="insertSeal" parameterType="sealVo">
INSERT INTO sealinfo (sealno, fileno, empno)
VALUES (sealinfo_seq.nextval, #{fileno}, #{empno})
</insert>
<select id="sealInsertInfo" parameterType="String" resultType="sealVo">
select * from sealinfo where empno = ${empno}
</select>
<delete id="deleteSeal" parameterType="String">
delete from sealinfo where empno = ${empno}
</delete>
</mapper>
'대덕인재개발원_2nd project' 카테고리의 다른 글
(9) script.js (0) | 2023.10.20 |
---|---|
(8) CommonDAO, CommonService 세팅 (0) | 2023.10.20 |
(6) common.css (0) | 2023.10.20 |
(5) 회원 삭제 페이지 (0) | 2023.10.20 |
(4) 회원 수정 페이지 (0) | 2023.10.20 |