FE1

12 篇文章 0 订阅
/**
* 添加预案关联
* @author ecy
*/
@Override
public void addPlanGroupMap(Connection conn,PlanInfo planInfo) throws Exception {
PreparedStatement pst = null;

String addPlanGroupMapByPersonSQL = "insert into SNOW_PLAN_PERSON_MAP (GROUP_ID,PERSON_ID) VALUES(?,?)";
pst = DBCommon.getPsm(conn, addPlanGroupMapByPersonSQL);
if(planInfo.getPlanGroupList()!=null && planInfo.getPlanGroupList().size()>0){
for(int i=0;i<planInfo.getPlanGroupList().size();i++){
pst.setString(1, planInfo.getPlanGroupList().get(i).getGroupID());
if(planInfo.getPlanGroupList().get(i).getPersonList()!=null && planInfo.getPlanGroupList().get(i).getPersonList().size()>0){
for(int j=0;j<planInfo.getPlanGroupList().get(i).getPersonList().size();j++){
pst.setString(2, planInfo.getPlanGroupList().get(i).getPersonList().get(j).getPersonID());
pst.addBatch();
}
}
}
pst.executeBatch();
}

String addPlanGroupMapByCarSQL = "insert into SNOW_PLAN_CAR_MAP (GROUP_ID,CAR_ID) VALUES (?,?)";
pst = DBCommon.getPsm(conn, addPlanGroupMapByCarSQL);
if(planInfo.getPlanGroupList()!=null && planInfo.getPlanGroupList().size()>0){
for(int i=0;i<planInfo.getPlanGroupList().size();i++){
pst.setString(1, planInfo.getPlanGroupList().get(i).getGroupID());
if(planInfo.getPlanGroupList().get(i).getCarList()!=null && planInfo.getPlanGroupList().get(i).getCarList().size()>0){
for(int j=0;j<planInfo.getPlanGroupList().get(i).getCarList().size();j++){
pst.setString(2, planInfo.getPlanGroupList().get(i).getCarList().get(j).getCarID());
pst.addBatch();
}
}
}
pst.executeBatch();
}

String addPlanGroupMapByCommandCarSQL = "insert into SNOW_PLAN_COMMAND_CAR_MAP (GROUP_ID,COMMAND_CAR_ID) VALUES (?,?)";
pst = DBCommon.getPsm(conn, addPlanGroupMapByCommandCarSQL);
if(planInfo.getPlanGroupList()!=null && planInfo.getPlanGroupList().size()>0){
for(int i=0;i<planInfo.getPlanGroupList().size();i++){
pst.setString(1, planInfo.getPlanGroupList().get(i).getGroupID());
if(planInfo.getPlanGroupList().get(i).getCommandCarList()!=null && planInfo.getPlanGroupList().get(i).getCommandCarList().size()>0){
for(int j=0;j<planInfo.getPlanGroupList().get(i).getCommandCarList().size();j++){
pst.setString(2, planInfo.getPlanGroupList().get(i).getCommandCarList().get(j).getCommandCarID());
pst.addBatch();
}
}
}
pst.executeBatch();
}

String addPlanGroupMapByStockSQL = "insert into SNOW_PLAN_STOCK_MAP (GROUP_ID,STOCKID) VALUES (?,?)";
pst = DBCommon.getPsm(conn, addPlanGroupMapByStockSQL);
if(planInfo.getPlanGroupList()!=null && planInfo.getPlanGroupList().size()>0){
for(int i=0;i<planInfo.getPlanGroupList().size();i++){
pst.setString(1, planInfo.getPlanGroupList().get(i).getGroupID());
if(planInfo.getPlanGroupList().get(i).getStockList()!=null && planInfo.getPlanGroupList().get(i).getStockList().size()>0){
for(int j=0;j<planInfo.getPlanGroupList().get(i).getStockList().size();j++){
pst.setString(2, planInfo.getPlanGroupList().get(i).getStockList().get(j).getStockID());
pst.addBatch();
}
}
}
pst.executeBatch();
}

String addPlanGroupMapByAreaSQL = "insert into SNOW_PLAN_GROUP_AREA (ROAD_CODE,ROAD_NAME,direction,STAKE_START,STAKE_END,REMARKS,group_id,group_area_id) VALUES (?,?,?,?,?,?,?,?)";
pst = DBCommon.getPsm(conn, addPlanGroupMapByAreaSQL);
if(planInfo.getPlanGroupList()!=null && planInfo.getPlanGroupList().size()>0){
for(int i=0;i<planInfo.getPlanGroupList().size();i++){
if(planInfo.getPlanGroupList().get(i).getGroupAreaList()!=null && planInfo.getPlanGroupList().get(i).getGroupAreaList().size()>0){
for(int j=0;j<planInfo.getPlanGroupList().get(i).getGroupAreaList().size();j++){
String id = IDGenerator.generateUID();
pst.setString(1, planInfo.getPlanGroupList().get(i).getGroupAreaList().get(j).getRoadCode());
pst.setString(2, planInfo.getPlanGroupList().get(i).getGroupAreaList().get(j).getRoadName());
pst.setString(3, planInfo.getPlanGroupList().get(i).getGroupAreaList().get(j).getDirection());
pst.setString(4, planInfo.getPlanGroupList().get(i).getGroupAreaList().get(j).getStartStake());
pst.setString(5, planInfo.getPlanGroupList().get(i).getGroupAreaList().get(j).getEndStake());
pst.setString(6, planInfo.getPlanGroupList().get(i).getGroupAreaList().get(j).getRemarks());
pst.setString(7, planInfo.getPlanGroupList().get(i).getGroupID());
pst.setString(8, id);
pst.addBatch();
}
}
}
pst.executeBatch();
}

if(pst!=null){
pst.close();
}

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值