package com.xindazhou.vehicle.dal.mysql.theft;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.framework.mybatis.core.mapper.BaseMapperX;
import com.xindazhou.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xindazhou.vehicle.controller.admin.vehicle.vo.VehicleTheftPageReqVO;
import com.xindazhou.vehicle.dal.dataobject.theft.VehicleTheftDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 失窃监控 Mapper
 *
 * @author xindazhou
 */
@Mapper
public interface VehicleTheftMapper extends BaseMapperX<VehicleTheftDO> {

    default PageResult<VehicleTheftDO> selectPage(VehicleTheftPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VehicleTheftDO>()
                .likeIfPresent(VehicleTheftDO::getVin, reqVO.getVin())
                .likeIfPresent(VehicleTheftDO::getOwnerName, reqVO.getOwnerName())
                .likeIfPresent(VehicleTheftDO::getOwnerMobile, reqVO.getOwnerMobile())
                .eqIfPresent(VehicleTheftDO::getCategory, reqVO.getCategory())
                .eqIfPresent(VehicleTheftDO::getModel, reqVO.getModel())
                .betweenIfPresent(VehicleTheftDO::getTheftReportTime, reqVO.getTheftReportTime())
                .orderByDesc(VehicleTheftDO::getCreateTime));
    }

}
