package cn.axzo.msg.center.dal.impl;

import cn.axzo.msg.center.dal.MNSChannelMessageTemplateDao;
import cn.axzo.msg.center.dal.mapper.MNSChannelMessageTemplateMapper;
import cn.axzo.msg.center.domain.entity.MNSChannelMessageTemplate;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * 渠道消息模板表 Dao实现类
 * </p>
 *
 * @author zhaoyong
 * @since 2021-05-19
 */
@Repository("mnsChannelMessageTemplateDao")
public class MNSChannelMessageTemplateDaoImpl extends ServiceImpl<MNSChannelMessageTemplateMapper, MNSChannelMessageTemplate> implements MNSChannelMessageTemplateDao {

  @Override
  public MNSChannelMessageTemplate queryByTemplateNo(String innerTemplateNo, String channelCode) {
    return this.lambdaQuery()
        .eq(MNSChannelMessageTemplate::getInnerTemplateNo, innerTemplateNo)
        .eq(MNSChannelMessageTemplate::getChannelCode, channelCode)
        .one();
  }

  @Override
  public MNSChannelMessageTemplate queryByChannelTemplateNo(String channelTemplateNo) {
    return this.lambdaQuery().eq(MNSChannelMessageTemplate::getTemplateNo, channelTemplateNo)
        .eq(MNSChannelMessageTemplate::getIsDelete, 0)
        .one();
  }
}
