| | |
| | | //4.4作业模板管理(新建模板) |
| | | public ServiceModel add(User_task_batt_template obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.add(obj); |
| | | Boolean bl= null; |
| | | try { |
| | | bl = mapper.add(obj); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | model.setMsg("添加失败!"); |
| | | return model; |
| | | } |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("添加成功!"); |
| | |
| | | public ServiceModel update(List<User_task_batt_template> list) { |
| | | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| | | ServiceModel model = new ServiceModel(); |
| | | //TODO perry待查 |
| | | boolean bl=true; |
| | | if(list!=null&&list.size()>0){ |
| | | for (int i=0;i<list.size();i++) { |
| | | if(!mapper.updatePro(list.get(i))){ |
| | | bl=false; |
| | | try { |
| | | bl = mapper.updatePro(list.get(i)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | model.setMsg("修改失败!"); |
| | | return model; |
| | | } |
| | | } |
| | | } |
| | |
| | | dataSourceTransactionManager.commit(transactionStatus); |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | | } |
| | | else{ |
| | | } else { |
| | | dataSourceTransactionManager.rollback(transactionStatus); |
| | | model.setMsg("修改失败!"); |
| | | } |