package com.yunzhupaas.permission.service.impl;

import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.permission.entity.UserOldPasswordEntity;
import com.yunzhupaas.permission.mapper.UserOldPasswordMapper;
import com.yunzhupaas.permission.service.UserOldPasswordService;
import com.yunzhupaas.permission.service.UserRelationService;
import com.yunzhupaas.util.DateUtil;
import com.yunzhupaas.util.RandomUtil;
import com.yunzhupaas.util.UserProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户信息
 *
 * @author 云筑产品开发平台组
 * @version V3.1.0
 * @copyright 深圳市乐程软件有限公司
 * @date 2024-09-26 上午9:18
 */
@Service
@DSTransactional
public class UserOldPasswordServiceImpl extends SuperServiceImpl<UserOldPasswordMapper, UserOldPasswordEntity> implements UserOldPasswordService {

    @Override
    public List<UserOldPasswordEntity> getList(String userId) {
        QueryWrapper<UserOldPasswordEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(UserOldPasswordEntity::getUserId,userId);
        queryWrapper.lambda().orderByDesc(UserOldPasswordEntity::getCreatorTime);
        return this.list(queryWrapper);
    }

    @Override
    public Boolean create(UserOldPasswordEntity entity) {
        entity.setId(RandomUtil.uuId());
        entity.setCreatorTime(DateUtil.getNowDate());
        this.save(entity);
        return true;
    }

}

