SQL不等于问题
String hql="from GdzcView g where g.gongSi = ?";
if(Integer.parseInt(qzaiyong)==0){
hql+=" and g.zhuanTai <> 1";
}
if(Integer.parseInt(qkuchun)==0){
hql+=" and g.zhuanTai <> 0";
}
if(Integer.parseInt(qbaofei)==0){
hql+=" and g.zhuanTai <> 2";
}
得出的结果是
from GdzcView g where g.gongSi = ? and g.zhuanTai <> 1 and g.zhuanTai <> 0
因为 qbaofei=1 本想会只留下g.zhuanTai =2的,但是无效,全出来,请高手说说或帮忙改改,叩谢