88c4a6ad2e9139adee418b925a2fa31a41b46200.svn-base
3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.espeed.service.impl;
import java.util.List;
import com.espeed.dao.YxySendFilterAddressDao;
import com.espeed.pojo.YxySendFilterAddress;
import com.espeed.service.YxySendFilterAddressService;
import com.espeed.vo.PageBean;
public class YxySendFilterAddressServiceImpl implements YxySendFilterAddressService{
/**条件查询过滤地址*/
public List<YxySendFilterAddress> findByCondition(String loginid,String domain, int condition, String conditionvalue, PageBean pb)throws Exception {
String hql="from YxySendFilterAddress where 1=1";
String hqlcount="select count(*) from YxySendFilterAddress where 1=1";
if(condition==0){
hql+=" and filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"'";
hqlcount+=" and filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"'";
}else if(condition==1){//分类查询
hql+=" and filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"' and filterid="+conditionvalue;
hqlcount+=" and filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"' and filterid="+conditionvalue;
}else if(condition==2){//条件模糊查询
hql+=" and filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"' and filteraddress like'%"+conditionvalue+"%'";
hqlcount+=" and filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"' and filteraddress like'%"+conditionvalue+"%'";
}
return yxysendfilteraddressdao.findByHqlPage(hql, hqlcount, pb);
}
/**查询已存在的地址*/
public List<Object> findIsExits(String loginid, String domain)throws Exception {
String sql="select filteraddress from yxy_send_filter_address where filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"'";
return yxysendfilteraddressdao.findBySqlQuery(sql);
}
/**循环插入过滤地址*/
public void addFilterAddressPi(List<YxySendFilterAddress> list)throws Exception {
yxysendfilteraddressdao.addPojoPi(list);
}
/**删除所选过滤地址*/
public void delFilterAddress(String addressstr) throws Exception {
String hql="delete YxySendFilterAddress where filteraddrid in("+addressstr+")";
yxysendfilteraddressdao.updateByHql(hql);
}
/**根据类别ID查询过滤地址*/
public List<YxySendFilterAddress> findByTypeId(int typeid) throws Exception {
String hql="form YxySendFilterAddress where filterid="+typeid;
return yxysendfilteraddressdao.findByHql(hql);
}
/**根据类别ID查询过滤地址*/
public List<Object> findByTypeidAddress(int typeid)throws Exception{
String sql="select filteraddress from yxy_send_filter_address where filterid="+typeid;
return yxysendfilteraddressdao.findBySqlQuery(sql);
}
/**过滤地址是否存在*/
public int findIsExits(String loginid, String domain,String address) throws Exception {
String sql="select count(*) from yxy_send_filter_address where filteraddrloginid='"+loginid+"' and filteraddrdomain='"+domain+"' and filteraddress='"+address+"'";
List<Object> list=yxysendfilteraddressdao.findBySqlQuery(sql);
if(Integer.parseInt(list.get(0).toString())>0){
return 0;
}else{
return 1;
}
}
/**编辑过滤地址*/
public void updateFilterAddress(YxySendFilterAddress o) throws Exception {
String hql="update YxySendFilterAddress set filterid="+o.getFilterid()+", filteraddrreason='"+o.getFilteraddrreason()+"',filteraddress='"+o.getFilteraddress()+"' where filteraddrid="+o.getFilteraddrid();
yxysendfilteraddressdao.updateByHql(hql);
}
private YxySendFilterAddressDao yxysendfilteraddressdao;//过滤地址dao
public YxySendFilterAddressDao getYxysendfilteraddressdao() {
return yxysendfilteraddressdao;
}
public void setYxysendfilteraddressdao(
YxySendFilterAddressDao yxysendfilteraddressdao) {
this.yxysendfilteraddressdao = yxysendfilteraddressdao;
}
}