package com.yunzhupaas.message.service.impl;


import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.message.entity.WechatUserEntity;
import com.yunzhupaas.message.mapper.WechatUserMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.yunzhupaas.message.service.WechatUserService;
import com.yunzhupaas.permission.service.AuthorizeService;


import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.yunzhupaas.util.*;

import java.security.MessageDigest;
import java.util.*;

/**
 * 消息模板（新）
 * 版本： V3.2.0
 * 版权： 深圳市乐程软件有限公司（http://www.szlecheng.cn）
 * 作者： 云筑产品开发平台组
 * 日期： 2022-08-18
 */
@Service
public class WechatUserServiceImpl extends SuperServiceImpl<WechatUserMapper, WechatUserEntity> implements WechatUserService {


    @Override
    public WechatUserEntity getInfoByGzhId(String userId,String gzhId){
        QueryWrapper<WechatUserEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(WechatUserEntity::getUserId,userId);
        queryWrapper.lambda().eq(WechatUserEntity::getGzhId,gzhId);
        queryWrapper.lambda().eq(WechatUserEntity::getCloseMark,1);
        return this.getOne(queryWrapper);
    }

    @Override
    public void create(WechatUserEntity entity) {
        this.save(entity);
    }

    @Override
    public boolean update(String id, WechatUserEntity entity) {
        entity.setId(id);
        return this.updateById(entity);
    }

    @Override
    public void delete(WechatUserEntity entity) {
        if (entity != null) {
            this.removeById(entity.getId());
        }
    }

}

