|
@@ -6,7 +6,9 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
+import com.ruoyi.app.domain.TbMemberMiddle;
|
|
|
import com.ruoyi.app.domain.vo.AppFamilyVo;
|
|
|
+import com.ruoyi.app.service.ITbMemberMiddleService;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -43,6 +45,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
public class TbFamilyController extends BaseController {
|
|
|
|
|
|
private final ITbFamilyService iTbFamilyService;
|
|
|
+ private final ITbMemberMiddleService middleService;
|
|
|
|
|
|
/**
|
|
|
* 查询家族列表
|
|
@@ -139,14 +142,21 @@ public class TbFamilyController extends BaseController {
|
|
|
return toAjax(iTbFamilyService.updateById(tbFamily) ? 1 : 0);
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 删除家族
|
|
|
-// */
|
|
|
-// @ApiOperation("删除家族")
|
|
|
-// @PreAuthorize("@ss.hasPermi('system:family:remove')" )
|
|
|
-// @Log(title = "家族" , businessType = BusinessType.DELETE)
|
|
|
-// @DeleteMapping("/{ids}" )
|
|
|
-// public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
-// return toAjax(iTbFamilyService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 删除家族
|
|
|
+ */
|
|
|
+ @ApiOperation("删除家族")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:family:remove')" )
|
|
|
+ @Log(title = "家族" , businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}" )
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
+ List<TbMemberMiddle> middles = middleService.list(new LambdaQueryWrapper<TbMemberMiddle>()
|
|
|
+ .in(TbMemberMiddle::getFamilyId, Arrays.asList(ids))
|
|
|
+ .eq(TbMemberMiddle::getStatus, "2")
|
|
|
+ );
|
|
|
+ if (middles.size() > 0) {
|
|
|
+ return AjaxResult.error("家族中还有成员,不允许删除");
|
|
|
+ }
|
|
|
+ return toAjax(iTbFamilyService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
|
|
+ }
|
|
|
}
|