auto commit
This commit is contained in:
@@ -749,4 +749,57 @@ public class ProductionPlanningService {
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* M-BOM 저장
|
||||
* @param request
|
||||
* @param mbomData
|
||||
* @param partNo
|
||||
* @param partName
|
||||
* @return
|
||||
*/
|
||||
public int saveMbom(HttpServletRequest request, List<Map<String, Object>> mbomData, String partNo, String partName) {
|
||||
SqlSession sqlSession = null;
|
||||
int result = 0;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
HttpSession session = request.getSession();
|
||||
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||||
String userId = CommonUtils.checkNull(person.getUserId());
|
||||
|
||||
// M-BOM 헤더 정보 생성
|
||||
Map<String, Object> headerMap = new HashMap<>();
|
||||
headerMap.put("PART_NO", partNo);
|
||||
headerMap.put("PART_NAME", partName);
|
||||
headerMap.put("CREATE_USER", userId);
|
||||
headerMap.put("UPDATE_USER", userId);
|
||||
|
||||
// M-BOM 헤더 저장
|
||||
sqlSession.insert("productionplanning.insertMbomHeader", headerMap);
|
||||
String mbomHeaderObjid = (String) headerMap.get("OBJID");
|
||||
|
||||
// M-BOM 상세 데이터 저장
|
||||
for(Map<String, Object> item : mbomData) {
|
||||
item.put("MBOM_HEADER_OBJID", mbomHeaderObjid);
|
||||
item.put("CREATE_USER", userId);
|
||||
item.put("UPDATE_USER", userId);
|
||||
sqlSession.insert("productionplanning.insertMbomDetail", item);
|
||||
}
|
||||
|
||||
sqlSession.commit();
|
||||
result = 1;
|
||||
} catch(Exception e) {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.rollback();
|
||||
}
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user