xiaoyong931011
2023-02-20 482c4d31a383af516fa53814e40b695d66b3e314
支付剩余时间
6 files modified
47 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallGoodsServiceImpl.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/GoodsDetailsSkuVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsMapper.xml 8 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/goods/goodsList.html 9 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/order/orderList.html 7 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsSku.java
@@ -41,5 +41,8 @@
    //重量
    private BigDecimal goodsWeight;
    @TableField(exist = false)
    private BigDecimal skuGoodsWeight;
    private String sample;
}
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallGoodsServiceImpl.java
@@ -13,6 +13,7 @@
import cc.mrbird.febs.mall.vo.*;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -91,6 +92,22 @@
        List<String> images = goodsImagesMapper.selectGoodsImagesByGoodsId(mallGoods.getId());
        MallGoodsDetailsVo mallGoodsDetailsVo = MallGoodsConversion.INSTANCE.entityToDetailsVo(mallGoods);
        List<GoodsDetailsStyleVo> styles = mallGoodsDetailsVo.getStyles();
        if(ObjectUtil.isNotEmpty(styles)){
            for(GoodsDetailsStyleVo goodsDetailsStyleVo : styles){
                List<GoodsDetailsSkuVo> skus = goodsDetailsStyleVo.getSkus();
                if(CollUtil.isNotEmpty(skus) ){
                    for(GoodsDetailsSkuVo goodsDetailsSkuVo : skus){
                        if(StrUtil.isNotEmpty(goodsDetailsSkuVo.getSample())){
                            goodsDetailsSkuVo.setSampleFlag(true);
                        }else{
                            goodsDetailsSkuVo.setSampleFlag(false);
                        }
                    }
                }
            }
        }
        if (CollUtil.isNotEmpty(mallGoods.getStyles())) {
            Map<String, BigDecimal> stockAndVolume = this.baseMapper.selectGoodsStockAndVolume(id);
            mallGoodsDetailsVo.setStock(stockAndVolume.get("stock").intValue());
src/main/java/cc/mrbird/febs/mall/vo/GoodsDetailsSkuVo.java
@@ -38,6 +38,9 @@
    @ApiModelProperty(value = "样品,为空则代表不是样品")
    private String sample;
    @ApiModelProperty(value = "样品,为空则代表不是样品")
    private Boolean sampleFlag;
    @ApiModelProperty(value = "重量")
    private BigDecimal goodsWeight;
}
src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -25,7 +25,7 @@
        <result property="carriageType" column="carriage_type" />
        <result property="carriageAmount" column="carriage_amount" />
        <result property="carriageRuleId" column="carriage_rule_id" />
<!--        <result property="goodsWeight" column="goods_weight" />-->
        <result property="goodsWeight" column="goods_weight" />
        <collection property="styles" ofType="cc.mrbird.febs.mall.entity.MallGoodsStyle">
            <id property="id" column="style_id" />
            <result property="name" column="style_name" />
@@ -40,7 +40,8 @@
                <result property="presentPrice" column="sku_present_price" />
                <result property="styleId" column="sku_style_id"/>
                <result property="goodsId" column="sku_goods_id" />
                <result property="goodsWeight" column="goods_weight" />
                <result property="skuGoodsWeight" column="goods_weight" />
                <result property="sample" column="sample" />
            </collection>
        </collection>
    </resultMap>
@@ -59,7 +60,8 @@
            c.original_price sku_original_price,
            c.present_price sku_present_price,
            c.style_id sku_style_id,
            c.goods_weight goodsWeight,
            c.goods_weight skuGoodsWeight,
            c.sample sample,
            c.goods_id sku_goods_id
        from mall_goods a
          left join mall_goods_style b on a.id = b.goods_id
src/main/resources/templates/febs/views/modules/goods/goodsList.html
@@ -104,7 +104,9 @@
            tableIns;
        form.render();
        let currPageGoods = 1;//首先默认值为1,防止出错
        //获取当前页
        currPageGoods = $view.find(".layui-laypage-em").next().html();
        // 表格初始化
        initTable();
@@ -194,14 +196,15 @@
        // 查询按钮
        $query.on('click', function () {
            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
            tableIns.reload({where: params, page: {curr: 1}});
            // params.pageNum = $view.find(".layui-laypage-em").next().html();
            tableIns.reload({where: params, page: {curr: currPageGoods}});
        });
        // 刷新按钮
        $reset.on('click', function () {
            $searchForm[0].reset();
            sortObject.type = 'null';
            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
            tableIns.reload({where: getQueryParams(), page: {curr: currPageGoods}, initSort: sortObject});
        });
        $add.on('click', function () {
src/main/resources/templates/febs/views/modules/order/orderList.html
@@ -143,6 +143,9 @@
            laydate = layui.laydate,
            tableIns;
        let currPageOrder = 1;//首先默认值为1,防止出错
        //获取当前页
        currPageOrder = $view.find(".layui-laypage-em").next().html();
        //日期范围
        laydate.render({
            elem: '#febs-form-group-date-start'
@@ -357,14 +360,14 @@
        // 查询按钮
        $query.on('click', function () {
            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
            tableIns.reload({where: params, page: {curr: 1}});
            tableIns.reload({where: params, page: {curr: currPageOrder}});
        });
        // 刷新按钮
        $reset.on('click', function () {
            $searchForm[0].reset();
            sortObject.type = 'null';
            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
            tableIns.reload({where: getQueryParams(), page: {curr: currPageOrder}, initSort: sortObject});
        });
        $add.on('click', function () {