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<IotProductDO> {
|
|
default PageResult<IotProductDO> selectPage(IotProductPageReqVO reqVO) {
|
return selectPage(reqVO, new LambdaQueryWrapperX<IotProductDO>()
|
.likeIfPresent(IotProductDO::getName, reqVO.getName())
|
.likeIfPresent(IotProductDO::getProductKey, reqVO.getProductKey())
|
.orderByDesc(IotProductDO::getId));
|
}
|
|
default List<IotProductDO> selectList(Integer deviceType) {
|
return selectList(new LambdaQueryWrapperX<IotProductDO>()
|
.eqIfPresent(IotProductDO::getDeviceType, deviceType)
|
.orderByDesc(IotProductDO::getId));
|
}
|
|
default IotProductDO selectByProductKey(String productKey) {
|
return selectOne(new LambdaQueryWrapper<IotProductDO>()
|
.apply("LOWER(product_key) = {0}", productKey.toLowerCase()));
|
}
|
|
default List<IotProductDO> selectListByStatus(Integer status) {
|
return selectList(IotProductDO::getStatus, status);
|
}
|
|
default Long selectCountByCreateTime(@Nullable LocalDateTime createTime) {
|
return selectCount(new LambdaQueryWrapperX<IotProductDO>()
|
.geIfPresent(IotProductDO::getCreateTime, createTime));
|
}
|
|
}
|