package cn.iocoder.yudao.module.iot.dal.mysql.product; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.iot.controller.admin.product.vo.product.IotProductPageReqVO; import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; import javax.annotation.Nullable; import java.time.LocalDateTime; import java.util.List; /** * IoT 产品 Mapper * * @author ahh */ @Mapper public interface IotProductMapper extends BaseMapperX { default PageResult selectPage(IotProductPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(IotProductDO::getName, reqVO.getName()) .likeIfPresent(IotProductDO::getProductKey, reqVO.getProductKey()) .orderByDesc(IotProductDO::getId)); } default List selectList(Integer deviceType) { return selectList(new LambdaQueryWrapperX() .eqIfPresent(IotProductDO::getDeviceType, deviceType) .orderByDesc(IotProductDO::getId)); } default IotProductDO selectByProductKey(String productKey) { return selectOne(new LambdaQueryWrapper() .apply("LOWER(product_key) = {0}", productKey.toLowerCase())); } default List selectListByStatus(Integer status) { return selectList(IotProductDO::getStatus, status); } default Long selectCountByCreateTime(@Nullable LocalDateTime createTime) { return selectCount(new LambdaQueryWrapperX() .geIfPresent(IotProductDO::getCreateTime, createTime)); } }