Commit 99ab26e43bea06a3850d431c7f6cc3bf11a95a00
1 parent
3def751d81
Exists in
master
and in
6 other branches
肌萎缩
Showing 2 changed files with 31 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SmnController.java
View file @
99ab26e
| ... | ... | @@ -81,6 +81,15 @@ |
| 81 | 81 | return smnFacade.setSmnStatus(id,status); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + @RequestMapping(method = RequestMethod.GET, value = "/setHusbandSmnStatus/{id}/{parentId}/{status}") | |
| 85 | + @ResponseBody | |
| 86 | + @TokenRequired | |
| 87 | + public BaseResponse setHusbandSmnStatus(@PathVariable String id,@PathVariable String parentId, | |
| 88 | + @PathVariable Integer status, HttpServletRequest request) { | |
| 89 | + return smnFacade.setHusbandSmnStatus(id,parentId,status); | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 84 | 93 | /** |
| 85 | 94 | * 列表 |
| 86 | 95 | * |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmnFacade.java
View file @
99ab26e
| ... | ... | @@ -444,5 +444,27 @@ |
| 444 | 444 | |
| 445 | 445 | return new BaseResponse(); |
| 446 | 446 | } |
| 447 | + | |
| 448 | + public BaseResponse setHusbandSmnStatus(String id, String parentId, Integer status) { | |
| 449 | + Query query = Query.query(Criteria.where("id").is(parentId)); | |
| 450 | + SmnModel smnModel = mongoTemplate.findOne(query, SmnModel.class); | |
| 451 | + | |
| 452 | + List<HusbandSmn> husbandSmns = smnModel.getHusbandSmns(); | |
| 453 | + if (CollectionUtils.isNotEmpty(husbandSmns)) | |
| 454 | + { | |
| 455 | + for (HusbandSmn husbandSmn : husbandSmns) | |
| 456 | + { | |
| 457 | + if (husbandSmn.getId().equals(id)) | |
| 458 | + { | |
| 459 | + husbandSmn.setStatus(status); | |
| 460 | + } | |
| 461 | + } | |
| 462 | + } | |
| 463 | + smnModel.setHusbandSmns(husbandSmns); | |
| 464 | + Update update = MongoConvertHelper | |
| 465 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(smnModel)); | |
| 466 | + mongoTemplate.updateFirst(query, update, SmnModel.class); | |
| 467 | + return new BaseResponse(); | |
| 468 | + } | |
| 447 | 469 | } |