fix:增加标签排序入参
This commit is contained in:
parent
0c5aab655a
commit
2924849d2f
|
|
@ -41,9 +41,9 @@ public class EdTagLibraryController {
|
|||
// 拖拽修改排序/分组
|
||||
@GetMapping("/updateOrder")
|
||||
@UserOperation(value="修改了标签顺序", modelName = UserOperationModuleEnum.TAG)
|
||||
public ElectromagneticResult<?> updateTagOrder(@RequestParam String tagId, @RequestParam String newParentId, @RequestParam Integer newOrderBy) {
|
||||
public ElectromagneticResult<?> updateTagOrder(@RequestParam String tagId, @RequestParam String newTagId, @RequestParam String newParentId, @RequestParam Integer newOrderBy) {
|
||||
String updatedBy = UserThreadLocal.getUserId();
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.updateTagOrder(tagId, newParentId, newOrderBy,updatedBy));
|
||||
return ElectromagneticResultUtil.success(edTagLibraryService.updateTagOrder(tagId, newTagId, newParentId, newOrderBy,updatedBy));
|
||||
}
|
||||
|
||||
// 发布标签
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public interface EdTagLibraryService extends IService<EdTagLibrary> {
|
|||
* @param tagId
|
||||
* @param newOrderBy
|
||||
*/
|
||||
Boolean updateTagOrder(String tagId, String newParentId, Integer newOrderBy, String updatedBy);
|
||||
Boolean updateTagOrder(String tagId, String newTagId, String newParentId, Integer newOrderBy, String updatedBy);
|
||||
|
||||
/**
|
||||
* 发布标签
|
||||
|
|
|
|||
|
|
@ -96,18 +96,29 @@ public class EdTagLibraryServiceImpl extends ServiceImpl<EdTagLibraryMapper, EdT
|
|||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateTagOrder(String tagId, String newParentId, Integer newOrderBy, String updatedBy) {
|
||||
|
||||
public Boolean updateTagOrder(String tagId, String newTagId, String newParentId, Integer newOrderBy, String updatedBy) {
|
||||
|
||||
if (StringUtils.isEmpty(newParentId) || newOrderBy == null) {
|
||||
throw new IllegalArgumentException("缺少参数");
|
||||
}
|
||||
|
||||
// 查询该标签
|
||||
EdTagLibrary tag = this.getOne(new LambdaQueryWrapper<EdTagLibrary>()
|
||||
.eq(EdTagLibrary::getTagId, tagId));
|
||||
// 查询交换顺序的标签/组
|
||||
EdTagLibrary newTag = this.getOne(new LambdaQueryWrapper<EdTagLibrary>()
|
||||
.eq(EdTagLibrary::getTagId, newTagId));
|
||||
|
||||
Assert.notNull(tag,"标签不存在");
|
||||
Assert.notNull(newTag, "无法将标签移动到此位置");
|
||||
|
||||
// 若标签挪到空标签组下,newTagId为新标签组Id
|
||||
if (!tag.getType().equals(newTag.getType())) {
|
||||
if (tag.getType().equals(TagTypeEnum.TAG.getCode())) {
|
||||
newParentId = newTagId;
|
||||
} else {
|
||||
throw new BizException("标签组无法移动到标签下");
|
||||
}
|
||||
}
|
||||
|
||||
String oldParentId = tag.getParentId();
|
||||
Integer oldOrderBy = tag.getOrderBy();
|
||||
|
|
|
|||
Loading…
Reference in New Issue