Search in sources :

Example 1 with UserDTO

use of com.web.framework.core.model.dto.UserDTO in project spring-boot-web by wangchengming666.

the class UcUserServiceImpl method list.

@Override
@UserOpreationLog(code = UserOperationConstants.U01)
public List<UserDTO> list(UserVO vo) {
    List<UserDTO> reList = new ArrayList<>(1);
    if (StringUtils.isNotBlank(vo.getCellphone())) {
        List<UcUserCellphone> cellphones = ucUserCellphoneMapper.selectList(new QueryWrapper<UcUserCellphone>().eq("cellphone", vo.getCellphone()));
        for (UcUserCellphone item : cellphones) {
            UcUser user = new UcUser();
            user.setId(item.getUserId());
            reList.addAll(listUser(user));
        }
        return reList;
    }
    if (StringUtils.isNotBlank(vo.getEmail())) {
        List<UcUserEmail> emails = ucUserEmailMapper.selectList(new QueryWrapper<UcUserEmail>().eq("email", vo.getEmail()));
        for (UcUserEmail item : emails) {
            UcUser user = new UcUser();
            user.setId(item.getUserId());
            reList.addAll(listUser(user));
        }
        return reList;
    }
    UcUser ucUser = new UcUser();
    ucUser.setIdentityCard(vo.getIdentityCard());
    ucUser.setTrueName(vo.getTrueName());
    ucUser.setNickName(vo.getNickName());
    ucUser.setUcName(vo.getUcName());
    return listUser(ucUser);
}
Also used : UcUserCellphone(com.web.framework.core.entity.UcUserCellphone) UcUserEmail(com.web.framework.core.entity.UcUserEmail) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) UserDTO(com.web.framework.core.model.dto.UserDTO) ArrayList(java.util.ArrayList) UcUser(com.web.framework.core.entity.UcUser) UserOpreationLog(com.web.framework.common.annotation.UserOpreationLog)

Example 2 with UserDTO

use of com.web.framework.core.model.dto.UserDTO in project spring-boot-web by wangchengming666.

the class UcUserServiceImpl method listUser.

private List<UserDTO> listUser(UcUser ucUser) {
    List<UserDTO> userDTOs;
    List<UcUser> users = ucUserMapper.selectList(new QueryWrapper<UcUser>().eq(StringUtils.isNotBlank(ucUser.getUcName()), "upper_uc_name", StringUtils.upperCase(ucUser.getUcName())).eq(StringUtils.isNotBlank(ucUser.getIdentityCard()), "identity_card", ucUser.getIdentityCard()).eq(StringUtils.isNotBlank(ucUser.getTrueName()), "true_name", ucUser.getTrueName()).eq(StringUtils.isNotBlank(ucUser.getNickName()), "nick_name", ucUser.getNickName()).eq(ucUser.getId() != null, "id", ucUser.getId()));
    userDTOs = new ArrayList<>(users.size());
    for (UcUser item : users) {
        UserDTO dto = new UserDTO(item);
        dto.setEmails(ucUserEmailMapper.selectList(new QueryWrapper<UcUserEmail>().eq("user_id", item.getId())));
        dto.setCellphones(ucUserCellphoneMapper.selectList(new QueryWrapper<UcUserCellphone>().eq("user_id", item.getId())));
        userDTOs.add(dto);
    }
    return userDTOs;
}
Also used : UcUserEmail(com.web.framework.core.entity.UcUserEmail) UcUserCellphone(com.web.framework.core.entity.UcUserCellphone) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) UserDTO(com.web.framework.core.model.dto.UserDTO) UcUser(com.web.framework.core.entity.UcUser)

Aggregations

QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)2 UcUser (com.web.framework.core.entity.UcUser)2 UcUserCellphone (com.web.framework.core.entity.UcUserCellphone)2 UcUserEmail (com.web.framework.core.entity.UcUserEmail)2 UserDTO (com.web.framework.core.model.dto.UserDTO)2 UserOpreationLog (com.web.framework.common.annotation.UserOpreationLog)1 ArrayList (java.util.ArrayList)1