提交 | 用户 | age
|
826b66
|
1 |
package com.hx.common.dao; |
C |
2 |
import com.hx.mybatisTool.SqlSentence; |
|
3 |
|
|
4 |
import java.io.Serializable; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
7 |
|
|
8 |
|
|
9 |
/** |
|
10 |
* dao通用接口 |
|
11 |
* @author ChenJiaHe |
|
12 |
* @Date 2020-10-14 |
|
13 |
*/ |
|
14 |
public interface CommonDao { |
|
15 |
|
|
16 |
/**新增,返回主键 |
|
17 |
* @param mapperClass mapper类 |
|
18 |
* @param entity 实体类 |
|
19 |
* @return 条数 |
|
20 |
*/ |
|
21 |
<T extends Serializable> int insert(Class<?> mapperClass, T entity); |
|
22 |
|
|
23 |
/**新增,返回主键 |
|
24 |
* @param mapperClass mapper类 |
|
25 |
* @param entity 实体类 |
|
26 |
* @return 条数 |
|
27 |
*/ |
|
28 |
<T extends Serializable> int insertById(Class<?> mapperClass, T entity); |
|
29 |
|
|
30 |
/**查询条数 |
|
31 |
* @param mapperClass mapper类 |
|
32 |
* @param sqlSentence 查询参数类 |
|
33 |
* @return 返回条数 |
|
34 |
*/ |
|
35 |
<T extends Serializable> int selectCount(Class<?> mapperClass, SqlSentence sqlSentence); |
|
36 |
|
|
37 |
/**查询条数 |
|
38 |
* @param mapperClass mapper类 |
|
39 |
* @param sqlSentence 查询参数类 |
|
40 |
* @return 返回条数 |
|
41 |
*/ |
|
42 |
<T extends Serializable> int selectCountSql(Class<?> mapperClass, SqlSentence sqlSentence); |
|
43 |
|
|
44 |
/**查询列表,返回实体类的List |
|
45 |
* @param mapperClass mapper类 |
|
46 |
* @param sqlSentence 查询参数类 |
|
47 |
* @return 返回list |
|
48 |
*/ |
|
49 |
<T extends Serializable> List<T> selectList(Class<?> mapperClass, SqlSentence sqlSentence); |
|
50 |
|
|
51 |
/**查询列表,返回Map的List |
|
52 |
* @param mapperClass mapper类 |
|
53 |
* @param sqlSentence 查询参数类 |
|
54 |
* @return Map的List |
|
55 |
*/ |
|
56 |
<T extends Serializable> List<Map<String,Object>> selectListMap(Class<?> mapperClass, SqlSentence sqlSentence); |
|
57 |
|
|
58 |
/**查询,返回单个实体 |
|
59 |
* @param mapperClass mapper类 |
|
60 |
* @param sqlSentence 查询参数类 |
|
61 |
* @return 返回实体类 |
|
62 |
*/ |
|
63 |
<T extends Serializable> T selectOne(Class<?> mapperClass, SqlSentence sqlSentence); |
|
64 |
|
|
65 |
/**查询,返回单个map |
|
66 |
* @param mapperClass mapper类 |
|
67 |
* @param sqlSentence 查询参数类 |
|
68 |
* @return 返回实体类 |
|
69 |
*/ |
|
70 |
<T extends Serializable> Map<String,Object> selectOneMap(Class<?> mapperClass, SqlSentence sqlSentence); |
|
71 |
|
|
72 |
/**查询,返回实体类没有大数据的 |
|
73 |
* @param mapperClass mapper类 |
|
74 |
* @param object 数据标识key |
|
75 |
* @return 返回实体类 |
|
76 |
*/ |
|
77 |
<T extends Serializable> T selectOneByKey(Class<?> mapperClass, Object object); |
|
78 |
|
|
79 |
/**查询,返回实体类有大数据的 |
|
80 |
* @param mapperClass mapper类 |
|
81 |
* @param object 数据标识key |
|
82 |
* @return 返回实体类 |
|
83 |
*/ |
|
84 |
<T extends Serializable> T selectOneByKeyBlob(Class<?> mapperClass, Object object); |
|
85 |
|
|
86 |
/**更新,返回更新数量 |
|
87 |
* @param mapperClass mapper类 |
|
88 |
* @param sqlSentence 查询参数类 |
|
89 |
* @return 返回条数 |
|
90 |
*/ |
|
91 |
<T extends Serializable> int updateWhere(Class<?> mapperClass, SqlSentence sqlSentence); |
|
92 |
|
|
93 |
/**更新,返回更新数量 |
|
94 |
* @param mapperClass mapper类 |
|
95 |
* @param entity 实体类 |
|
96 |
* @return 返回条数 |
|
97 |
*/ |
|
98 |
<T extends Serializable> int updateAll(Class<?> mapperClass, T entity); |
|
99 |
|
|
100 |
/**删除,返回删除数量 |
|
101 |
* @param mapperClass mapper类 |
|
102 |
* @param sqlSentence 查询参数类 |
|
103 |
* @return 返回条数 |
|
104 |
*/ |
|
105 |
<T extends Serializable> int deleteWhere(Class<?> mapperClass, SqlSentence sqlSentence); |
|
106 |
|
|
107 |
/**删除,返回删除数量 |
|
108 |
* @param mapperClass mapper类 |
|
109 |
* @param object 数据标识key |
|
110 |
* @return 返回条数 |
|
111 |
*/ |
|
112 |
<T extends Serializable> int deleteById(Class<?> mapperClass, Object object); |
|
113 |
|
|
114 |
/**更新sql语句(全语句) |
|
115 |
* @param sqlSentence 查询参数类 |
|
116 |
* @return 返回条数 |
|
117 |
*/ |
|
118 |
<T extends Serializable> int updateSentence( SqlSentence sqlSentence); |
|
119 |
|
|
120 |
/**查询条数语句(全语句) |
|
121 |
* @param sqlSentence 查询参数类 |
|
122 |
* @return 返回条数 |
|
123 |
*/ |
|
124 |
<T extends Serializable> int selectCountSql( SqlSentence sqlSentence); |
|
125 |
|
|
126 |
|
|
127 |
} |