package com.ruoyi.bst.ad.service.impl;

import com.ruoyi.bst.ad.domain.Ad;
import com.ruoyi.bst.ad.domain.AdQuery;
import com.ruoyi.bst.ad.enums.AdBlong;
import com.ruoyi.bst.ad.service.AdConverter;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;



@Service
public class AdConverterImpl implements AdConverter {
    @Override
    public AdQuery toAdQueryByCreate(Ad ad) {
        AdQuery query = new AdQuery();
        query.setStoreId(ad.getStoreId());
        return query;
    }

    @Override
    public AdQuery toAdAdminVO() {
        AdQuery query = new AdQuery();
        query.setBelong(AdBlong.ADMIN.getCode());
        return query;
    }

    @Override
    public AdQuery toAdStoreVO() {
        AdQuery query = new AdQuery();
        query.setUserId(SecurityUtils.getUserId());
        query.setStoreId(SecurityUtils.getUserId());
        query.setBelong(AdBlong.STORE.getCode());
        return query;
    }

}
