ShiftRestServiceImpl.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:optashift-employee-rostering 作者:
@Override
public ShiftTemplate getTemplate(Integer tenantId) {
    TypedQuery<ShiftTemplate> q = entityManager.createNamedQuery("ShiftTemplate.get", ShiftTemplate.class);
    q.setParameter("tenantId", tenantId);
    List<ShiftTemplate> result = q.getResultList();
    if (result.isEmpty()) {
        return null;
    } else if (1 != result.size()) {
        throw new IllegalStateException("Each tenant can only have 1 template! Found " + result.size()
                + "templates!");
    } else {
        return result.get(0);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号