例:完整的Sql语句
select id,name,description,img_url,web_site,sort,is_displayfrom bbs_brand where is_display = #{isDisplay} and name = #{name} and ... group by having order by name desc(asc),id desc,... limit 开始行,每页数
第一步:从品牌BrandDao.xml 中的sql开始
第二步:用<sql>提取查询表部分Sql语句
select id,name,description,img_url,web_site,sort,is_display from bbs_brand
第三步:用<sql>提取where部分
select id,name,description,img_url,web_site,sort,is_display from bbs_brand name = #{name} and is_display = #{isDisplay}
第四步:测试
@Test public void TestGetBrandList1() { Brand brand=new Brand(); brand.setIsDisplay(1); Listbrands= brandService.getBrandList1(brand); for (Brand brand1 : brands) { System.out.println(brand1.toString()); } }