基础包新增count统计方法
This commit is contained in:
@@ -46,4 +46,6 @@ public interface TableMapper {
|
||||
int createSequence(@Param("tableName") String tableName, @Param("lastId")Object lastId);
|
||||
|
||||
Long count(@Param("tableName")String tableName,@Param("sql")String sql);
|
||||
|
||||
Long countBySql(@Param("sql") String sql);
|
||||
}
|
||||
|
||||
@@ -124,4 +124,6 @@ public interface BaseMapper {
|
||||
|
||||
Long count(String tableName, Condition condition);
|
||||
|
||||
Long count(Condition condition);
|
||||
|
||||
}
|
||||
|
||||
@@ -604,6 +604,11 @@ public class BaseMapperImpl implements BaseMapper {
|
||||
return tableMapper.count(tableName,condition.getSql());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long count(Condition condition) {
|
||||
return tableMapper.countBySql(condition.getSql());
|
||||
}
|
||||
|
||||
public void JudgesNull(Object object, String str) {
|
||||
if (object == null) {
|
||||
throw new BaseMapperException(str);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class AuthFilter extends AuthenticatingFilter {
|
||||
httpResponse.setHeader("Access-Control-Allow-Headers", "x-requested-with, X-Access-Token, datasource-Key");
|
||||
httpResponse.setHeader("Access-Control-Allow-Origin", myOrigin);
|
||||
httpResponse.setCharacterEncoding("UTF-8");
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
result.put("code", 3);
|
||||
result.put("msg", "未登陆");
|
||||
String json = JSON.toJSONString(result);
|
||||
@@ -86,7 +86,7 @@ public class AuthFilter extends AuthenticatingFilter {
|
||||
httpResponse.setHeader("Access-Control-Allow-Headers", "x-requested-with, X-Access-Token, datasource-Key");
|
||||
httpResponse.setHeader("Access-Control-Allow-Origin", myOrigin);
|
||||
httpResponse.setCharacterEncoding("UTF-8");
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
result.put("code", 3);
|
||||
result.put("msg", "未登陆");
|
||||
String json = JSON.toJSONString(result);
|
||||
@@ -117,7 +117,7 @@ public class AuthFilter extends AuthenticatingFilter {
|
||||
try {
|
||||
//处理登录失败的异常
|
||||
Throwable throwable = e.getCause() == null ? e : e.getCause();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
result.put("code", 3);
|
||||
result.put("msg", "未登陆");
|
||||
String json = JSON.toJSONString(result);
|
||||
|
||||
@@ -167,4 +167,7 @@
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
SELECT count(0) FROM ${tableName} ${sql}
|
||||
</select>
|
||||
<select id="countBySql" resultType="java.lang.Long">
|
||||
${sql}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user