|
@@ -1,5 +1,8 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.entity.Goods;
|
|
|
+import com.ym.mec.biz.dal.entity.GoodsCategory;
|
|
|
+import com.ym.mec.biz.service.GoodsCategoryService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -17,6 +20,8 @@ import com.ym.mec.biz.dal.page.GoodsQueryInfo;
|
|
|
import com.ym.mec.biz.service.GoodsService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
@RequestMapping("goods")
|
|
|
@Api(tags = "商品(教材、辅件)服务")
|
|
|
@RestController
|
|
@@ -25,12 +30,19 @@ public class GoodsController extends BaseController {
|
|
|
@Autowired
|
|
|
private GoodsService goodsService;
|
|
|
@Autowired
|
|
|
+ private GoodsCategoryService goodsCategoryService;
|
|
|
+ @Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@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 = "分页查询商品(教材、辅件)列表")
|