use of com.ngtesting.platform.entity.TestOrg in project ngtesting-platform by aaronchen2k.
the class OrgServiceImpl method list.
@Override
public List<TestOrg> list(String keywords, String disabled, Long userId) {
DetachedCriteria dc = DetachedCriteria.forClass(TestOrg.class);
dc.createAlias("userSet", "users");
dc.add(Restrictions.eq("users.id", userId));
dc.add(Restrictions.eq("deleted", Boolean.FALSE));
if (StringUtil.isNotEmpty(keywords)) {
dc.add(Restrictions.like("name", "%" + keywords + "%"));
}
if (StringUtil.isNotEmpty(disabled)) {
dc.add(Restrictions.eq("disabled", Boolean.valueOf(disabled)));
}
dc.addOrder(Order.asc("id"));
List<TestOrg> ls = findAllByCriteria(dc);
return ls;
}
use of com.ngtesting.platform.entity.TestOrg in project ngtesting-platform by aaronchen2k.
the class OrgServiceImpl method genVos.
@Override
public List<OrgVo> genVos(List<TestOrg> pos, Long userId) {
TestUser user = (TestUser) get(TestUser.class, userId);
List<OrgVo> voList = new LinkedList<OrgVo>();
for (TestOrg po : pos) {
OrgVo vo = genVo(po);
if (po.getId().longValue() == user.getDefaultOrgId().longValue()) {
vo.setDefaultOrg(true);
}
voList.add(vo);
}
return voList;
}
use of com.ngtesting.platform.entity.TestOrg in project ngtesting-platform by aaronchen2k.
the class OrgServiceImpl method delete.
@Override
public Boolean delete(Long id) {
if (id == null) {
return false;
}
TestOrg po = (TestOrg) get(TestOrg.class, id);
po.setDeleted(true);
saveOrUpdate(po);
return true;
}
Aggregations