All Downloads are FREE. Search and download functionalities are using the official Maven repository.

k.e.book.ddh.service.CcUserService Maven / Gradle / Ivy


package k.e.book.ddh.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import k.e.book.ddh.entity.CcUserDO;
import k.e.book.ddh.entity.CcUserQueryDTO;
import k.e.book.ddh.mapper.CcUserMapper;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * @author kk
 * @date 2023-05-21 11:04
 */
@Service
public class CcUserService extends ServiceImpl {

    @Resource
    private RedissonClient redissonClient;

    public CcUserDO getByChainAddr(String chainAddr) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
        qr.eq(CcUserDO::getChainAddress, chainAddr);
        qr.last("limit 1");
        return this.getOne(qr);
    }

    /**
     * @param id 有缓存
     * @return
     */
    public String getChainAddress(Long id) {
        return this.getById(id).getChainAddress();
    }

    public CcUserDO getUser(String mobile) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();
        qr.eq(CcUserDO::getMobile, mobile);

        return this.baseMapper.selectOne(qr);
    }

    public String getUserMobile(Long userId) {
        CcUserDO dd = this.getById(userId);

        return dd != null && StringUtils.isNotBlank(dd.getMobile()) ? dd.getMobile() : null;
    }

    public IPage selectProductPage(CcUserQueryDTO dto) {
        LambdaQueryWrapper qr = new LambdaQueryWrapper<>();

        if (dto.getId() != null) {
            qr.eq(CcUserDO::getId, dto.getId());
        }
        if (dto.getGroupId() != null) {
            qr.eq(CcUserDO::getGroupId, dto.getGroupId());
        }
        if (dto.getUsername() != null) {
            qr.eq(CcUserDO::getUsername, dto.getUsername());
        }
        if (dto.getNickname() != null) {
            qr.eq(CcUserDO::getNickname, dto.getNickname());
        }
        if (dto.getPassword() != null) {
            qr.eq(CcUserDO::getPassword, dto.getPassword());
        }
        if (dto.getSalt() != null) {
            qr.eq(CcUserDO::getSalt, dto.getSalt());
        }
        if (dto.getInviteCode() != null) {
            qr.eq(CcUserDO::getInviteCode, dto.getInviteCode());
        }
        if (dto.getEmail() != null) {
            qr.eq(CcUserDO::getEmail, dto.getEmail());
        }
        if (dto.getMobile() != null) {
            qr.eq(CcUserDO::getMobile, dto.getMobile());
        }
        if (dto.getAvatar() != null) {
            qr.eq(CcUserDO::getAvatar, dto.getAvatar());
        }
        if (dto.getLevel() != null) {
            qr.eq(CcUserDO::getLevel, dto.getLevel());
        }
        if (dto.getGender() != null) {
            qr.eq(CcUserDO::getGender, dto.getGender());
        }
        if (dto.getBirthday() != null) {
            qr.eq(CcUserDO::getBirthday, dto.getBirthday());
        }
        if (dto.getBio() != null) {
            qr.eq(CcUserDO::getBio, dto.getBio());
        }
        if (dto.getMoney() != null) {
            qr.eq(CcUserDO::getMoney, dto.getMoney());
        }
        if (dto.getFreezeMoney() != null) {
            qr.eq(CcUserDO::getFreezeMoney, dto.getFreezeMoney());
        }
        if (dto.getScore() != null) {
            qr.eq(CcUserDO::getScore, dto.getScore());
        }
        if (dto.getCredits() != null) {
            qr.eq(CcUserDO::getCredits, dto.getCredits());
        }
        if (dto.getInvitedConsumeMoney() != null) {
            qr.eq(CcUserDO::getInvitedConsumeMoney, dto.getInvitedConsumeMoney());
        }
        if (dto.getSuccessions() != null) {
            qr.eq(CcUserDO::getSuccessions, dto.getSuccessions());
        }
        if (dto.getMaxsuccessions() != null) {
            qr.eq(CcUserDO::getMaxsuccessions, dto.getMaxsuccessions());
        }
        if (dto.getPrevtime() != null) {
            qr.eq(CcUserDO::getPrevtime, dto.getPrevtime());
        }
        if (dto.getLogintime() != null) {
            qr.eq(CcUserDO::getLogintime, dto.getLogintime());
        }
        if (dto.getLoginip() != null) {
            qr.eq(CcUserDO::getLoginip, dto.getLoginip());
        }
        if (dto.getLoginfailure() != null) {
            qr.eq(CcUserDO::getLoginfailure, dto.getLoginfailure());
        }
        if (dto.getJoinip() != null) {
            qr.eq(CcUserDO::getJoinip, dto.getJoinip());
        }
        if (dto.getJointime() != null) {
            qr.eq(CcUserDO::getJointime, dto.getJointime());
        }
        if (dto.getCreatetime() != null) {
            qr.eq(CcUserDO::getCreatetime, dto.getCreatetime());
        }
        if (dto.getUpdatetime() != null) {
            qr.eq(CcUserDO::getUpdatetime, dto.getUpdatetime());
        }
        if (dto.getToken() != null) {
            qr.eq(CcUserDO::getToken, dto.getToken());
        }
        if (dto.getUserKey() != null) {
            qr.eq(CcUserDO::getUserKey, dto.getUserKey());
        }
        if (dto.getChainAddress() != null) {
            qr.eq(CcUserDO::getChainAddress, dto.getChainAddress());
        }
        if (dto.getStatus() != null) {
            qr.eq(CcUserDO::getStatus, dto.getStatus());
        }
        if (dto.getVerification() != null) {
            qr.eq(CcUserDO::getVerification, dto.getVerification());
        }
        if (dto.getOpenId() != null) {
            qr.eq(CcUserDO::getOpenId, dto.getOpenId());
        }
        if (dto.getPayPassword() != null) {
            qr.eq(CcUserDO::getPayPassword, dto.getPayPassword());
        }
        if (dto.getIsAuthentication() != null) {
            qr.eq(CcUserDO::getIsAuthentication, dto.getIsAuthentication());
        }
        if (dto.getProductShow() != null) {
            qr.eq(CcUserDO::getProductShow, dto.getProductShow());
        }
        if (dto.getBindCardStatus() != null) {
            qr.eq(CcUserDO::getBindCardStatus, dto.getBindCardStatus());
        }
        if (dto.getAvatarFrame() != null) {
            qr.eq(CcUserDO::getAvatarFrame, dto.getAvatarFrame());
        }
        if (dto.getApproveType() != null) {
            qr.eq(CcUserDO::getApproveType, dto.getApproveType());
        }
        if (dto.getFuel() != null) {
            qr.eq(CcUserDO::getFuel, dto.getFuel());
        }
        if (dto.getBackgroundImg() != null) {
            qr.eq(CcUserDO::getBackgroundImg, dto.getBackgroundImg());
        }
        if (dto.getCollectShow() != null) {
            qr.eq(CcUserDO::getCollectShow, dto.getCollectShow());
        }
        if (dto.getPersonalIntroduction() != null) {
            qr.eq(CcUserDO::getPersonalIntroduction, dto.getPersonalIntroduction());
        }
        if (dto.getCreatedAt() != null) {
            qr.eq(CcUserDO::getCreatedAt, dto.getCreatedAt());
        }
        if (dto.getUpdatedAt() != null) {
            qr.eq(CcUserDO::getUpdatedAt, dto.getUpdatedAt());
        }
        if (dto.getDeletedAt() != null) {
            qr.eq(CcUserDO::getDeletedAt, dto.getDeletedAt());
        }

        qr.orderByDesc(CcUserDO::getId);
        IPage page = new Page<>();
        page.setCurrent(dto.getPage());
        page.setSize(dto.getLimit());
        return baseMapper.selectPage(page, qr);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy