@Test public void insert() throws Exception { Brand brand = new Brand(); brand.setTypeId(1); brand.setCommon(1); brand.setName("brand"); brand.setBrandId(2); brandDao.insert(brand); }
@Override public void insert(Brand brand) { String sql = "insert into brand(type_id,brand_id,common,name) values(?,?,?,?)"; template.update(sql, new Object[]{brand.getTypeId(), brand.getBrandId(), brand.getCommon(), brand.getName()}); }
BrandDaoImpl implements BrandDao { @Override public void insert(Brand brand) { String sql = "insert into brand(type_id,brand_id,common,name) values(?,?,?,?)"; template.update(sql, new Object[]{brand.getTypeId(), brand.getBrandId(), brand.getCommon(), brand.getName()}); } }
BrandDaoImpl implements BrandDao { @Override public void insert(Brand brand) { String sql = "insert into brand(type_id,brand_id,common,name) values(?,?,?,?)"; template.update(sql, new Object[]{brand.getTypeId(), brand.getBrandId(), brand.getCommon(), brand.getName()}); }  }
BrandDaoImpl implements BrandDao { @Override public void insert(Brand brand) { String sql = "insert into brand(type_id,brand_id,common,name) values(?,?,?,?)"; template.update(sql, new Object[]{brand.getTypeId(), brand.getBrandId(), brand.getCommon(), brand.getName()}); }  JdbcTemplate getTemplate(); void setTemplate(JdbcTemplate template); @Override void insert(Brand brand); @Override void insert(List<Brand> brands); @Override List<Brand> queryBrands(int typeId); }
BrandDaoImpl implements BrandDao { @Override public void insert(Brand brand) { String sql = "insert into brand(type_id,brand_id,common,name) values(?,?,?,?)"; template.update(sql, new Object[]{brand.getTypeId(), brand.getBrandId(), brand.getCommon(), brand.getName()}); }  JdbcTemplate getTemplate(); void setTemplate(JdbcTemplate template); @Override void insert(Brand brand); @Override void insert(List<Brand> brands); @Override List<Brand> queryBrands(int typeId);  }