Administrator
2025-07-09 44aa87717297bb4fca4bb83ba631646a87749174
src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
@@ -13,6 +13,9 @@
import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
@@ -46,9 +49,120 @@
    private final ClothesTypePatternMapper clothesTypePatternMapper;
    private final ClothesTypeLocationMapper clothesTypeLocationMapper;
    private final ClothesOrderMapper clothesOrderMapper;
    private final ClothesSocialCategoryMapper clothesSocialCategoryMapper;
    private final ClothesSocialMapper clothesSocialMapper;
    private final ClothesSocialMuseMapper clothesSocialMuseMapper;
    private final ClothesSocialFileMapper clothesSocialFileMapper;
    private final MallExpressInfoMapper mallExpressInfoMapper;
    /**
     * 社区分类列表
     */
    @GetMapping("groupList")
    @RequiresPermissions("groupList:view")
    public String groupList() {
        return FebsUtil.view("modules/clothesType/groupList");
    }
    /**
     * 社区分类新增
     * @return
     */
    @GetMapping(value = "/groupAdd")
    @RequiresPermissions("groupAdd:add")
    public String groupAdd() {
        return FebsUtil.view("modules/clothesType/groupAdd");
    }
    /**
     * 社区分类编辑
     * @param id
     * @param model
     * @return
     */
    @GetMapping("groupInfo/{id}")
    @RequiresPermissions("groupInfo:view")
    public String groupInfo(@PathVariable long id, Model model) {
        ClothesSocialCategory clothesSocialCategory = clothesSocialCategoryMapper.selectById(id);
        model.addAttribute("voteActivityGroup", clothesSocialCategory);
        return FebsUtil.view("modules/clothesType/groupInfo");
    }
    /**
     * 社区列表
     */
    @GetMapping("socialList")
    @RequiresPermissions("socialList:view")
    public String socialList() {
        return FebsUtil.view("modules/clothesType/socialList");
    }
    /**
     * 社区-新增
     */
    @GetMapping("socialAdd")
    @RequiresPermissions("socialAdd:add")
    public String socialAdd() {
        return FebsUtil.view("modules/clothesType/socialAdd");
    }
    /**
     * 社区-修改
     */
    @GetMapping("socialUpdate/{id}")
    @RequiresPermissions("socialUpdate:update")
    public String socialUpdate(@PathVariable long id, Model model) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
        List<ClothesSocialFile> clothesSocialFiles = clothesSocialFileMapper.selectList(
                Wrappers.lambdaQuery(ClothesSocialFile.class)
                        .eq(ClothesSocialFile::getSocialId, id)
        );
        if(CollUtil.isNotEmpty(clothesSocialFiles)){
            clothesSocial.setImages(clothesSocialFiles.stream().map(ClothesSocialFile::getFileUrl).collect(Collectors.toList()));
        }
        ClothesSocialMuse clothesSocialMuse = clothesSocialMuseMapper.selectOne(
                Wrappers.lambdaQuery(ClothesSocialMuse.class)
                        .eq(ClothesSocialMuse::getSocialId, clothesSocial.getId())
                .last("LIMIT 1")
        );
        if(ObjectUtil.isNotNull(clothesSocialMuse)){
            clothesSocial.setTypeId(clothesSocialMuse.getTypeId());
        }
        model.addAttribute("activity", clothesSocial);
        return FebsUtil.view("modules/clothesType/socialUpdate");
    }
    /**
     * 社区-灵感
     */
    @GetMapping("socialMuseUpdate/{id}")
    @RequiresPermissions("socialMuseUpdate:update")
    public String socialMuseUpdate(@PathVariable long id, Model model) {
        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
        ClothesSocialMuse clothesSocialMuse = clothesSocialMuseMapper.selectOne(
                Wrappers.lambdaQuery(ClothesSocialMuse.class)
                        .eq(ClothesSocialMuse::getSocialId, clothesSocial.getId())
                .last("LIMIT 1")
        );
        String patternRemark = clothesSocialMuse.getPatternRemark();
        if(StrUtil.isNotBlank(patternRemark)){
            JSON parse = JSONUtil.parse(patternRemark);
            clothesSocialMuse.setPatternText(parse.getByPath("text", String.class));
            clothesSocialMuse.setPatternImage(parse.getByPath("file", String.class));
        }
        model.addAttribute("socialMuse", clothesSocialMuse);
        return FebsUtil.view("modules/clothesType/socialMuseUpdate");
    }
    /**
     * 订单列表
     */
    @GetMapping("orderList")