|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package org.jeecg.modules.zystylefabric.controller; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -9,6 +10,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.jeecg.modules.demo.base.entity.ZyClothsModular; |
|
|
|
|
import org.jeecg.modules.demo.fabric.entity.ZyFabric; |
|
|
|
|
import org.jeecg.modules.demo.fabric.service.IZyFabricService; |
|
|
|
|
import org.jeecg.modules.zyclothsstyle.entity.ZyClothsStyle; |
|
|
|
@ -19,7 +21,11 @@ import org.jeecg.modules.zystylefabric.entity.ZyStyleFabricDetailVo; |
|
|
|
|
import org.jeecg.modules.zystylefabric.mapper.ZyStyleFabricMapper; |
|
|
|
|
import org.jeecg.modules.zystylefabric.service.INewZyStyleFabricService; |
|
|
|
|
import org.jeecg.modules.zystylefabric.service.IZyStyleFabricService; |
|
|
|
|
import org.jeecg.modules.zystylemodule.entity.NewStyleModule; |
|
|
|
|
import org.jeecg.modules.zystylemodule.entity.ZyStyleModule; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
@ -29,6 +35,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: 款式面料表 |
|
|
|
@ -66,10 +73,12 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
@ApiOperation(value = "款式面料表-分页列表查询", notes = "款式面料表-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<IPage<NewZyStyleFabric>> queryPageList(ZyStyleFabric zyStyleFabric, String id, |
|
|
|
|
@RequestParam(name = "fabricNumber", required = false) String fabricNumber, |
|
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
QueryWrapper<ZyStyleFabric> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
//从服装款式进去款式面料时 根据style_id进行筛选 所以一般都会有id即style_id
|
|
|
|
|
if (id != null) { |
|
|
|
|
queryWrapper.eq("style_id", id); |
|
|
|
|
} |
|
|
|
@ -84,6 +93,26 @@ public class ZyStyleFabricController extends JeecgController<ZyStyleFabric, IZyS |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
List<ZyStyleFabric> list = zyStyleFabricService.list(queryWrapper); |
|
|
|
|
//fabricNumber 面料编号查询参数 只有查询的时候才会有
|
|
|
|
|
if (StringUtils.hasText(fabricNumber)) { |
|
|
|
|
LambdaQueryWrapper<ZyFabric> queryWrapper2 = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper2.like( ZyFabric::getFabricNumber,fabricNumber); |
|
|
|
|
List<ZyFabric> listTwo = zyFabricService.list(queryWrapper2); |
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(listTwo)){ |
|
|
|
|
IPage<NewZyStyleFabric> pageList2 = new Page<>(pageNo, pageSize, 0); |
|
|
|
|
return Result.OK(pageList2); |
|
|
|
|
} |
|
|
|
|
List<ZyStyleFabric> zyStyleFabricList = new ArrayList<>(); |
|
|
|
|
for (ZyFabric zy : listTwo) { |
|
|
|
|
List<ZyStyleFabric> zyStyleFabrics = zyStyleFabricMapper.getListByFabricId(zy.getId()); |
|
|
|
|
zyStyleFabricList.addAll(zyStyleFabrics); |
|
|
|
|
} |
|
|
|
|
//将新查出来的集合在根据styleid 筛选一下
|
|
|
|
|
zyStyleFabricList = zyStyleFabricList.stream().filter(ZyStyleFabric -> ZyStyleFabric.getStyleId().equals(id)).collect(Collectors.toList()); |
|
|
|
|
list.clear(); |
|
|
|
|
list.addAll(zyStyleFabricList); |
|
|
|
|
} |
|
|
|
|
List<NewZyStyleFabric> newZyStyleFabrics = zyStyleFabricService.changeList(list); |
|
|
|
|
IPage<NewZyStyleFabric> pageList = new Page<>(pageNo, pageSize, list.size()); |
|
|
|
|
pageList.setRecords(newZyStyleFabrics); |
|
|
|
|