package com.pcloud.book.skill.dao.impl;

import com.pcloud.book.skill.dao.PcloudSubRemindDao;
import com.pcloud.book.skill.entity.PcloudSubRemind;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author lily
 * @date 2019/4/23 15:54
 */
@Component("pcloudSubRemindDao")
public class PcloudSubRemindDaoImpl extends BaseDaoImpl<PcloudSubRemind> implements PcloudSubRemindDao {


    @Override
    public void updateSubState(Integer relSkillId, Integer skillType, String wxUserId,Integer skillId) {
        Map<String,Object> map=new HashMap<>();
        map.put("relSkillId",relSkillId);
        map.put("skillType",skillType);
        map.put("wxUserId",wxUserId);
        map.put("skillId",skillId);
        super.getSqlSession().update(getStatement("updateSubState"), map);
    }

    @Override
    public List<PcloudSubRemind> getUnSubRecord() {
        return super.getSqlSession().selectList(getStatement("getUnSubRecord"));
    }

    @Override
    public PcloudSubRemind getByMap(Integer relSkillId, Integer skillType, String wxUserId, Integer skillId) {
        Map<String,Object> map=new HashMap<>();
        map.put("relSkillId",relSkillId);
        map.put("skillType",skillType);
        map.put("wxUserId",wxUserId);
        map.put("skillId",skillId);
        return super.getSqlSession().selectOne(getStatement("getByMap"),map);
    }
}
