parent
b4ebdd7073
commit
fba5088e8b
|
|
@ -103,7 +103,7 @@ public class DictionaryController extends ControllerBase {
|
|||
@MethodInfoMark(value = "删除字典", menuName = "字典管理")
|
||||
@ApiMark(moduleName = "字典管理", apiName = "删除字典")
|
||||
public ApiResult<Void> deleteDictionary(@Valid @RequestBody @NotEmpty List<Integer> ids) {
|
||||
dictionaryService.removeByIds(ids);
|
||||
dictionaryService.delete(ids);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import com.nflg.mobilebroken.common.pojo.request.SaveDictionaryRequest;
|
|||
import com.nflg.mobilebroken.common.pojo.vo.DictionaryVO;
|
||||
import com.nflg.mobilebroken.repository.entity.Dictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典 服务类
|
||||
|
|
@ -20,4 +22,6 @@ public interface IDictionaryService extends IService<Dictionary> {
|
|||
void search(DictionarySearchRequest request, IPage<DictionaryVO> page);
|
||||
|
||||
void save(SaveDictionaryRequest request);
|
||||
|
||||
void delete(List<Integer> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,20 @@ import com.nflg.mobilebroken.common.pojo.request.DictionarySearchRequest;
|
|||
import com.nflg.mobilebroken.common.pojo.request.SaveDictionaryRequest;
|
||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.repository.entity.Dictionary;
|
||||
import com.nflg.mobilebroken.repository.entity.DictionaryItem;
|
||||
import com.nflg.mobilebroken.repository.entity.DictionaryItemTranslate;
|
||||
import com.nflg.mobilebroken.repository.mapper.DictionaryMapper;
|
||||
import com.nflg.mobilebroken.repository.service.IDictionaryItemService;
|
||||
import com.nflg.mobilebroken.repository.service.IDictionaryItemTranslateService;
|
||||
import com.nflg.mobilebroken.repository.service.IDictionaryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -26,6 +34,12 @@ import java.util.Objects;
|
|||
@Service
|
||||
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements IDictionaryService {
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemService dictionaryItemService;
|
||||
|
||||
@Resource
|
||||
private IDictionaryItemTranslateService dictionaryItemTranslateService;
|
||||
|
||||
@Override
|
||||
public void search(DictionarySearchRequest request, IPage page) {
|
||||
LambdaQueryWrapper<Dictionary> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
|
@ -58,4 +72,13 @@ public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Diction
|
|||
updateById(dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void delete(List<Integer> ids) {
|
||||
removeByIds(ids);
|
||||
List<Integer> itemIds=dictionaryItemService.lambdaQuery().eq(DictionaryItem::getDictionaryId, ids).list().stream().map(DictionaryItem::getId).collect(Collectors.toList());
|
||||
dictionaryItemService.removeByIds(itemIds);
|
||||
dictionaryItemTranslateService.remove(new LambdaQueryWrapper<DictionaryItemTranslate>().in(DictionaryItemTranslate::getDictionaryItemId, itemIds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue