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<SafetyDocumentDO> {
|
default SafetyDocumentDO lockById(Long id) {
|
return selectOne(new LambdaQueryWrapperX<SafetyDocumentDO>().eq(SafetyDocumentDO::getId, id).last("FOR UPDATE"));
|
}
|
default SafetyDocumentDO latest(String documentKey) {
|
return selectOne(new LambdaQueryWrapperX<SafetyDocumentDO>().eq(SafetyDocumentDO::getDocumentKey, documentKey)
|
.orderByDesc(SafetyDocumentDO::getRevision).last("LIMIT 1"));
|
}
|
}
|