728x90
반응형
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
package egovframework.rte.kr.go.xxxxxxx.com.service;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.ui.ModelMap;
/*******************************************************************************************************
* @brief :
* @file : commonService.java
* @company :
* @author :
* @date :
******************************************************************************************************/
public interface CommonService {
/*******************************************************************************************************
* @brief : 단일형태로 조회하는 공통 인터페이스(Object)
* @method : selectObject
******************************************************************************************************/
public Object selectObject(String queryId, Map<String, Object> paramMap) throws Exception;
/*******************************************************************************************************
* @brief : 리스트형태로 조회하는 인터페이스
* @method : selectList
******************************************************************************************************/
public List<?> selectList(String queryId, Map<String, Object> paramMap) throws Exception;
/*******************************************************************************************************
* @brief : 리스트 카운트 조회 인터페이스
* @method : selectListPaging
******************************************************************************************************/
public int selectListCnt(String queryId, Map<String, Object> paramMap) throws Exception;
/*******************************************************************************************************
* @brief :
* @method : insertObject
******************************************************************************************************/
public int insertObject(String queryId, Object obj) throws Exception;
/*******************************************************************************************************
* @brief :
* @method : updateObject
******************************************************************************************************/
public int updateObject(String queryId, Object obj) throws Exception;
/*******************************************************************************************************
* @brief :
* @method : deleteObject
******************************************************************************************************/
public int deleteObject(String queryId, Object obj) throws Exception;
/*******************************************************************************************************
* @brief : 단일형태로 조회하는 공통 인터페이스(Object)
* @method : selectObject
******************************************************************************************************/
public Object selectObject(String queryId, Object obj) throws Exception;
/*******************************************************************************************************
* @brief : 리스트형태로 조회하는 인터페이스
* @method : selectList
******************************************************************************************************/
public List<?> selectList(String queryId, Object obj) throws Exception;
/*******************************************************************************************************
* @brief : 리스트 카운트 조회 인터페이스
* @method : selectListPaging
******************************************************************************************************/
public int selectListCnt(String queryId, Object obj) throws Exception;
/*******************************************************************************************************
* @brief : 세션을 가져와 model로 보내기
* @method : requestSessionToModel
******************************************************************************************************/
public Object requestSessionToModel(HttpServletRequest request, String objName, ModelMap model) throws Exception;
/*******************************************************************************************************
* @brief : 엑셀 파일을 리스트로 가져오는 인터페이스
* @method : getExcelList
******************************************************************************************************/
public Map<String, Object> fileUpload(HttpServletRequest request, Map<String, Object> paramMap) throws Exception;
}
|
cs |
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
package egovframework.rte.kr.go.xxxxxxx.com.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;
import egovframework.rte.fdl.property.EgovPropertyService;
import egovframework.rte.kr.go.xxxxxxx.com.dao.CommonDAO;
import egovframework.rte.kr.go.xxxxxxx.com.service.CommonService;
import egovframework.rte.kr.go.xxxxxxx.com.util.FileUtil;
import egovframework.rte.kr.go.xxxxxxx.com.util.SCUtil;
@Service("commonService")
public class CommonServiceImpl implements CommonService {
/** CommonDAO */
@Resource(name = "commonDAO")
private CommonDAO commonDAO;
@Resource(name = "propertiesService")
protected EgovPropertyService prop;
public Object selectObject(String queryId, Map<String, Object> paramMap) throws Exception {
return commonDAO.selectObject(queryId, paramMap);
}
public List<?> selectList(String queryId, Map<String, Object> paramMap) throws Exception {
return commonDAO.selectList(queryId, paramMap);
}
public int selectListCnt(String queryId, Map<String, Object> paramMap) throws Exception {
return commonDAO.selectListCnt(queryId, paramMap);
}
public int insertObject(String queryId, Object obj) throws Exception {
return commonDAO.updateObject(queryId, obj);
}
public int updateObject(String queryId, Object obj) throws Exception {
return commonDAO.updateObject(queryId, obj);
}
public int deleteObject(String queryId, Object obj) throws Exception {
return commonDAO.updateObject(queryId, obj);
}
public Object selectObject(String queryId, Object obj) throws Exception {
return commonDAO.selectObject(queryId, obj);
}
public List<?> selectList(String queryId, Object obj) throws Exception {
return commonDAO.selectList(queryId, obj);
}
public int selectListCnt(String queryId, Object obj) throws Exception {
return commonDAO.selectListCnt(queryId, obj);
}
public Object requestSessionToModel(HttpServletRequest request, String objName, ModelMap model) throws Exception {
String keyStr = prop.getString("admin_session_name");
Object obj = SCUtil.getSessionAttribute(request, keyStr);
model.addAttribute(objName, obj);
return obj;
}
@SuppressWarnings("unchecked")
public Map<String, Object> fileUpload(HttpServletRequest request, Map<String, Object> paramMap) throws Exception {
Map<String, Object> rtnMap = new HashMap<String, Object>();
String uploadFilePath = prop.getString("site.uploadFilePath");
String fileFolder = (String) paramMap.get("fileFolder");
String filekey1 = paramMap.get("filekey1") == null ? "" : (String) paramMap.get("filekey1");
String filekey2 = paramMap.get("filekey2") == null ? "" : (String) paramMap.get("filekey2");
String filekey3 = paramMap.get("filekey3") == null ? "" : (String) paramMap.get("filekey3");
if ("".equals(filekey1) || "".equals(filekey2) || "".equals(filekey3)) {
rtnMap.put("successYn", "N");
rtnMap.put("message", "키값이 없습니다.");
} else {
rtnMap = FileUtil.fileUpload(request, uploadFilePath, fileFolder, (String[]) paramMap.get("allowExt"));
if ("Y".equals(rtnMap.get("successYn"))) {
List<Map<String, Object>> list = (List<Map<String, Object>>) rtnMap.get("list");
if (list != null) {
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
Map<String, Object> fileMap = (Map<String, Object>) list.get(i);
fileMap.put("filekey1", filekey1);
fileMap.put("filekey2", filekey2);
fileMap.put("filekey3", filekey3);
fileMap.put("enterpgm", (String) paramMap.get("pgm"));
fileMap.put("enterid", (String) paramMap.get("id"));
fileMap.put("entername", (String) paramMap.get("username"));
commonDAO.insert("commonDAO.saveFile", fileMap);
}
}
}
}
}
return rtnMap;
}
}
|
cs |
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
package egovframework.rte.kr.go.xxxxxxx.com.dao;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import egovframework.rte.psl.dataaccess.EgovAbstractDAO;
@Repository("commonDAO")
public class CommonDAO extends EgovAbstractDAO {
public Object selectObject(String queryId, Map<String, Object> paramMap) throws Exception {
Object rtnObj = (Object) this.getSqlMapClient().queryForObject(queryId, paramMap);
System.out.println("CommonDAO selectObject > rtnObj > queryId : " + "\n" + queryId + "\n" + "==" + rtnObj);
return rtnObj;
}
public List<?> selectList(String queryId, Map<String, Object> paramMap) throws Exception {
List<?> list = null;
try {
list = (List<?>) this.getSqlMapClient().queryForList(queryId, paramMap);
System.out.println("CommonDAO selectList > List.Size > queryId : " + "\n" + queryId + "\n" + "==" + list.size());
} catch(Exception e) {
e.printStackTrace();
}
return list;
}
public int selectListCnt(String queryId, Map<String, Object> paramMap) throws Exception {
return (Integer) this.getSqlMapClient().queryForObject(queryId, paramMap);
}
public int insertParamMap(String queryId, Map<String, Object> paramMap) throws Exception {
return (Integer) this.getSqlMapClient().queryForObject(queryId, paramMap);
}
public int updateParamMap(String queryId, Map<String, Object> paramMap) throws Exception {
return (Integer) this.getSqlMapClient().queryForObject(queryId, paramMap);
}
public int deleteParamMap(String queryId, Map<String, Object> paramMap) throws Exception {
return (Integer) this.getSqlMapClient().queryForObject(queryId, paramMap);
}
public int insertObject(String queryId, Object obj) throws Exception {
try {
return (Integer) this.getSqlMapClient().insert(queryId, obj);
} catch (Exception e) {
// e.printStackTrace();
return -1;
}
}
public int updateObject(String queryId, Object obj) throws Exception {
try {
return this.getSqlMapClient().update(queryId, obj);
} catch (Exception e) {
// e.printStackTrace();
return -1;
}
}
public int deleteObject(String queryId, Object obj) throws Exception {
try {
return (Integer) this.getSqlMapClient().insert(queryId, obj);
} catch (Exception e) {
// e.printStackTrace();
return -1;
}
}
public Object selectObject(String queryId, Object obj) throws Exception {
Object rtnObj = (Object) this.getSqlMapClient().queryForObject(queryId, obj);
return rtnObj;
}
public List<?> selectList(String queryId, Object obj) throws Exception {
List<?> list = (List<?>) this.getSqlMapClient().queryForList(queryId, obj);
return list;
}
public int selectListCnt(String queryId, Object obj) throws Exception {
return (Integer) this.getSqlMapClient().queryForObject(queryId, obj);
}
}
|
cs |
728x90
반응형