Helius
2020-12-23 eb668b4fe0579e53938514eb4783d8f39a110dc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.matrix.system.app.action;
 
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.ShoppingGoodsListDto;
import com.matrix.system.app.vo.ShoppingGoodsListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.hive.bean.ShoppingGoodsCategory;
import com.matrix.system.hive.service.ShoppingGoodsCategoryService;
import com.matrix.system.hive.service.ShoppingGoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * @author wzy
 * @date 2020-12-21
 **/
@Api(value = "ApiOrderAction", tags = "订单接口类")
@RestController
@RequestMapping(value = "/api/order")
public class ApiOrderAction {
 
    @Autowired
    private ShoppingGoodsCategoryService shoppingGoodsCategoryService;
 
    @Autowired
    private ShoppingGoodsService shoppingGoodsService;
 
    @ApiOperation(value = "获取商品类型列表", notes = "获取商品类型列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = ShoppingGoodsCategory.class)
    })
    @GetMapping(value = "/findShoppingGoodsType")
    public AjaxResult findShoppingGoodsType() {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
 
        ShoppingGoodsCategory category = new ShoppingGoodsCategory();
        category.setShopId(user.getShopId());
        return AjaxResult.buildSuccessInstance(shoppingGoodsCategoryService.findByModel(category));
    }
 
    @ApiOperation(value = "获取商品列表", notes = "获取商品列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = ShoppingGoodsListVo.class)
    })
    @PostMapping(value = "/findShoppingGoods")
    public AjaxResult findShoppingGoods(@RequestBody @Validated ShoppingGoodsListDto shoppingGoodsListDto) {
 
        return AjaxResult.buildSuccessInstance(shoppingGoodsService.findShoppingGoodsListForApi(shoppingGoodsListDto), shoppingGoodsService.findShoppingGoodsListTotalForApi(shoppingGoodsListDto));
    }
 
    @PostMapping(value = "/createOrder")
    public AjaxResult createOrder() {
        return null;
    }
 
}