package cn.iocoder.yudao.module.mes.dal.mysql.safety; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.mes.dal.dataobject.safety.SafetyDocumentDO; import org.apache.ibatis.annotations.Mapper; @Mapper public interface SafetyDocumentMapper extends BaseMapperX { default SafetyDocumentDO lockById(Long id) { return selectOne(new LambdaQueryWrapperX().eq(SafetyDocumentDO::getId, id).last("FOR UPDATE")); } default SafetyDocumentDO latest(String documentKey) { return selectOne(new LambdaQueryWrapperX().eq(SafetyDocumentDO::getDocumentKey, documentKey) .orderByDesc(SafetyDocumentDO::getRevision).last("LIMIT 1")); } }