BaseServiceImpl.java
1.78 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
package com.bjivt.base.service.impl;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bjivt.base.dao.BaseDao;
import com.bjivt.base.service.BaseService;
import com.bjivt.util.Pager;
/**
*
* @author Jason.chen
*
* @param <T>
* @param <ID>
*/
public abstract class BaseServiceImpl<T, ID extends Serializable> implements BaseService<T, ID> {
@Override
public abstract BaseDao<T, Serializable> getBaseDao();
@Override
public int deleteById(ID id) {
return this.getBaseDao().deleteById(id);
}
@Override
public int insert(T record) {
return this.getBaseDao().save(record);
}
@Override
public int insertSelective(T record) {
return this.getBaseDao().insertSelective(record);
}
@Override
public T selectById(ID id) {
return this.getBaseDao().selectById(id);
}
@Override
public int updateByIdSelective(T record) {
return this.getBaseDao().updateByIdSelective(record);
}
@Override
public int updateById(T record) {
return this.getBaseDao().update(record);
}
@Override
public List<T> findListByMap(Map<String,Object> map) {
return this.getBaseDao().findListByMap(map);
}
@Override
public List<T> findListBy(T param) {
return this.getBaseDao().findListBy(param,null,null);
}
@Override
public List<T> findListByPage(T param,Pager page){
Map<String, Object> map = new HashMap<String, Object>();
if (page != null) {
page.setCount(getCountBy(param));
}
map.put("page", page);
map.put(param.getClass().getSimpleName(), param);
return this.getBaseDao().findListByMap(map);
}
@Override
public Integer getCountBy(T param){
return this.getBaseDao().getCountBy(param);
}
@Override
public Integer findCountBy(T param){
return this.getBaseDao().findCountBy(param);
}
}