通用单位
This commit is contained in:
parent
846cbef3da
commit
4d7e108f83
|
|
@ -1,18 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package cn.ysk.cashier.service.impl.shopimpl;
|
package cn.ysk.cashier.service.impl.shopimpl;
|
||||||
|
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUnitDto;
|
import cn.ysk.cashier.dto.shop.TbShopUnitDto;
|
||||||
|
|
@ -38,10 +23,7 @@ import javax.persistence.criteria.Predicate;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -54,8 +36,12 @@ public class TbShopUnitServiceImpl implements TbShopUnitService {
|
||||||
public Map<String, Object> queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable) {
|
public Map<String, Object> queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable) {
|
||||||
Page<TbShopUnit> page = tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
Page<TbShopUnit> page = tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> {
|
||||||
Predicate predicate = QueryHelp.getPredicate(root, null, criteriaBuilder);
|
Predicate predicate = QueryHelp.getPredicate(root, null, criteriaBuilder);
|
||||||
predicate = criteriaBuilder.or(predicate, criteriaBuilder.equal(root.get("shopId"), 1));
|
|
||||||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.equal(root.get("shopId"), criteria.getShopId()));
|
// predicate = criteriaBuilder.and(predicate, criteriaBuilder.in(root.get("shopId")).value(criteria.getShopId()).value("1"));
|
||||||
|
predicate = criteriaBuilder.and(predicate, criteriaBuilder.or(
|
||||||
|
criteriaBuilder.equal(root.get("shopId"), criteria.getShopId()),
|
||||||
|
criteriaBuilder.equal(root.get("shopId"), "1")));
|
||||||
|
|
||||||
if(StringUtils.isNotBlank(criteria.getName())){
|
if(StringUtils.isNotBlank(criteria.getName())){
|
||||||
predicate = criteriaBuilder.and(predicate, criteriaBuilder.like(root.get("name"), criteria.getName()));
|
predicate = criteriaBuilder.and(predicate, criteriaBuilder.like(root.get("name"), criteria.getName()));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue