package com.fs.qywx.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.qywx.mapper.QywxUserMapper;
import com.fs.qywx.domain.QywxUser;
import com.fs.qywx.service.IQywxUserService;

/**
 * 企业微信三方应用授权人员Service业务层处理
 *
 * @author fs
 * @date 2023-07-24
 */
@Service
public class QywxUserServiceImpl implements IQywxUserService
{
    @Autowired
    private QywxUserMapper qywxUserMapper;

    /**
     * 查询企业微信三方应用授权人员
     *
     * @param id 企业微信三方应用授权人员主键
     * @return 企业微信三方应用授权人员
     */
    @Override
    public QywxUser selectQywxUserById(Integer id)
    {
        return qywxUserMapper.selectQywxUserById(id);
    }

    /**
     * 查询企业微信三方应用授权人员列表
     *
     * @param qywxUser 企业微信三方应用授权人员
     * @return 企业微信三方应用授权人员
     */
    @Override
    public List<QywxUser> selectQywxUserList(QywxUser qywxUser)
    {
        return qywxUserMapper.selectQywxUserList(qywxUser);
    }

    /**
     * 新增企业微信三方应用授权人员
     *
     * @param qywxUser 企业微信三方应用授权人员
     * @return 结果
     */
    @Override
    public int insertQywxUser(QywxUser qywxUser)
    {
        qywxUser.setCreateTime(DateUtils.getNowDate());
        return qywxUserMapper.insertQywxUser(qywxUser);
    }

    /**
     * 修改企业微信三方应用授权人员
     *
     * @param qywxUser 企业微信三方应用授权人员
     * @return 结果
     */
    @Override
    public int updateQywxUser(QywxUser qywxUser)
    {
        qywxUser.setUpdateTime(DateUtils.getNowDate());
        return qywxUserMapper.updateQywxUser(qywxUser);
    }

    /**
     * 批量删除企业微信三方应用授权人员
     *
     * @param ids 需要删除的企业微信三方应用授权人员主键
     * @return 结果
     */
    @Override
    public int deleteQywxUserByIds(Integer[] ids)
    {
        return qywxUserMapper.deleteQywxUserByIds(ids);
    }

    /**
     * 删除企业微信三方应用授权人员信息
     *
     * @param id 企业微信三方应用授权人员主键
     * @return 结果
     */
    @Override
    public int deleteQywxUserById(Integer id)
    {
        return qywxUserMapper.deleteQywxUserById(id);
    }

    @Override
    public int deleteQywxUserByCorpIdAndCorpId(String authCorpId, String userID) {
        return qywxUserMapper.deleteQywxUserByCorpIdAndCorpId(authCorpId,userID);
    }

    @Override
    public int updateQywxUserCompanyIdAndUserIdByCorpId(Long companyId, Long companyUserId, String corpId) {
        return qywxUserMapper.updateQywxUserCompanyIdAndUserIdByCorpId(companyId,companyUserId,corpId);
    }

    @Override
    public int updateQywxUserByUserIdAndCorpId(QywxUser q) {
        return qywxUserMapper.updateQywxUserByUserIdAndCorpId(q);
    }
}
