|
|
@ -1,24 +1,18 @@ |
|
|
|
package org.jeecg.modules.demo.zyaccessories.controller; |
|
|
|
package org.jeecg.modules.demo.zyaccessories.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
|
|
import java.net.URLDecoder; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.accessories.entity.ZyAccessories; |
|
|
|
import org.jeecg.modules.demo.accessories.entity.ZyAccessories; |
|
|
|
import org.jeecg.modules.demo.accessories.service.IZyAccessoriesService; |
|
|
|
import org.jeecg.modules.demo.accessories.service.IZyAccessoriesService; |
|
|
|
import org.jeecg.modules.demo.fabric.service.IZyFabricService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.zyaccessories.entity.ZyStyleAccDetailVO; |
|
|
|
import org.jeecg.modules.demo.zyaccessories.entity.ZyStyleAccDetailVO; |
|
|
|
import org.jeecg.modules.demo.zyaccessories.entity.ZyStyleAccessories; |
|
|
|
import org.jeecg.modules.demo.zyaccessories.entity.ZyStyleAccessories; |
|
|
|
import org.jeecg.modules.demo.zyaccessories.mapper.ZyStyleAccessoriesMapper; |
|
|
|
import org.jeecg.modules.demo.zyaccessories.mapper.ZyStyleAccessoriesMapper; |
|
|
@ -29,22 +23,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
|
|
|
import org.jeecg.modules.zystylefabric.entity.ZyStyleFabricDetailVo; |
|
|
|
|
|
|
|
import org.jeecg.modules.zystylefabric.mapper.ZyStyleFabricMapper; |
|
|
|
import org.jeecg.modules.zystylefabric.mapper.ZyStyleFabricMapper; |
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil; |
|
|
|
|
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
|
|
|
|
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams; |
|
|
|
|
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams; |
|
|
|
|
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
|
|
|
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|
|
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
@ -88,35 +73,25 @@ public class ZyStyleAccessoriesController extends JeecgController<ZyStyleAccesso |
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
HttpServletRequest req) { |
|
|
|
HttpServletRequest req) { |
|
|
|
//zyStyleAccessories.getAccessNum() 辅料编号 查询参数 只有查询的时候才会有
|
|
|
|
//zyStyleAccessories.getAccessNum() 辅料编号 查询参数 只有查询的时候才会有
|
|
|
|
// List<ZyAccessories> accessories = new ArrayList<>();
|
|
|
|
List<ZyAccessories> accessories = new ArrayList<>(); |
|
|
|
// if (StringUtils.hasText(zyStyleAccessories.getAccessNum())) {
|
|
|
|
if (StringUtils.hasText(zyStyleAccessories.getAccessNum())) { |
|
|
|
// LambdaQueryWrapper<ZyAccessories> queryWrapper2 = new LambdaQueryWrapper<>();
|
|
|
|
accessories.addAll(zyAccessoriesService.list(new LambdaQueryWrapper<ZyAccessories>().like(ZyAccessories::getNums, zyStyleAccessories.getAccessNum()))); |
|
|
|
// queryWrapper2.like(ZyAccessories::getNums, zyStyleAccessories.getAccessNum());
|
|
|
|
} |
|
|
|
// accessories.addAll(zyAccessoriesService.list());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
QueryWrapper<ZyStyleAccessories> queryWrapper = QueryGenerator.initQueryWrapper(zyStyleAccessories, req.getParameterMap()); |
|
|
|
QueryWrapper<ZyStyleAccessories> queryWrapper = QueryGenerator.initQueryWrapper(zyStyleAccessories, req.getParameterMap()); |
|
|
|
Page<ZyStyleAccessories> page = new Page<ZyStyleAccessories>(pageNo, pageSize); |
|
|
|
IPage<ZyStyleAccessories> pageList = zyStyleAccessoriesService.page(new Page<>(pageNo, pageSize), queryWrapper); |
|
|
|
IPage<ZyStyleAccessories> pageList = zyStyleAccessoriesService.page(page, queryWrapper); |
|
|
|
|
|
|
|
List<ZyStyleAccessories> listRecords = pageList.getRecords(); |
|
|
|
List<ZyStyleAccessories> listRecords = pageList.getRecords(); |
|
|
|
|
|
|
|
|
|
|
|
// if (!ObjectUtils.isEmpty(accessories) && !ObjectUtils.isEmpty(listRecords)) {
|
|
|
|
if (!ObjectUtils.isEmpty(accessories) && !ObjectUtils.isEmpty(listRecords)) { |
|
|
|
// for (ZyAccessories zy : accessories) {
|
|
|
|
List<ZyStyleAccessories> list = new ArrayList<>(); |
|
|
|
// listRecords.stream()
|
|
|
|
accessories.forEach(zy -> listRecords.stream().filter(ZyStyleAccess -> ZyStyleAccess.getAccessoriesId().equals(zy.getId())).forEachOrdered(list::add)); |
|
|
|
// .filter(ZyStyleAccessories -> ZyStyleAccessories.getAccessoriesId().equals(zy.getId()))
|
|
|
|
pageList.setRecords(list.stream().distinct().collect(Collectors.toList()));//去重
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ZyStyleAccessories zy : listRecords) { |
|
|
|
|
|
|
|
String typeName = zyStyleFabricMapper.getTypeName(zy.getStyleId()); |
|
|
|
|
|
|
|
String num = zyStyleFabricMapper.getAccessoriesNumById(zy.getAccessoriesId()); |
|
|
|
|
|
|
|
if (StringUtils.hasText(typeName)) { |
|
|
|
|
|
|
|
zy.setTypeName(typeName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.hasText(num)) { |
|
|
|
|
|
|
|
zy.setAccessNum(num); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
pageList.getRecords().forEach(zyStyleAccess -> { |
|
|
|
|
|
|
|
String typeName = zyStyleFabricMapper.getTypeName(zyStyleAccess.getStyleId()); |
|
|
|
|
|
|
|
String num = zyStyleFabricMapper.getAccessoriesNumById(zyStyleAccess.getAccessoriesId()); |
|
|
|
|
|
|
|
if (StringUtils.hasText(typeName)) zyStyleAccess.setTypeName(typeName); |
|
|
|
|
|
|
|
if (StringUtils.hasText(num)) zyStyleAccess.setAccessNum(num); |
|
|
|
|
|
|
|
}); |
|
|
|
return Result.OK(pageList); |
|
|
|
return Result.OK(pageList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|