Merge branch 'ww' into test
This commit is contained in:
commit
bd21ba9ae8
|
|
@ -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.repository.product;
|
package cn.ysk.cashier.repository.product;
|
||||||
|
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||||
|
|
@ -26,23 +11,18 @@ import java.util.List;
|
||||||
|
|
||||||
public interface TbProductStockDetailRepository extends JpaRepository<TbProductStockDetail, Long>, JpaSpecificationExecutor<TbProductStockDetail> {
|
public interface TbProductStockDetailRepository extends JpaRepository<TbProductStockDetail, Long>, JpaSpecificationExecutor<TbProductStockDetail> {
|
||||||
|
|
||||||
@Query(value =
|
@Query("SELECT detail FROM TbProductStockDetail detail " +
|
||||||
"SELECT detail.* " +
|
"INNER JOIN TbProduct pro ON detail.productId = pro.id " +
|
||||||
" FROM " +
|
"AND pro.shopId = :shopId " +
|
||||||
"tb_product_stock_detail detail" +
|
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||||
" INNER JOIN TbProduct pro ON detail.product_id = pro.id " +
|
"AND (:productName IS NULL OR pro.name LIKE %:productName%) " +
|
||||||
"AND pro.shop_id = :shopId " +
|
"AND (:type IS NULL OR pro.typeEnum = :type) " +
|
||||||
"AND ( :categoryId IS NULL OR pro.category_id = :categoryId ) " +
|
"where detail.shopId = :shopId " +
|
||||||
"AND ( :productName IS NULL OR pro.name LIKE %:productName % ) " +
|
"AND detail.createdAt > :startTime " +
|
||||||
"AND ( :type IS NULL OR pro.type = :type ) " +
|
"AND detail.createdAt < :endTime " +
|
||||||
" WHERE" +
|
"AND detail.type IN :types " +
|
||||||
" detail.shop_id = :shopId " +
|
"ORDER BY detail.id DESC")
|
||||||
"AND detail.created_at > :startTime " +
|
|
||||||
"AND detail.created_at < :endTime " +
|
|
||||||
"AND (:types IS NULL OR detail.type IN (:types)) " +
|
|
||||||
"ORDER BY " +
|
|
||||||
" detail.id DESC", nativeQuery = true)
|
|
||||||
Page<TbProductStockDetail> findByProductParam(String shopId, String productName, String categoryId, String type,
|
Page<TbProductStockDetail> findByProductParam(String shopId, String productName, String categoryId, String type,
|
||||||
List<String> types,
|
List<String> types,
|
||||||
long startTime, long endTime,Pageable pageable);
|
long startTime, long endTime, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|
@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.ysk.cashier.dto.product.*;
|
import cn.ysk.cashier.dto.product.*;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper;
|
||||||
import cn.ysk.cashier.pojo.order.TbOrderInfo;
|
|
||||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
import cn.ysk.cashier.pojo.shop.TbShopUnit;
|
||||||
|
|
@ -88,6 +87,9 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
case "lossNumber":
|
case "lossNumber":
|
||||||
criteria.setTypes(Collections.singletonList("报损"));
|
criteria.setTypes(Collections.singletonList("报损"));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
criteria.setTypes(Arrays.asList("供应商入库", "盘点入库", "其他入库", "退单","供应商出库","其他出库","盘点出库","售出记录","报损"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +98,8 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ
|
||||||
|
|
||||||
Page<TbProductStockDetail> page = tbProductStockDetailRepository.findByProductParam(
|
Page<TbProductStockDetail> page = tbProductStockDetailRepository.findByProductParam(
|
||||||
criteria.getShopId().toString(), criteria.getProductName(),
|
criteria.getShopId().toString(), criteria.getProductName(),
|
||||||
criteria.getCategoryId(),criteria.getType(),criteria.getTypes(),
|
criteria.getCategoryId(),criteria.getType(),
|
||||||
|
criteria.getTypes() ,
|
||||||
criteria.getStartTime().getTime(), criteria.getEndTime().getTime(), pageable);
|
criteria.getStartTime().getTime(), criteria.getEndTime().getTime(), pageable);
|
||||||
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
|
Page<TbProductStockDetailDto> map = page.map(tbProductStockDetailMapper::toDto);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue