如何通过MyBits获取数据库的值

public List getByWgCgPurchaseId(String id) {
//使用Mybatis读取数据库
List wgCgPurchaseEntryList = new ArrayList();
/*for(int i=0;i<=1;i++) {
WgCgPurchaseEntry wgCgPurchaseEntry = new WgCgPurchaseEntry();
wgCgPurchaseEntry.setId("902093569836187648"+i);
wgCgPurchaseEntry.setWgPurchaseId("902093569492254720");
wgCgPurchaseEntry.setWgMaterialId("901990015158976512");
wgCgPurchaseEntry.setWgMaterialCode("01.09");
wgCgPurchaseEntry.setWgMaterialName("111");
wgCgPurchaseEntryList.add(wgCgPurchaseEntry);
}*/
return wgCgPurchaseEntryList;
}
这种是手动赋值,怎么才能获取到数据库的值????

xxxMapper.java
public interface xxxMapper {
public List getByWgCgPurchaseId(@Param(value="id") String id);
}

xxxMapper.xml

select * from xxxx where id=#{id};

 xxxMapper.java
public interface xxxMapper {
    public List getByWgCgPurchaseId(@Param(value="id") String id);
}

xxxMapper.xml
<select id="getByWgCgPurchaseId" resultMap="WgCgPurchaseEntry">
    select * from xxxx where id=#{id};
</select>