package com.czg.controller.user;

import com.czg.account.entity.PlatformDict;
import com.czg.account.service.PlatformDictService;
import com.czg.resp.CzgResult;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 小程序平台配置相关
 * @author Administrator
 */
@RequestMapping("/user/dict")
@RestController
public class UPlatFormDictController {
    @Resource
    private PlatformDictService platformDictService;

    /**
     * 获取小程序dict配置
     * @param type homeDistrict--金刚区（首页）
     * carousel--轮播图
     * proTag--商品标签
     * shopTag--店铺标签
     * icon--小图标
     * subShop--预约到店顶部图
     * group--团购卷分类对应顶部图 value为团购卷Id
     * ownMenu--个人中心菜单
     * @return dict信息
     */
    @GetMapping
    public CzgResult<PlatformDict> get(@RequestParam String type) {
        return CzgResult.success(platformDictService.getOne(new QueryWrapper().eq(PlatformDict::getType, type)));
    }
}
