package cn.iselab.mooctest.user.mapper;

import cn.iselab.mooctest.user.model.UserWechat;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @Author ROKG
 * @Description
 * @Date: Created in 上午11:01 2018/4/17
 * @Modified By:
 */
@Mapper
public interface UserWechatMapper {

    @Select("select * from user_wechat where user_id=#{userId}")
    UserWechat findByUserId(Long userId);

    @Select("select * from user_wechat where open_id=#{openId}")
    UserWechat findByOpenId(String openId);

    @Select("select * from user_wechat where union_id=#{unionId}")
    UserWechat findByUnionId(String unionId);

    @Insert("insert into user_wechat(user_id,union_id,open_id,is_delete) values (#{userId},#{unionId},#{openId},#{isDelete})")
    void save(UserWechat wechat);

    @Insert("update user_wechat set is_delete=#{isDelete}")
    void update(UserWechat wechat);
}
