package cc.smtweb.framework.test;

import cc.smtweb.framework.core.CoreApplication;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Akmm at 2022/4/24 14:58
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CoreApplication.class)
public class NamedJdbcTest {
    @Test
    public void testSelect() {
        List<DefaultEntity> list = DbEngine.getInstance().query("select * from asp_model_project", DefaultEntity.class);
        System.out.println(list.size());
        Map<String, Object> params = new HashMap<>();
        params.put("id", 1);
        list = DbEngine.getInstance().queryN("select * from asp_model_project where prj_id=:id", params, DefaultEntity.class);
        System.out.println(list.size());
    }
}
