📄 tipserviceimp.java
字号:
package service;
import hibernate.Brand;
import hibernate.Model;
import java.util.ArrayList;
import java.util.List;
import dao.BrandDao;
import dao.ModelDao;
public class TipServiceImp implements TipService{
private BrandDao branddao;
private ModelDao modeldao;
public List<String> getBrandsByPrefix(String prefix) {
List<Brand> list=branddao.findAllBrand();
List<String> result=new ArrayList<String>();
for(Brand brand:list)
{
if(brand.getName().toUpperCase().startsWith(prefix.toUpperCase()))
{
result.add(brand.getName());
}
}
return result;
}
public String getDescByModel(String model_name) {
Model model=modeldao.findByModel(model_name);
if(model!=null)
{
return model.getDescr();
}
return null;
}
public List<String> getModelsByPrefix(String brand) {
List<Model> list=modeldao.findByBrand(brand);
List<String> result=new ArrayList<String>();
for(Model model:list)
{
result.add(model.getName());
}
return result;
}
public BrandDao getBranddao() {
return branddao;
}
public void setBranddao(BrandDao branddao) {
this.branddao = branddao;
}
public ModelDao getModeldao() {
return modeldao;
}
public void setModeldao(ModelDao modeldao) {
this.modeldao = modeldao;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -