lirl пре 3 година
родитељ
комит
2ef76f38aa

+ 11 - 1
src/main/java/com/steerinfo/ems/emsprodplanmonth/controller/EmsProdplanMonthController.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.text.ParseException;
@@ -91,15 +92,23 @@ public class EmsProdplanMonthController extends BaseRESTfulController {
     @ApiImplicitParam(name = "emsProdplanMonth", value = "详细实体emsProdplanMonth", required = true, dataType = "EmsProdplanMonth")
     //@RequiresPermissions("emsprodplanmonth:create")
     @PostMapping(value = "/", produces  = "application/json;charset=UTF-8")
+    @Transactional
     public RESTfulResult add(@RequestBody EmsProdplanMonth[] models){
         String userId = JwtUtil.getUseridByToken();
         for (int i = 0; i < models.length; i++) {
+
             EmsProdplanMonth model = models[i];
             model.setCreateman(userId);
             model.setCreatetime(new Date());
             Map map = new HashMap();
             map.put("may",new SimpleDateFormat("yyyy-MM").format(model.getMay()));
-            map.put("workprocid",model.getWorkprocid());
+            if(model.getWorkprocid() != null && !"".equals(model.getWorkprocid())){
+                String  workprocid =  model.getWorkprocid();
+                if(!workprocid.startsWith(",")){
+                    workprocid = "'"+workprocid.replaceAll(",", "','").replaceAll(",", "','")+"'";
+                }
+                map.put("workprocid",workprocid);
+            }
             map.put("productid",model.getProductid());
             List list = emsProdplanMonthMapper.selectByParameters(map);
             if(list.size()>0){
@@ -135,6 +144,7 @@ public class EmsProdplanMonthController extends BaseRESTfulController {
     }
 
     @ApiOperation(value="删除", notes="根据url的id来指定删除对象")
+    @Transactional
     @ApiImplicitParam(paramType = "path", name = "id", value = "ID", required = true, dataType = "String")
     //@RequiresPermissions("emsprodplanmonth:delete")
     @DeleteMapping(value = "/{id}")//String