package com.czg.controller.user;

import com.czg.account.entity.ShopExtend;
import com.czg.account.service.ShopExtendService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
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
 */
@RestController
@RequestMapping("/user/shopExtend")
public class UShopExtendController {
    @Resource
    private ShopExtendService shopExtendService;

    /**
     * 根据key获取拓展信息
     * @param shopId 店铺id
     * @param autoKey key index_bg 首页 my_bg 个人中心 member_bg 会员卡 shopinfo_bg 商品列表 ticket_logo 标签打印logo
     * @return 详细信息
     */
    @GetMapping
    public CzgResult<ShopExtend> get(Long shopId, @RequestParam String autoKey) {
        return CzgResult.success(shopExtendService.getOne(new QueryWrapper().eq(ShopExtend::getShopId, shopId == null ? StpKit.USER.getShopId() : shopId).eq(ShopExtend::getAutoKey, autoKey)));
    }
}
