家庭成员
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
506c936096
commit
f29c1774d9
@ -86,4 +86,35 @@ public class PersonController {
|
||||
BeanUtils.toBean(list, PersonRespVO.class));
|
||||
}
|
||||
|
||||
@PutMapping("/add-members")
|
||||
@Operation(summary = "根据用户ID更新家庭组号")
|
||||
@Parameter(name = "id", description = "用户编号", required = true)
|
||||
@Parameter(name = "familyid", description = "家庭组号", required = true)
|
||||
public CommonResult<Boolean> addMembers(@RequestParam("id") Integer id, @RequestParam("familyid") String familyid) {
|
||||
personService.updatePersonFamilyId(id, familyid);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/remove-members")
|
||||
@Operation(summary = "根据用户ID移除家庭组号")
|
||||
@Parameter(name = "id", description = "用户编号", required = true)
|
||||
public CommonResult<Boolean> removeMembers(@RequestParam("id") Integer id) {
|
||||
personService.removePersonFamilyId(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get-members-by-familyid")
|
||||
@Operation(summary = "根据家庭组号获取所有成员")
|
||||
@Parameter(name = "familyid", description = "家庭组号", required = true)
|
||||
public CommonResult<List<PersonRespVO>> getMembersByFamilyid(@RequestParam("familyid") String familyid) {
|
||||
List<PersonDO> list = personService.getMembersByFamilyid(familyid);
|
||||
return success(BeanUtils.toBean(list, PersonRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page-no-familyid")
|
||||
@Operation(summary = "获得没有家庭组号的用户基本信息分页")
|
||||
public CommonResult<PageResult<PersonRespVO>> getPersonPageNoFamilyid(@Valid PersonPageReqVO pageReqVO) {
|
||||
PageResult<PersonDO> pageResult = personService.getPersonPageNoFamilyid(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PersonRespVO.class));
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.person.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@ -58,11 +59,11 @@ public class PersonRespVO {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createtime;
|
||||
private String createtime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updatetime;
|
||||
private String updatetime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
@ExcelProperty("创建人")
|
||||
|
@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.person.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@ -50,10 +53,10 @@ public class PersonSaveReqVO {
|
||||
private String idcard;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createtime;
|
||||
private String createtime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatetime;
|
||||
private String updatetime;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private String createby;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.person;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
@ -80,12 +81,12 @@ public class PersonDO {
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("createtime")
|
||||
private LocalDateTime createtime;
|
||||
private String createtime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("updatetime")
|
||||
private LocalDateTime updatetime;
|
||||
private String updatetime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
|
@ -36,4 +36,23 @@ public interface PersonMapper extends BaseMapperX<PersonDO> {
|
||||
.orderByDesc(PersonDO::getId));
|
||||
}
|
||||
|
||||
default PageResult<PersonDO> selectPageNoFamilyid(PersonPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PersonDO>()
|
||||
.eqIfPresent(PersonDO::getPhone, reqVO.getPhone())
|
||||
.eqIfPresent(PersonDO::getPassword, reqVO.getPassword())
|
||||
.likeIfPresent(PersonDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PersonDO::getAddress, reqVO.getAddress())
|
||||
.eqIfPresent(PersonDO::getOrgid, reqVO.getOrgid())
|
||||
.likeIfPresent(PersonDO::getOrgname, reqVO.getOrgname())
|
||||
.eqIfPresent(PersonDO::getFamilyrelation, reqVO.getFamilyrelation())
|
||||
.eqIfPresent(PersonDO::getIsvip, reqVO.getIsvip())
|
||||
.eqIfPresent(PersonDO::getIdcard, reqVO.getIdcard())
|
||||
.betweenIfPresent(PersonDO::getCreatetime, reqVO.getCreatetime())
|
||||
.betweenIfPresent(PersonDO::getUpdatetime, reqVO.getUpdatetime())
|
||||
.eqIfPresent(PersonDO::getCreateby, reqVO.getCreateby())
|
||||
.eqIfPresent(PersonDO::getUpdateby, reqVO.getUpdateby())
|
||||
.isNull(PersonDO::getFamilyid)
|
||||
.orderByDesc(PersonDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -52,4 +52,35 @@ public interface PersonService {
|
||||
*/
|
||||
PageResult<PersonDO> getPersonPage(PersonPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户家庭组号
|
||||
*
|
||||
* @param id 用户编号
|
||||
* @param familyid 家庭组号
|
||||
*/
|
||||
void updatePersonFamilyId(Integer id, String familyid);
|
||||
|
||||
/**
|
||||
* 移除用户家庭组号
|
||||
*
|
||||
* @param id 用户编号
|
||||
*/
|
||||
void removePersonFamilyId(Integer id);
|
||||
|
||||
/**
|
||||
* 根据家庭组号获取所有成员
|
||||
*
|
||||
* @param familyid 家庭组号
|
||||
* @return 成员列表
|
||||
*/
|
||||
List<PersonDO> getMembersByFamilyid(String familyid);
|
||||
|
||||
PageResult<PersonDO> getPersonPageNoFamilyid(PersonPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户基本信息分页没有家庭组号
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户基本信息分页
|
||||
*/
|
||||
}
|
@ -3,13 +3,11 @@ package cn.iocoder.yudao.module.system.service.person;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.person.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.person.PersonDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.person.PersonMapper;
|
||||
@ -17,6 +15,9 @@ import cn.iocoder.yudao.module.system.dal.mysql.person.PersonMapper;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 用户基本信息 Service 实现类
|
||||
*
|
||||
@ -71,4 +72,35 @@ public class PersonServiceImpl implements PersonService {
|
||||
return personMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePersonFamilyId(Integer id, String familyid) {
|
||||
// 校验存在
|
||||
validatePersonExists(id);
|
||||
// 更新
|
||||
personMapper.update(null, new LambdaUpdateWrapper<PersonDO>()
|
||||
.eq(PersonDO::getId, id)
|
||||
.set(PersonDO::getFamilyid, familyid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePersonFamilyId(Integer id) {
|
||||
// 校验存在
|
||||
validatePersonExists(id);
|
||||
// 更新
|
||||
personMapper.update(null, new LambdaUpdateWrapper<PersonDO>()
|
||||
.eq(PersonDO::getId, id)
|
||||
.set(PersonDO::getFamilyid, null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PersonDO> getMembersByFamilyid(String familyid) {
|
||||
return personMapper.selectList(new LambdaQueryWrapper<PersonDO>()
|
||||
.eq(PersonDO::getFamilyid, familyid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PersonDO> getPersonPageNoFamilyid(PersonPageReqVO pageReqVO) {
|
||||
return personMapper.selectPageNoFamilyid(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user