package cn.iocoder.yudao.module.system.dal.mysql.housearea;

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.system.controller.admin.housearea.vo.HouseAreaPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.housearea.HouseAreaDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 库区 Mapper
 *
 * @author 陈宾顺
 */
@Mapper
public interface HouseAreaMapper extends BaseMapperX<HouseAreaDO> {

    default PageResult<HouseAreaDO> selectPage(HouseAreaPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HouseAreaDO>()
                .eqIfPresent(HouseAreaDO::getPositionMapId, reqVO.getPositionMapId())
                .likeIfPresent(HouseAreaDO::getAreaName, reqVO.getAreaName())
                .eqIfPresent(HouseAreaDO::getAreaMsg, reqVO.getAreaMsg())
                .betweenIfPresent(HouseAreaDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HouseAreaDO::getId));
    }

    /**
     * 根据地图id删除
     * @param mapId
     */
    void deleteHouseAreaByMapId(@Param("mapId") Long mapId);
}
