package org.jeecg.modules.adweb.site.controller;


import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.adweb.common.mapper.CommonMapper;
import org.jeecg.modules.adweb.site.dto.WordPressConfig;
import org.jeecg.modules.adweb.site.entity.AdwebSite;
import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
import org.jeecg.modules.system.entity.SysUser;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: adweb_site
 * @Author: jeecg-boot
 * @Date: 2020-12-24
 * @Version: V1.0
 */
@Tag(name = "adweb站点配置表单")
@RestController
@RequestMapping("/adweb/adwebSiteManage")
@Slf4j
public class AdwebSiteManageController extends JeecgController<AdwebSite, IAdwebSiteService> {

    @Resource
    private IAdwebSiteService adwebSiteManageService;

    @Resource
    private CommonMapper commonMapper;

    /**
     * 查询wordpress站点配置
     *
     * @param wordPressConfig
     * @return
     */
    @PostMapping(value = "/queryWordPressConfig")
    public Result<?> queryWordPressConfig(@RequestBody WordPressConfig wordPressConfig) {
        WordPressConfig config = this.adwebSiteManageService.queryWordPressConfig(wordPressConfig.getSiteCode());
        return Result.OK(config);
    }

    @GetMapping(value = "/getAdwebVip")
    public Result getAdwebVip() {
        List<SysUser> userList = commonMapper.getAdwebVip();
        return Result.OK(userList);
    }
}
