package cn.iocoder.yudao.module.smartfactory.dal.mysql.industrialinjury;

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.smartfactory.controller.admin.industrialinjury.vo.IndustrialInjuryPageReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.industrialinjury.IndustrialInjuryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 厂区工伤 Mapper
 *
 * @author 符溶馨
 */
@Mapper
public interface IndustrialInjuryMapper extends BaseMapperX<IndustrialInjuryDO> {

    default PageResult<IndustrialInjuryDO> selectPage(IndustrialInjuryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IndustrialInjuryDO>()
                .eqIfPresent(IndustrialInjuryDO::getStaffId, reqVO.getStaffId())
                .eqIfPresent(IndustrialInjuryDO::getFactoryId, reqVO.getFactoryId())
                .betweenIfPresent(IndustrialInjuryDO::getHappenTime, reqVO.getHappenTime())
                .eqIfPresent(IndustrialInjuryDO::getStatus, reqVO.getStatus())
                .orderByDesc(IndustrialInjuryDO::getId));
    }

}