118 lines
3.2 KiB
Plaintext
118 lines
3.2 KiB
Plaintext
---
|
|
description:
|
|
globs:
|
|
alwaysApply: true
|
|
---
|
|
# 개발 가이드
|
|
|
|
## 개발 환경 설정
|
|
|
|
### Docker 개발 환경
|
|
```bash
|
|
# 개발 환경 실행
|
|
docker-compose -f docker-compose.dev.yml up --build -d
|
|
|
|
# 운영 환경 실행
|
|
docker-compose -f docker-compose.prod.yml up --build -d
|
|
```
|
|
|
|
### 로컬 개발 환경
|
|
1. Java 7 JDK 설치
|
|
2. Eclipse IDE 설정
|
|
3. Tomcat 7.0 설정
|
|
4. PostgreSQL 데이터베이스 설정
|
|
|
|
## 코딩 컨벤션
|
|
|
|
### Controller 개발
|
|
```java
|
|
@Controller
|
|
public class ExampleController extends BaseService {
|
|
|
|
@Autowired
|
|
ExampleService exampleService;
|
|
|
|
@RequestMapping("/example/list.do")
|
|
public String getList(HttpServletRequest request,
|
|
@RequestParam Map<String, Object> paramMap) {
|
|
// 비즈니스 로직은 Service에서 처리
|
|
List<Map<String, Object>> list = exampleService.getList(request, paramMap);
|
|
request.setAttribute("list", list);
|
|
return "/example/list";
|
|
}
|
|
}
|
|
```
|
|
|
|
### Service 개발
|
|
```java
|
|
@Service
|
|
public class ExampleService extends BaseService {
|
|
|
|
public List<Map<String, Object>> getList(HttpServletRequest request,
|
|
Map<String, Object> paramMap) {
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
try {
|
|
return sqlSession.selectList("example.selectList", paramMap);
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### MyBatis 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="example">
|
|
<select id="selectList" parameterType="map" resultType="map">
|
|
SELECT * FROM example_table
|
|
WHERE 1=1
|
|
<if test="searchText != null and searchText != ''">
|
|
AND name LIKE '%' || #{searchText} || '%'
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
```
|
|
|
|
## 주요 유틸리티
|
|
|
|
### 공통 유틸리티
|
|
- [CommonUtils](mdc:src/com/pms/common/utils/CommonUtils.java) - 공통 유틸리티 메서드
|
|
- [Constants](mdc:src/com/pms/common/utils/Constants.java) - 상수 정의
|
|
- [Message](mdc:src/com/pms/common/Message.java) - 메시지 처리
|
|
|
|
### 파일 관련
|
|
- [FileRenameClass](mdc:src/com/pms/common/FileRenameClass.java) - 파일명 변경
|
|
- 파일 업로드/다운로드 처리
|
|
|
|
## 프론트엔드 개발
|
|
|
|
### JSP 개발
|
|
- 위치: `WebContent/WEB-INF/view/`
|
|
- 공통 초기화: [init_jqGrid.jsp](mdc:WebContent/init_jqGrid.jsp)
|
|
- 스타일시트: [all.css](mdc:WebContent/css/all.css)
|
|
|
|
### JavaScript 라이브러리
|
|
- jQuery 1.11.3/2.1.4
|
|
- jqGrid 4.7.1 - 데이터 그리드
|
|
- Tabulator - 테이블 컴포넌트
|
|
- rMateChart - 차트 라이브러리
|
|
|
|
## 데이터베이스 개발
|
|
|
|
### 연결 설정
|
|
- JNDI 리소스명: `plm`
|
|
- 드라이버: PostgreSQL
|
|
- 컨텍스트 설정: [context.xml](mdc:tomcat-conf/context.xml)
|
|
|
|
### 스키마 관리
|
|
- 초기 스키마: [ilshin.pgsql](mdc:db/ilshin.pgsql)
|
|
- 역할 설정: [00-create-roles.sh](mdc:db/00-create-roles.sh)
|
|
|
|
## 빌드 및 배포
|
|
- Eclipse 기반 빌드 (Maven/Gradle 미사용)
|
|
- 컴파일된 클래스: `WebContent/WEB-INF/classes/`
|
|
- 라이브러리: `WebContent/WEB-INF/lib/`
|
|
- WAR 파일로 Tomcat 배포 |