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

import cn.axzo.msg.center.dal.MNSMessageTemplateParamDao;
import cn.axzo.msg.center.dal.mapper.MNSMessageTemplateParamMapper;
import cn.axzo.msg.center.domain.entity.MNSMessageTemplateParam;
import cn.axzo.msg.center.notices.common.enums.IsDeletedEnum;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 渠道模板变量序列表 Dao实现类
 * </p>
 *
 * @author szg
 * @since 2021-08-07
 */
@Repository("mnsMessageTemplateParamDao")
public class MNSMessageTemplateParamDaoImpl extends ServiceImpl<MNSMessageTemplateParamMapper, MNSMessageTemplateParam> implements
        MNSMessageTemplateParamDao {

  @Override
  public List<MNSMessageTemplateParam> getByTemplateNo(String templateNo) {
    return this.lambdaQuery().eq(MNSMessageTemplateParam::getTemplateNo, templateNo)
        .eq(MNSMessageTemplateParam::getIsDelete, IsDeletedEnum.NO.getCode())
        .orderByAsc(MNSMessageTemplateParam::getParamOrder)
        .list();
  }

  @Override
  public List<MNSMessageTemplateParam> getAllMessageTemplateParams() {
    return this.lambdaQuery()
        .eq(MNSMessageTemplateParam::getIsDelete, IsDeletedEnum.NO.getCode())
        .list();
  }

}
