package com.yc.ship.module.trade.dal.mysql.smsSendconfig;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.framework.tenant.core.aop.TenantIgnore;
import com.yc.ship.module.trade.controller.admin.smsSendconfig.vo.SmsSendconfigPageReqVO;
import com.yc.ship.module.trade.controller.admin.smsSendconfig.vo.SmsSendconfigQueryRespVO;
import com.yc.ship.module.trade.dal.dataobject.smsSendconfig.SmsSendconfigDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 短信发送配置 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SmsSendconfigMapper extends BaseMapperX<SmsSendconfigDO> {

    default PageResult<SmsSendconfigDO> selectPage(SmsSendconfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SmsSendconfigDO>()
                .likeIfPresent(SmsSendconfigDO::getSmsName, reqVO.getSmsName())
                .eqIfPresent(SmsSendconfigDO::getSmsType, reqVO.getSmsType())
                .eqIfPresent(SmsSendconfigDO::getSmsTemplateId, reqVO.getSmsTemplateId())
                .eqIfPresent(SmsSendconfigDO::getSmsContent, reqVO.getSmsContent())
                .eqIfPresent(SmsSendconfigDO::getSmsParms, reqVO.getSmsParms())
                .eqIfPresent(SmsSendconfigDO::getSendType, reqVO.getSendType())
                .eqIfPresent(SmsSendconfigDO::getSendDateType, reqVO.getSendDateType())
                .betweenIfPresent(SmsSendconfigDO::getSendTime, reqVO.getSendTime())
                .betweenIfPresent(SmsSendconfigDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SmsSendconfigDO::getIsUse, reqVO.getIsUse())
                .orderByDesc(SmsSendconfigDO::getId));
    }

    List<SmsSendconfigQueryRespVO> querySendList(@Param("id") Long id, @Param("type") Integer type);

    @TenantIgnore
    IPage<SmsSendconfigQueryRespVO> querySendLogList(IPage<SmsSendconfigDO> iPage, @Param("param") SmsSendconfigPageReqVO sendconfigPageReqVO);

}