|  | @@ -0,0 +1,61 @@
 | 
	
		
			
				|  |  | +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;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.ApiParam;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.PathVariable;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.RestController;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  | +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
 | 
	
		
			
				|  |  | +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){
 | 
	
		
			
				|  |  | +        Goods goods = goodsService.get(id);
 | 
	
		
			
				|  |  | +        GoodsCategory goodsCategory = goodsCategoryService.get(goods.getGoodsCategoryId());
 | 
	
		
			
				|  |  | +        if(Objects.nonNull(goodsCategory)){
 | 
	
		
			
				|  |  | +            goods.setGoodsCategoryName(goodsCategory.getName());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return succeed(goods);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "分页查询商品(教材、辅件)列表")
 | 
	
		
			
				|  |  | +    @GetMapping("/queryPage")
 | 
	
		
			
				|  |  | +    public Object queryPage(GoodsQueryInfo queryInfo){
 | 
	
		
			
				|  |  | +        return succeed(goodsService.queryPage(queryInfo));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")
 | 
	
		
			
				|  |  | +    @GetMapping("/queryGoodsBySubId")
 | 
	
		
			
				|  |  | +    @ApiImplicitParams({ @ApiImplicitParam(name = "subjectId", value = "科目编号", required = true, dataType = "Integer"),
 | 
	
		
			
				|  |  | +            @ApiImplicitParam(name = "type", value = "INSTRUMENT 乐器, ACCESSORIES 教辅", required = true, dataType = "String")})
 | 
	
		
			
				|  |  | +    public Object findGoodsBySubId(Integer subjectId,String type){
 | 
	
		
			
				|  |  | +        return succeed(goodsService.findGoodsBySubId(subjectId,type));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |