package com.cpop.oam.web;

import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.Row;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import static com.cpop.oam.business.entity.table.BrandTableDef.BRAND;

/**
 * @author DB
 * @version 1.0.0
 * @since 2024-04-27 20:38
 */
@SpringBootTest
public class JamboxDataSourceTests {

    /**
     * 获取果酱品牌数据
     * @author DB
     * @since 2023/12/07
     */
    @Test
    public void getJamboxBrandData() {
        try {
            DataSourceKey.use("jambox", () -> {
                Row row = Db.selectOneByQuery(BRAND.getTableName(), QueryWrapper.create().where(BRAND.ID.eq("134483921482485760")));
                System.out.println(row);
            });
        } finally {
            DataSourceKey.clear();
        }
        //SpringUtils.getBean(BrandService.class).queryChain().where(BRAND.ID.eq("134483921482485760")).one();
    }
}
