|
@@ -13,16 +13,25 @@ import com.ym.mec.biz.service.GoodsCategoryService;
|
|
|
import com.ym.mec.biz.service.GoodsService;
|
|
|
import com.ym.mec.biz.service.SysUserService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.dto.BrandDto;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RequestMapping("${app-config.url.web:}/goods")
|
|
|
@Api(tags = "商品(教材、辅件)服务")
|
|
@@ -112,7 +121,15 @@ public class GoodsController extends BaseController {
|
|
|
}else if(StringUtils.isEmpty(employee.getOrganIdList())){
|
|
|
return failed("用户所在分部异常");
|
|
|
}
|
|
|
- return succeed(goodsService.queryPage(queryInfo));
|
|
|
+ PageInfo<Goods> page = goodsService.queryPage(queryInfo);
|
|
|
+ List<Goods> rows = page.getRows();
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ Map<String, String> brandIdNameMap = goodsService.queryGoodsBrandList().stream().collect(Collectors.toMap(next -> next.getId().toString(), BrandDto::getName));
|
|
|
+ for (Goods row : rows) {
|
|
|
+ row.setBrandName(brandIdNameMap.getOrDefault(row.getBrand(), row.getBrand()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return succeed(page);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")
|