无关风月
2025-01-07 d02d3b681da14c2f342f2247457dc60b426ff299
manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java
@@ -17,6 +17,7 @@
import com.jilongda.manage.vo.TInventoryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Bean;
@@ -93,12 +94,14 @@
    }
    @ApiOperation(value = "镜架-根据品牌id查询对应库存")
    @PostMapping(value = "/getCountByBrandId")
    public ApiResult getCountByBrandId(Integer id) {
    @GetMapping(value = "/getCountByBrandId")
    public ApiResult getCountByBrandId(Integer id,Integer storeId) {
        List<Integer> collect = modelService.lambdaQuery().eq(TModel::getBrandId, id)
                .list().stream().map(TModel::getId).distinct().collect(Collectors.toList());
        if (collect.isEmpty())collect.add(-1);
        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).list();
        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect)
                .eq(TFrameGoods::getStoreId,storeId)
                .list();
        if (list.isEmpty())return ApiResult.success("0");
        int i = 0;
        for (TFrameGoods tFrameGoods : list) {
@@ -107,12 +110,13 @@
        return ApiResult.success(i);
    }
    @ApiOperation(value = "镜架-根据材质id查询对应库存")
    @PostMapping(value = "/getCountByMaterialId")
    public ApiResult getCountByMaterialId(Integer id) {
    @GetMapping(value = "/getCountByMaterialId")
    public ApiResult getCountByMaterialId(Integer id,Integer storeId) {
        List<Integer> collect = modelService.lambdaQuery().eq(TModel::getMaterialId, id)
                .list().stream().map(TModel::getId).distinct().collect(Collectors.toList());
        if (collect.isEmpty())collect.add(-1);
        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).list();
        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).
        eq(TFrameGoods::getStoreId,storeId).list();
        if (list.isEmpty())return ApiResult.success("0");
        int i = 0;
        for (TFrameGoods tFrameGoods : list) {
@@ -131,6 +135,7 @@
                .list().stream().map(TModel::getId).collect(Collectors.toList());
        if (collect.isEmpty())collect.add(-1);
        TFrameGoods one = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect)
                .eq(TFrameGoods::getStoreId,getCurrentByParam.getStoreId())
                .eq(TFrameGoods::getColor, getCurrentByParam.getColor()).one();
        if (one!=null){
            return ApiResult.success(one.getTotal());
@@ -143,9 +148,10 @@
    public ApiResult<Integer> getCurrentByParamLens(@RequestBody GetCurrentByParamLens dto) {
        TLensGoods one = lensGoodsService.lambdaQuery().in(TLensGoods::getSeriesId, dto.getSeriesId())
                .eq(dto.getLensType()!=null,TLensGoods::getLensType, dto.getLensType())
                .eq(dto.getRefractiveIndex()!=null,TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
                .eq(dto.getBallMirror()!=null,TLensGoods::getBallMirror, dto.getBallMirror())
                .eq(dto.getColumnMirror()!=null,TLensGoods::getColumnMirror, dto.getColumnMirror())
                .eq(StringUtils.hasLength(dto.getRefractiveIndex()),TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
                .eq(StringUtils.hasLength(dto.getBallMirror()),TLensGoods::getBallMirror, dto.getBallMirror())
                .eq(StringUtils.hasLength(dto.getColumnMirror()),TLensGoods::getColumnMirror, dto.getColumnMirror())
                .eq(dto.getStoreId()!=null,TLensGoods::getStoreId, dto.getStoreId())
                .one();
        if (one!=null){
            return ApiResult.success(one.getTotal());