935090232@qq.com
2021-03-18 5d43370b99a03391c9271d04d3f351f0fd734dae
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
66
67
68
package com.matrix.system.shopXcx.api.action;
 
import com.matrix.core.pojo.AjaxResult;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.common.interceptor.HostInterceptor;
import com.matrix.system.shopXcx.api.dto.SaleProductDto;
import com.matrix.system.shopXcx.bean.ShopProduct;
import com.matrix.system.shopXcx.dao.ShopProductAttributeDao;
import com.matrix.system.shopXcx.dao.ShopProductDao;
import com.matrix.system.shopXcx.dao.ShopSkuDao;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * @author jyy
 * @date 2021-03-10
 **/
@Api(tags = "分销商品类")
@RestController
@RequestMapping(value = "/wxapi/salesProduct")
public class WxSalesProductAction {
 
    @Autowired
    private ShopProductDao shopProductDao;
 
    @Autowired
    private ShopProductAttributeDao shopProductAttributeDao;
 
    @Autowired
    private ShopSkuDao shopSkuDao;
 
    @ApiOperation(value = "查询推广商品", notes = "")
    @PostMapping(value = "/getSalesProductList")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response=SaleProductDto.class)
    })
    public AjaxResult getShopProductShowList(@RequestBody @Validated SaleProductDto saleProductDto) {
        ShopProduct shopProduct=new ShopProduct();
        shopProduct.setLimit(saleProductDto.getPageSize());
        shopProduct.setOffset((saleProductDto.getPageNum()-1)* saleProductDto.getPageSize());
        shopProduct.setCategoryId(saleProductDto.getCategoryId());
        shopProduct.setDelFlag(AppConstance.DATA_USEABLE);
        shopProduct.setStatus(AppConstance.IS_PUTAWAY);
        shopProduct.setAbleSales(ShopProduct.ABLE_SALES);
        shopProduct.setCompanyId(HostInterceptor.getCompanyId());
        List<ShopProduct> shopProducts = shopProductDao.selectByModelWx(shopProduct);
        shopProducts.forEach(item->item.setSkus(shopSkuDao.selectByPid(item.getId())));
        AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, shopProducts);
        return result;
    }
 
 
 
 
 
 
 
}