use of com.github.liuweijw.business.admin.domain.QDict in project fw-cloud-framework by liuweijw.
the class DictServiceImpl method getDictList.
@Override
@Cacheable(key = "'dict_' + #type", unless = "#result eq null")
public List<Dict> getDictList(String type) {
List<Dict> dictList = new ArrayList<Dict>();
if (StringHelper.isBlank(type))
return dictList;
QDict qDict = QDict.dict;
return this.queryFactory.selectFrom(qDict).where(qDict.type.eq(type.trim())).fetch();
}
use of com.github.liuweijw.business.admin.domain.QDict in project fw-cloud-framework by liuweijw.
the class DictServiceImpl method delById.
@Override
@Transactional
@CacheEvict(allEntries = true)
public boolean delById(Integer id) {
if (null == id || id <= 0)
return Boolean.FALSE;
QDict qDict = QDict.dict;
long num = // 0 正常 1删除
this.queryFactory.update(qDict).set(qDict.statu, 1).where(qDict.id.eq(id.intValue())).execute();
return num > 0;
}
use of com.github.liuweijw.business.admin.domain.QDict in project fw-cloud-framework by liuweijw.
the class DictServiceImpl method findAll.
@Override
@Cacheable(key = "'page_dict_' + #p0.currentPage + '_' + #p0.pageSize + '_' + #p1.type + '_' + #p1.label")
public PageBean<Dict> findAll(PageParams pageParams, Dict dict) {
QDict qDict = QDict.dict;
// 用户名查询条件
Predicate qLabelPredicate = null;
Predicate qTypePredicate = null;
if (null != dict) {
if (StringHelper.isNotBlank(dict.getLabel())) {
qLabelPredicate = qDict.label.like("%" + dict.getLabel().trim() + "%");
}
if (StringHelper.isNotBlank(dict.getType())) {
qTypePredicate = qDict.type.like("%" + dict.getType().trim() + "%");
}
}
Predicate predicate = qDict.id.goe(0).and(qTypePredicate).and(qLabelPredicate);
Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, "id"));
PageRequest pageRequest = PageUtils.of(pageParams, sort);
Page<Dict> pageList = dictRepository.findAll(predicate, pageRequest);
return PageUtils.of(pageList);
}
Aggregations