xiaoyong931011
2021-09-16 e650b38116016251c77e546dddd96da989548cf1
20210916
4 files modified
20 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsCategory.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsCategoryService.java 7 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallGoodsCategoryMapper.xml 4 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/product/categoryAdd.html 7 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/entity/MallGoodsCategory.java
@@ -18,4 +18,6 @@
    @TableField(exist = false)
    private String parentName;
    private Integer isComand;
}
src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallGoodsCategoryService.java
@@ -44,11 +44,16 @@
        MallGoodsCategory goodsCategory = new MallGoodsCategory();
        goodsCategory.setName(name);
        goodsCategory.setIsComand(mallGoodsCategory.getIsComand());
        if(ObjectUtil.isNotEmpty(mallGoodsCategory.getParentId())){
            Long parentId = mallGoodsCategory.getParentId();
            MallGoodsCategory mallGoodsCategoryParent = mallGoodsCategoryMapper.selectById(parentId);
            goodsCategory.setParentId(mallGoodsCategory.getParentId());
//            goodsCategory.setParentIds(mallGoodsCategoryParent.getParentIds()+mallGoodsCategory.getParentId()+",");
            if(StrUtil.isNotEmpty(mallGoodsCategoryParent.getParentIds())){
                goodsCategory.setParentIds(mallGoodsCategoryParent.getParentIds()+","+mallGoodsCategory.getParentId()+",");
            }else{
                goodsCategory.setParentIds(mallGoodsCategory.getParentId()+",");
            }
        }
        mallGoodsCategoryMapper.insert(goodsCategory);
        return new FebsResponse().success();
src/main/resources/mapper/modules/MallGoodsCategoryMapper.xml
@@ -3,7 +3,7 @@
<mapper namespace="cc.mrbird.febs.mall.mapper.MallGoodsCategoryMapper">
    <select id="selectCategoryList" resultType="cc.mrbird.febs.mall.entity.MallGoodsCategory">
        SELECT m.name,b.name
        SELECT m.name,b.name parentName
                FROM mall_goods_category m
                left join mall_goods_category b on m.parent_id = b.id
        <where>
@@ -13,7 +13,7 @@
                </if>
            </if>
        </where>
        order by m.CREATED_TIME desc
        order by m.parent_id asc
    </select>
    <select id="selectCategoryByName" resultType="cc.mrbird.febs.mall.entity.MallGoodsCategory">
src/main/resources/templates/febs/views/modules/product/categoryAdd.html
@@ -36,6 +36,13 @@
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label febs-form-item-require">是否推荐:</label>
            <div class="layui-input-block">
                <input type="radio" name="isComand" value="1" title="是" >
                <input type="radio" name="isComand" value="2" title="否" checked="">
            </div>
        </div>
        <div class="layui-form-item febs-hide">
            <button class="layui-btn" lay-submit="" lay-filter="categary-add-form-submit" id="submit"></button>
        </div>