package com.lz.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.modules.app.dao.SmsSendLogDao;
import com.lz.modules.app.entity.SmsSendLogEntity;
import com.lz.modules.app.service.SmsSendLogService;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service("smsSendLogService")
public class SmsSendLogServiceImpl extends ServiceImpl<SmsSendLogDao, SmsSendLogEntity> implements SmsSendLogService {

    protected final static org.slf4j.Logger logger = LoggerFactory.getLogger(SmsSendLogServiceImpl.class);

    @Resource
    SmsSendLogDao smsSendLogDao;

//    @Override
//    public PageUtils queryPage(Map<String, Object> params) {
//        IPage<SmsSendLogEntity> page = this.page(
//                new Query<SmsSendLogEntity>().getPage(params),
//                new QueryWrapper<SmsSendLogEntity>()
//        );
//        return new PageUtils(page);
//    }

    @Override
    public SmsSendLogEntity createAndInsert(String content, String mobiles, String remark, Long templateId) {
        SmsSendLogEntity smsSendLogDo = new SmsSendLogEntity();
        smsSendLogDo.setContent(content);
        smsSendLogDo.setPhones(mobiles);
        smsSendLogDo.setStatus(-1);//初始值
        smsSendLogDo.setTemplateId(0L);
        smsSendLogDo.setRemark(remark);
        smsSendLogDo.setTemplateId(templateId);
        this.save(smsSendLogDo);
        return smsSendLogDo;
    }

    @Override
    public String getNoCerifyCode(String type, String mobile) {
        return smsSendLogDao.getNoCerifyCode(type, mobile);
    }


}
