|
|
@@ -17,13 +17,16 @@
|
|
|
package org.springblade.client.goods.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springblade.client.corps.service.ICorpsAttnService;
|
|
|
import org.springblade.client.corps.service.ICorpsDescService;
|
|
|
import org.springblade.client.dto.GoodsDescDto;
|
|
|
@@ -324,4 +327,70 @@ public class GoodsDescPartsController extends BladeController {
|
|
|
return R.data(goodsDesc);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/descListAll")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入goodsDesc")
|
|
|
+ public R<List<GoodsDesc>> descListNew(@RequestParam(name = "current", defaultValue = "1") Integer current,
|
|
|
+ @RequestParam(name = "size", defaultValue = "10") Integer size,
|
|
|
+ @RequestParam(name = "cname", required = false) String cname,
|
|
|
+ @RequestParam(name = "cnameInt", required = false) String cnameInt,
|
|
|
+ @RequestParam(name = "ename", required = false) String ename,
|
|
|
+ @RequestParam(name = "code", required = false) String code,
|
|
|
+ @RequestParam(name = "status", required = false) String status,
|
|
|
+ @RequestParam(name = "unit", required = false) String unit,
|
|
|
+ @RequestParam(name = "remarks", required = false) String remarks,
|
|
|
+ @RequestParam(name = "upperFrame", required = false) String upperFrame,
|
|
|
+ @RequestParam(name = "label", required = false) String label,
|
|
|
+ @RequestParam(name = "categoryitem", required = false) String categoryitem,
|
|
|
+ @RequestParam(name = "categoryitemId", required = false) String categoryitemId,
|
|
|
+ @RequestParam(name = "brandId", required = false) String brandId,
|
|
|
+ @RequestParam(name = "specs", required = false) String specs,
|
|
|
+ @RequestParam(name = "artsVision", required = false) String artsVision) {
|
|
|
+ LambdaQueryWrapper<GoodsDesc> goodsDescLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(cname), GoodsDesc::getCname, cname);
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(cnameInt), GoodsDesc::getCnameInt, cnameInt);
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(ename), GoodsDesc::getEname, ename);
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(code), GoodsDesc::getCode, code);
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(label), GoodsDesc::getCode, label);
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(remarks), GoodsDesc::getCode, remarks);
|
|
|
+ goodsDescLambdaQueryWrapper.like(!StringUtils.isBlank(specs), GoodsDesc::getSpecs, specs);
|
|
|
+ goodsDescLambdaQueryWrapper.eq(GoodsDesc::getTenantId, AuthUtil.getTenantId());
|
|
|
+ goodsDescLambdaQueryWrapper.eq(GoodsDesc::getType, 0);
|
|
|
+ goodsDescLambdaQueryWrapper.eq(ObjectUtils.isNotNull(status), GoodsDesc::getStatus, status);
|
|
|
+ goodsDescLambdaQueryWrapper.eq(ObjectUtils.isNotNull(brandId), GoodsDesc::getBrandId, brandId);
|
|
|
+ goodsDescLambdaQueryWrapper.eq(ObjectUtils.isNotNull(unit), GoodsDesc::getUnit, unit);
|
|
|
+ goodsDescLambdaQueryWrapper.eq(ObjectUtils.isNotNull(categoryitem), GoodsDesc::getCategoryitem, categoryitem);
|
|
|
+ goodsDescLambdaQueryWrapper.eq(ObjectUtils.isNotNull(upperFrame), GoodsDesc::getUpperFrame, upperFrame);
|
|
|
+ if (StringUtils.isNotEmpty(artsVision)) {
|
|
|
+ goodsDescLambdaQueryWrapper.and(i -> i.like(GoodsDesc::getArtsVision, artsVision).or().isNull(GoodsDesc::getArtsVision));
|
|
|
+ }
|
|
|
+ goodsDescLambdaQueryWrapper.apply(ObjectUtils.isNotNull(categoryitemId), "find_in_set(categoryitem_id,'" + categoryitemId + "')");
|
|
|
+ goodsDescLambdaQueryWrapper.orderByDesc(GoodsDesc::getCreateTime);
|
|
|
+ Page<GoodsDesc> page = new Page<>(current, size);
|
|
|
+ List<GoodsType> types = goodsDescType.list(new LambdaQueryWrapper<GoodsType>()
|
|
|
+ .eq(GoodsType::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(GoodsType::getIsDeleted, 0));
|
|
|
+ List<String> typeIds = new ArrayList<>();
|
|
|
+ for (GoodsType item : types) {
|
|
|
+ typeIds.add(item.getId() + "");
|
|
|
+ }
|
|
|
+ List<GoodsDesc> iPage = goodsDescService.list(goodsDescLambdaQueryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(iPage)) {
|
|
|
+ iPage.forEach(e -> {
|
|
|
+ String typeId = e.getGoodsTypeId();
|
|
|
+ String[] split = typeId.split(",");
|
|
|
+ List<String> stringList = Arrays.asList(split);
|
|
|
+ typeIds.retainAll(stringList);
|
|
|
+ if (CollectionUtils.isNotEmpty(typeIds)) {
|
|
|
+ String goodsTypeName = "";
|
|
|
+ for (String item : typeIds) {
|
|
|
+ goodsTypeName = types.stream().filter(i -> i.getId().equals(Long.parseLong(item))).findFirst().orElse(new GoodsType()).getCname() + ",";
|
|
|
+ }
|
|
|
+ e.setGoodsTypeName(goodsTypeName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return R.data(iPage);
|
|
|
+ }
|
|
|
+
|
|
|
}
|