whycrzg
2021-02-02 086b0d677e761bb5d528e6f29232d663af6e83c7
src/main/java/com/fgkj/services/User_task_batt_templateService.java
@@ -26,7 +26,14 @@
   //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("添加成功!");
@@ -41,12 +48,16 @@
   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;
            }
         }
      }
@@ -54,8 +65,7 @@
         dataSourceTransactionManager.commit(transactionStatus);
         model.setCode(1);
         model.setMsg("修改成功!");
      }
      else{
      } else {
         dataSourceTransactionManager.rollback(transactionStatus);
         model.setMsg("修改失败!");
      }