|
@@ -2,7 +2,9 @@ package com.ym.mec.web.controller;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.entity.GoodsCategory;
|
|
|
import com.ym.mec.biz.dal.entity.GoodsProcurement;
|
|
|
+import com.ym.mec.biz.service.GoodsCategoryService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -10,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -29,6 +32,8 @@ public class GoodsController extends BaseController {
|
|
|
@Autowired
|
|
|
private GoodsService goodsService;
|
|
|
@Autowired
|
|
|
+ private GoodsCategoryService goodsCategoryService;
|
|
|
+ @Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@ApiOperation(value = "新增商品(教材、辅件)")
|
|
@@ -90,7 +95,12 @@ public class GoodsController extends BaseController {
|
|
|
@ApiOperation(value = "根据商品(教材、辅件)编号查询商品(教材、辅件)")
|
|
|
@GetMapping("/get/{id}")
|
|
|
public Object get(@ApiParam(value = "商品(教材、辅件)编号", required = true) @PathVariable("id") Integer id){
|
|
|
- return succeed(goodsService.get(id));
|
|
|
+ Goods goods = goodsService.get(id);
|
|
|
+ if(Objects.nonNull(goods.getGoodsCategoryId())){
|
|
|
+ GoodsCategory goodsCategory = goodsCategoryService.get(goods.getId());
|
|
|
+ goods.setGoodsCategoryName(goodsCategory.getName());
|
|
|
+ }
|
|
|
+ return succeed(goods);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "分页查询商品(教材、辅件)列表")
|