|
@@ -87,7 +87,7 @@ public class TaMetaImageTagController extends BaseController {
|
87
|
87
|
}
|
88
|
88
|
|
89
|
89
|
// 先清除所有数据
|
90
|
|
- iTaMetaImageTagService.removeAllBy(tagIds);
|
|
90
|
+// iTaMetaImageTagService.removeAllBy(tagIds);
|
91
|
91
|
|
92
|
92
|
// 再保存所有
|
93
|
93
|
iTaMetaImageTagService.saveBatch(taMetaImageTags);
|
|
@@ -108,24 +108,35 @@ public class TaMetaImageTagController extends BaseController {
|
108
|
108
|
return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
109
|
109
|
}
|
110
|
110
|
}
|
111
|
|
-//
|
112
|
|
-// /**
|
113
|
|
-// * 修改对象
|
114
|
|
-// * @param id 实体ID
|
115
|
|
-// * @param taMetaImageTag 实体对象
|
116
|
|
-// * @return
|
117
|
|
-// */
|
118
|
|
-// @RequestMapping(value="/taMetaImageTag/{id}",method= RequestMethod.PUT)
|
119
|
|
-// @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
120
|
|
-// public ResponseBean taMetaImageTagUpdate(@ApiParam("对象ID") @PathVariable Integer id,
|
121
|
|
-// @ApiParam("更新内容") @RequestBody TaMetaImageTag taMetaImageTag) throws Exception{
|
122
|
|
-//
|
123
|
|
-// if (iTaMetaImageTagService.updateById(taMetaImageTag)){
|
124
|
|
-// return ResponseBean.success(iTaMetaImageTagService.getById(id));
|
125
|
|
-// }else {
|
126
|
|
-// return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
127
|
|
-// }
|
128
|
|
-// }
|
|
111
|
+
|
|
112
|
+ /**
|
|
113
|
+ * 修改对象
|
|
114
|
+ * @param id 实体ID
|
|
115
|
+ * @param taMetaImageTag 实体对象
|
|
116
|
+ * @return
|
|
117
|
+ */
|
|
118
|
+ @RequestMapping(value="/taMetaImageTag",method= RequestMethod.PUT)
|
|
119
|
+ @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
|
120
|
+ public ResponseBean taMetaImageTagUpdate(@ApiParam("更新内容") @RequestBody Map<String, Object> params) throws Exception{
|
|
121
|
+ String[] originTags = (String[]) params.get("originTags");
|
|
122
|
+ String[] newTags = (String[]) params.get("newTags");
|
|
123
|
+ String originImage = params.get("originImage").toString();
|
|
124
|
+ String newImage = params.get("newImage").toString();
|
|
125
|
+
|
|
126
|
+ // 先删除旧的映射关系
|
|
127
|
+ iTaMetaImageTagService.removeAllBy(originTags, originImage);
|
|
128
|
+ // 再组装新的
|
|
129
|
+ List<TaMetaImageTag> list = new ArrayList<>();
|
|
130
|
+ for (String tagId: newTags) {
|
|
131
|
+ TaMetaImageTag item = new TaMetaImageTag();
|
|
132
|
+ item.setTagId(tagId);
|
|
133
|
+ item.setImageId(newImage);
|
|
134
|
+ list.add(item);
|
|
135
|
+ }
|
|
136
|
+
|
|
137
|
+ iTaMetaImageTagService.saveBatch(list);
|
|
138
|
+ return ResponseBean.success("success");
|
|
139
|
+ }
|
129
|
140
|
//
|
130
|
141
|
// /**
|
131
|
142
|
// * 根据id查询对象
|