|  | @@ -0,0 +1,68 @@
 | 
	
		
			
				|  |  | +package com.ym.mec.web.controller;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  | +import com.ym.mec.web.dal.entity.Goods;
 | 
	
		
			
				|  |  | +import com.ym.mec.web.dal.entity.Subject;
 | 
	
		
			
				|  |  | +import com.ym.mec.web.dal.page.GoodsQueryInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.web.dal.page.SubjectQueryInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.web.service.GoodsService;
 | 
	
		
			
				|  |  | +import com.ym.mec.web.service.SubjectService;
 | 
	
		
			
				|  |  | +import io.swagger.annotations.*;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@RequestMapping("goods")
 | 
	
		
			
				|  |  | +@Api(tags = "商品(教材、辅件)服务")
 | 
	
		
			
				|  |  | +@RestController
 | 
	
		
			
				|  |  | +public class GoodsController extends BaseController {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private GoodsService goodsService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "新增商品(教材、辅件)")
 | 
	
		
			
				|  |  | +    @PostMapping("/add")
 | 
	
		
			
				|  |  | +    public Object add(Goods goods){
 | 
	
		
			
				|  |  | +        Date date = new Date();
 | 
	
		
			
				|  |  | +        goods.setCreateTime(date);
 | 
	
		
			
				|  |  | +        goods.setUpdateTime(date);
 | 
	
		
			
				|  |  | +        goodsService.insert(goods);
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "删除商品(教材、辅件)")
 | 
	
		
			
				|  |  | +    @DeleteMapping("/del/{id}")
 | 
	
		
			
				|  |  | +    public Object del(@ApiParam(value = "商品(教材、辅件)编号", required = true) @PathVariable("id") Integer id){
 | 
	
		
			
				|  |  | +        goodsService.delete(id);
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "修改商品(教材、辅件)")
 | 
	
		
			
				|  |  | +    @PutMapping("/update")
 | 
	
		
			
				|  |  | +    public Object update(Goods goods){
 | 
	
		
			
				|  |  | +        goods.setUpdateTime(new Date());
 | 
	
		
			
				|  |  | +        goodsService.update(goods);
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "根据商品(教材、辅件)编号查询商品(教材、辅件)")
 | 
	
		
			
				|  |  | +    @GetMapping("/get/{id}")
 | 
	
		
			
				|  |  | +    public Object get(@ApiParam(value = "商品(教材、辅件)编号", required = true) @PathVariable("id") Integer id){
 | 
	
		
			
				|  |  | +        return succeed(goodsService.get(id));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "分页查询商品(教材、辅件)列表")
 | 
	
		
			
				|  |  | +    @PostMapping("/queryPage")
 | 
	
		
			
				|  |  | +    public Object queryPage(GoodsQueryInfo queryInfo){
 | 
	
		
			
				|  |  | +        return succeed(goodsService.queryPage(queryInfo));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "通过科目编号、商品分类 查询商品(教材、辅件)列表")
 | 
	
		
			
				|  |  | +    @PostMapping("/queryGoodsBySubId")
 | 
	
		
			
				|  |  | +    @ApiImplicitParams({ @ApiImplicitParam(name = "subjectId", value = "科目编号", required = true, dataType = "Integer"),
 | 
	
		
			
				|  |  | +            @ApiImplicitParam(name = "goodsCategoryId", value = "商品分类", required = true, dataType = "Integer")})
 | 
	
		
			
				|  |  | +    public Object findGoodsBySubId(Integer subjectId,Integer goodsCategoryId){
 | 
	
		
			
				|  |  | +        return succeed(goodsService.findGoodsBySubId(subjectId,goodsCategoryId));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |