|
@@ -4,15 +4,16 @@ import com.aizuda.boot.modules.flw.entity.FlwFormCategory;
|
|
|
import com.aizuda.boot.modules.flw.entity.vo.FlwFormCategoryVO;
|
|
|
import com.aizuda.boot.modules.flw.mapper.FlwFormCategoryMapper;
|
|
|
import com.aizuda.boot.modules.flw.service.IFlwFormCategoryService;
|
|
|
+import com.aizuda.boot.modules.flw.service.IFlwFormTemplateService;
|
|
|
import com.aizuda.core.api.ApiAssert;
|
|
|
import com.aizuda.service.service.BaseServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -23,7 +24,9 @@ import java.util.Objects;
|
|
|
* @since 2024-05-19
|
|
|
*/
|
|
|
@Service
|
|
|
+@AllArgsConstructor
|
|
|
public class FlwFormCategoryServiceImpl extends BaseServiceImpl<FlwFormCategoryMapper, FlwFormCategory> implements IFlwFormCategoryService {
|
|
|
+ private IFlwFormTemplateService formTemplateService;
|
|
|
|
|
|
@Override
|
|
|
public Page<FlwFormCategory> page(Page<FlwFormCategory> page, FlwFormCategory flwFormCategory) {
|
|
@@ -82,9 +85,11 @@ public class FlwFormCategoryServiceImpl extends BaseServiceImpl<FlwFormCategoryM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean removeByIds(Collection<?> list) {
|
|
|
+ public boolean removeByIds(List<Long> ids) {
|
|
|
+ ApiAssert.fail(ids.stream().anyMatch(Objects::isNull), "不允许删除所有");
|
|
|
this.checkExists(Wrappers.<FlwFormCategory>lambdaQuery().select(FlwFormCategory::getId)
|
|
|
- .in(FlwFormCategory::getPid, list), "存在子类不允许删除");
|
|
|
- return super.removeByIds(list);
|
|
|
+ .in(FlwFormCategory::getPid, ids), "存在子类不允许删除");
|
|
|
+ ApiAssert.fail(formTemplateService.existByFormCategoryIds(ids), "存在关联表单模板不允许删除");
|
|
|
+ return super.removeByIds(ids);
|
|
|
}
|
|
|
}
|