潘志宝
2024-08-21 c39abccd937de093fc067abffac5f66b758bc97b
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.dal.mysql.sms;
H 2
3 import com.iailab.framework.common.pojo.PageResult;
4 import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
5 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import com.iailab.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO;
7 import com.iailab.module.system.dal.dataobject.sms.SmsTemplateDO;
8 import org.apache.ibatis.annotations.Mapper;
9
10 @Mapper
11 public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> {
12
13     default SmsTemplateDO selectByCode(String code) {
14         return selectOne(SmsTemplateDO::getCode, code);
15     }
16
17     default PageResult<SmsTemplateDO> selectPage(SmsTemplatePageReqVO reqVO) {
18         return selectPage(reqVO, new LambdaQueryWrapperX<SmsTemplateDO>()
19                 .eqIfPresent(SmsTemplateDO::getType, reqVO.getType())
20                 .eqIfPresent(SmsTemplateDO::getStatus, reqVO.getStatus())
21                 .likeIfPresent(SmsTemplateDO::getCode, reqVO.getCode())
22                 .likeIfPresent(SmsTemplateDO::getContent, reqVO.getContent())
23                 .likeIfPresent(SmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId())
24                 .eqIfPresent(SmsTemplateDO::getChannelId, reqVO.getChannelId())
25                 .betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getCreateTime())
26                 .orderByDesc(SmsTemplateDO::getId));
27     }
28
29     default Long selectCountByChannelId(Long channelId) {
30         return selectCount(SmsTemplateDO::getChannelId, channelId);
31     }
32
33 }