update store delete
This commit is contained in:
@@ -39,4 +39,10 @@ public interface TagService extends BaseService<Tag, String> {
|
||||
/// @param bizId 业务 ID
|
||||
/// @param tagIdList 标签 ID 列表
|
||||
void apply(TagApply.BizType bizType, String bizId, List<String> tagIdList);
|
||||
|
||||
/// 删除指定归属下的全部标签
|
||||
///
|
||||
/// @param ownerType 归属类型
|
||||
/// @param ownerId 归属 ID
|
||||
void deleteByOwner(Tag.OwnerType ownerType, String ownerId);
|
||||
}
|
||||
|
||||
+15
@@ -1,5 +1,6 @@
|
||||
package com.imyeyu.api.modules.common.service.implement;
|
||||
|
||||
import com.imyeyu.api.config.dbsource.TimiServerDBConfig;
|
||||
import com.imyeyu.api.modules.common.entity.Tag;
|
||||
import com.imyeyu.api.modules.common.entity.TagApply;
|
||||
import com.imyeyu.api.modules.common.mapper.TagApplyMapper;
|
||||
@@ -14,6 +15,7 @@ import com.imyeyu.spring.service.AbstractEntityService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -104,6 +106,19 @@ public class TagServiceImplement extends AbstractEntityService<Tag, String> impl
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||
@Override
|
||||
public void deleteByOwner(Tag.OwnerType ownerType, String ownerId) {
|
||||
TimiException.required(ownerType, "not found ownerType");
|
||||
TimiException.required(ownerId, "not found ownerId");
|
||||
Tag example = new Tag();
|
||||
example.setOwnerType(ownerType);
|
||||
example.setOwnerId(ownerId);
|
||||
for (Tag tag : mapper.selectAllByExample(example)) {
|
||||
super.delete(tag.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private List<TagApply> listApply(TagApply.BizType bizType, String bizId) {
|
||||
TimiException.required(bizType, "not found bizType");
|
||||
TimiException.required(bizId, "not found bizId");
|
||||
|
||||
Reference in New Issue
Block a user