package com.ff.common.service.impl;

import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.TenantSecretKeyMapper;
import com.ff.common.domain.TenantSecretKey;
import com.ff.common.service.ITenantSecretKeyService;

/**
 * 用户租户密钥Service业务层处理
 *
 * @author shi
 * @date 2025-02-11
 */
@Service
public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService
{
    @Autowired
    private TenantSecretKeyMapper tenantSecretKeyMapper;

    /**
     * 查询用户租户密钥
     *
     * @param id 用户租户密钥主键
     * @return 用户租户密钥
     */
    @Override
    public TenantSecretKey selectTenantSecretKeyById(Long id)
    {
        return tenantSecretKeyMapper.selectTenantSecretKeyById(id);
    }

    /**
     * 按租户密钥选择租户密钥
     *
     * @param tenantKey 租户密钥
     * @return {@link TenantSecretKey }
     */
    @Override
    public TenantSecretKey selectTenantSecretKeyByTenantKey(String tenantKey) {
        return tenantSecretKeyMapper.selectTenantSecretKeyByTenantKey(tenantKey);
    }

    /**
     * 查询用户租户密钥列表
     *
     * @param tenantSecretKey 用户租户密钥
     * @return 用户租户密钥
     */
    @Override
    public List<TenantSecretKey> selectTenantSecretKeyList(TenantSecretKey tenantSecretKey)
    {
        return tenantSecretKeyMapper.selectTenantSecretKeyList(tenantSecretKey);
    }

    /**
     * 新增用户租户密钥
     *
     * @param tenantSecretKey 用户租户密钥
     * @return 结果
     */
    @Override
    public int insertTenantSecretKey(TenantSecretKey tenantSecretKey)
    {
        tenantSecretKey.setCreateTime(DateUtils.getNowDate());
        return tenantSecretKeyMapper.insertTenantSecretKey(tenantSecretKey);
    }

    /**
     * 修改用户租户密钥
     *
     * @param tenantSecretKey 用户租户密钥
     * @return 结果
     */
    @Override
    public int updateTenantSecretKey(TenantSecretKey tenantSecretKey)
    {
        tenantSecretKey.setUpdateTime(DateUtils.getNowDate());
        return tenantSecretKeyMapper.updateTenantSecretKey(tenantSecretKey);
    }

    /**
     * 批量删除用户租户密钥
     *
     * @param ids 需要删除的用户租户密钥主键
     * @return 结果
     */
    @Override
    public int deleteTenantSecretKeyByIds(Long[] ids)
    {
        return tenantSecretKeyMapper.deleteTenantSecretKeyByIds(ids);
    }

    /**
     * 删除用户租户密钥信息
     *
     * @param id 用户租户密钥主键
     * @return 结果
     */
    @Override
    public int deleteTenantSecretKeyById(Long id)
    {
        return tenantSecretKeyMapper.deleteTenantSecretKeyById(id);
    }
}
