Search in sources :

Example 1 with QDept

use of com.github.liuweijw.business.admin.domain.QDept in project fw-cloud-framework by liuweijw.

the class DeptServiceImpl method delById.

@Override
@Transactional
@CacheEvict(allEntries = true)
public boolean delById(Integer id) {
    if (null == id || id < 0)
        return false;
    QDept qDept = QDept.dept;
    Long num = this.queryFactory.update(qDept).set(qDept.statu, 1).where(qDept.deptId.eq(id)).execute();
    return null != num && num > 0;
}
Also used : QDept(com.github.liuweijw.business.admin.domain.QDept) CacheEvict(org.springframework.cache.annotation.CacheEvict) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with QDept

use of com.github.liuweijw.business.admin.domain.QDept in project fw-cloud-framework by liuweijw.

the class DeptServiceImpl method getDeptTreeList.

@Override
@Cacheable(key = "'dept_tree_list'", unless = "#result eq null")
public List<DeptTree> getDeptTreeList() {
    QDept dept = QDept.dept;
    List<Dept> list = this.queryFactory.selectFrom(dept).where(dept.statu.eq(0)).fetch();
    if (null == list || list.size() == 0)
        return new ArrayList<DeptTree>();
    return getDeptTree(list, 0);
}
Also used : QDept(com.github.liuweijw.business.admin.domain.QDept) QDept(com.github.liuweijw.business.admin.domain.QDept) Dept(com.github.liuweijw.business.admin.domain.Dept) DeptTree(com.github.liuweijw.business.commons.tree.DeptTree) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 3 with QDept

use of com.github.liuweijw.business.admin.domain.QDept in project fw-cloud-framework by liuweijw.

the class DeptServiceImpl method findAll.

@Override
@Cacheable(key = "'page_dept_' + #p0.currentPage + '_' + #p0.pageSize + '_' + #p1.type + '_' + #p1.label")
public PageBean<Dept> findAll(PageParams pageParams, Dept dept) {
    QDept qDept = QDept.dept;
    Predicate qNamePredicate = null;
    if (null != dept) {
        if (StringHelper.isNotBlank(dept.getDeptName())) {
            qNamePredicate = qDept.deptName.like("%" + dept.getDeptName().trim() + "%");
        }
    }
    Predicate predicate = qDept.deptId.goe(0).and(qNamePredicate);
    Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "deptId"));
    PageRequest pageRequest = PageUtils.of(pageParams, sort);
    Page<Dept> pageList = deptRepository.findAll(predicate, pageRequest);
    return PageUtils.of(pageList);
}
Also used : PageRequest(org.springframework.data.domain.PageRequest) QDept(com.github.liuweijw.business.admin.domain.QDept) QDept(com.github.liuweijw.business.admin.domain.QDept) Dept(com.github.liuweijw.business.admin.domain.Dept) Sort(org.springframework.data.domain.Sort) Predicate(com.querydsl.core.types.Predicate) Cacheable(org.springframework.cache.annotation.Cacheable)

Aggregations

QDept (com.github.liuweijw.business.admin.domain.QDept)3 Dept (com.github.liuweijw.business.admin.domain.Dept)2 Cacheable (org.springframework.cache.annotation.Cacheable)2 DeptTree (com.github.liuweijw.business.commons.tree.DeptTree)1 Predicate (com.querydsl.core.types.Predicate)1 CacheEvict (org.springframework.cache.annotation.CacheEvict)1 PageRequest (org.springframework.data.domain.PageRequest)1 Sort (org.springframework.data.domain.Sort)1 Transactional (org.springframework.transaction.annotation.Transactional)1