|
@@ -13,8 +13,10 @@ import com.ruoyi.app.service.ITbAppUserService;
|
|
import com.ruoyi.app.service.ITbFamilyMemberService;
|
|
import com.ruoyi.app.service.ITbFamilyMemberService;
|
|
import com.ruoyi.app.service.ITbFamilyService;
|
|
import com.ruoyi.app.service.ITbFamilyService;
|
|
import com.ruoyi.app.service.ITbMemberMiddleService;
|
|
import com.ruoyi.app.service.ITbMemberMiddleService;
|
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -24,6 +26,7 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.aspectj.weaver.bcel.AtAjAttributes;
|
|
import org.aspectj.weaver.bcel.AtAjAttributes;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@@ -47,19 +50,10 @@ public class FamilyMemberController extends AppBaseController {
|
|
private final ITbMemberMiddleService middleService;
|
|
private final ITbMemberMiddleService middleService;
|
|
|
|
|
|
@ApiOperation("我的家族成员列表")
|
|
@ApiOperation("我的家族成员列表")
|
|
- @ApiImplicitParams({
|
|
|
|
- @ApiImplicitParam(name = "pageNum", value = "当前页",paramType="int"),
|
|
|
|
- @ApiImplicitParam(name = "pageSize", value = "每页行数",paramType="int")
|
|
|
|
- })
|
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(Integer pageNum, Integer pageSize) {
|
|
|
|
|
|
+ public AjaxResult list() {
|
|
// 登录用户
|
|
// 登录用户
|
|
- AppMemberVo user = getLoginUser().getUser();
|
|
|
|
- // 获取成员信息
|
|
|
|
- AppMemberVo memberVo = appUserService.getAppMember(user.getUserId().toString(),"");
|
|
|
|
- if (memberVo == null) {
|
|
|
|
- return new TableDataInfo();
|
|
|
|
- }
|
|
|
|
|
|
+ AppMemberVo memberVo = getLoginUser().getUser();
|
|
// 获取默认家族信息
|
|
// 获取默认家族信息
|
|
TbFamily family = familyService.myFamily(memberVo.getMemberId());
|
|
TbFamily family = familyService.myFamily(memberVo.getMemberId());
|
|
// 获取家族关联成员的信息
|
|
// 获取家族关联成员的信息
|
|
@@ -67,20 +61,20 @@ public class FamilyMemberController extends AppBaseController {
|
|
.eq(TbMemberMiddle::getFamilyId, family.getId())
|
|
.eq(TbMemberMiddle::getFamilyId, family.getId())
|
|
);
|
|
);
|
|
if (middles.size() <= 0) {
|
|
if (middles.size() <= 0) {
|
|
- return new TableDataInfo();
|
|
|
|
|
|
+ return AjaxResult.success();
|
|
}
|
|
}
|
|
List<Long> ids = new ArrayList<>();
|
|
List<Long> ids = new ArrayList<>();
|
|
middles.forEach(item -> {
|
|
middles.forEach(item -> {
|
|
ids.add(item.getMemberId());
|
|
ids.add(item.getMemberId());
|
|
});
|
|
});
|
|
// 根据家族获取成员信息
|
|
// 根据家族获取成员信息
|
|
- pageNum = pageNum == null ? 1 : pageNum;
|
|
|
|
- pageSize = pageSize == null ? 10 : pageSize;
|
|
|
|
- PageHelper.startPage(pageNum, pageSize, "py_first asc");
|
|
|
|
|
|
+// pageNum = pageNum == null ? 1 : pageNum;
|
|
|
|
+// pageSize = pageSize == null ? 10 : pageSize;
|
|
|
|
+// PageHelper.startPage(pageNum, pageSize, "py_first asc");
|
|
List<TbFamilyMember> list = memberService.list(new LambdaQueryWrapper<TbFamilyMember>()
|
|
List<TbFamilyMember> list = memberService.list(new LambdaQueryWrapper<TbFamilyMember>()
|
|
.in(TbFamilyMember::getId, ids)
|
|
.in(TbFamilyMember::getId, ids)
|
|
);
|
|
);
|
|
- return getDataTable(list);
|
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("家族树")
|
|
@ApiOperation("家族树")
|
|
@@ -169,4 +163,19 @@ public class FamilyMemberController extends AppBaseController {
|
|
}
|
|
}
|
|
return AjaxResult.success(memberService.get(memberId));
|
|
return AjaxResult.success(memberService.get(memberId));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 删除家族成员
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation("删除家族成员")
|
|
|
|
+ @DeleteMapping("/{familyId}/{ids}" )
|
|
|
|
+ public AjaxResult remove(@PathVariable String familyId, @PathVariable Long[] ids) {
|
|
|
|
+ if (familyId == null) {
|
|
|
|
+ return AjaxResult.error("家族id不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (ids.length <= 0) {
|
|
|
|
+ return AjaxResult.error("未选择要删的成员");
|
|
|
|
+ }
|
|
|
|
+ return memberService.delMember(familyId,ids);
|
|
|
|
+ }
|
|
}
|
|
}
|