xiaoyi
2 天以前 b5e1bceabb36fe1d1e5e88397280d12e7044c6dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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"));
    }
}