package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.AppUsersMapper;
import com.ruoyi.model.domain.AppUsers;
import com.ruoyi.model.service.IAppUsersService;

/**
 * 用户Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-27
 */
@Service
public class AppUsersServiceImpl implements IAppUsersService 
{
    @Autowired
    private AppUsersMapper appUsersMapper;

    /**
     * 查询用户
     * 
     * @param userId 用户主键
     * @return 用户
     */
    @Override
    public AppUsers selectAppUsersByUserId(Long userId)
    {
        return appUsersMapper.selectAppUsersByUserId(userId);
    }

    /**
     * 查询用户列表
     * 
     * @param appUsers 用户
     * @return 用户
     */
    @Override
    public List<AppUsers> selectAppUsersList(AppUsers appUsers)
    {
        return appUsersMapper.selectAppUsersList(appUsers);
    }

    /**
     * 新增用户
     * 
     * @param appUsers 用户
     * @return 结果
     */
    @Override
    public int insertAppUsers(AppUsers appUsers)
    {
        appUsers.setCreateTime(DateUtils.getNowDate());
        return appUsersMapper.insertAppUsers(appUsers);
    }

    /**
     * 修改用户
     * 
     * @param appUsers 用户
     * @return 结果
     */
    @Override
    public int updateAppUsers(AppUsers appUsers)
    {
        appUsers.setUpdateTime(DateUtils.getNowDate());
        return appUsersMapper.updateAppUsers(appUsers);
    }

    /**
     * 批量删除用户
     * 
     * @param userIds 需要删除的用户主键
     * @return 结果
     */
    @Override
    public int deleteAppUsersByUserIds(Long[] userIds)
    {
        return appUsersMapper.deleteAppUsersByUserIds(userIds);
    }

    /**
     * 删除用户信息
     * 
     * @param userId 用户主键
     * @return 结果
     */
    @Override
    public int deleteAppUsersByUserId(Long userId)
    {
        return appUsersMapper.deleteAppUsersByUserId(userId);
    }

    @Override
    public AppUsers selectAppUsersByOpenId(String openid) {
        return appUsersMapper.selectAppUsersByOpenId(openid);
    }
}
